var subsenast = '';
var marked = '#F7941D';
var unmark = '#0076A3';

// IMG pre loader
	marker = new Image();		marker.src = '/img/marker.gif'
	markeron = new Image();		markeron.src = '/img/marker_on.gif'

function loadPage(){
	if (Get_Cookie('submenuid') != null) {
		subOn(Get_Cookie('submenuid'));
		subsenast = Get_Cookie('submenuid');}
}

function subOn(img){
	document.images[img+'img'].src = eval('markeron.src');
	//imgOn(img+'img');
	enableMenu(img);
}

function subOff(img){
	if (subsenast != img){
		document.images[img+'img'].src = eval('marker.src');
		disableMenu(img)
	}
}

function subClick(img){
	tmp = subsenast;
	subsenast = img;
	Set_Cookie('submenuid',img);
	if (tmp != ''){
		subOff(tmp);
	}
}
function disableMenu(elem) {
		if (document.all){
			if (document.all[elem] != null)
			document.all[elem].style.color = unmark;}
		else if (document.layers){
			if (eval("document."+elem) != null)
			eval("document." + elem + ".style.color = unmark");}
		else{
			if (document.getElementById(elem) != null)
			document.getElementById(elem).style.color = unmark;}
}
	
function enableMenu(elem){
	if (document.all){
		if (document.all[elem] != null)
		document.all[elem].style.color = marked;}
	else if (document.layers){
		if (eval("document."+elem) != null)
		eval("document." + elem + ".style.color = marked");}
	else{
		if (document.getElementById(elem) != null)
		document.getElementById(elem).style.color = marked;}
}

function Get_Cookie(name) {
  var start = document.cookie.indexOf(name + '=');
  var len = start + name.length + 1;
  if ((!start) && (name != document.cookie.substring(0,name.length)))
    return null;
  if (start == -1)
    return null;
  var end = document.cookie.indexOf(';',len);
  if (end == -1) end = document.cookie.length;
  return unescape(document.cookie.substring(len,end));
}

function Set_Cookie(name,value,expires,path,domain,secure) {
  document.cookie = 
    name + '=' + escape(value) +
    ( (expires) ? ';expires=' + expires.toGMTString() : '') +
    ( (path) ? ';path=' + path : '') + 
    ( (domain) ? ';domain=' + domain : '') +
    ( (secure) ? ';secure' : '');
}

