mainBgColor = "#5A7EA5";
mainBgColorHover = "#7A9EC5";

subBgColor = "#ffffff";
subBgColorHover = "#D0D7E9";

mainStyle = "navbarMain";
mainStyleHover = "navbarMainHover";
subStyle = "navbarSub";
subStyleHover = "navbarSubHover";

greenStyle = "navbarGreen";
greenStyleHover = "navbarGreenHover";

redStyle = "navbarRed";
redStyleHover = "navbarRedHover";



function clk(obj){
	if (document.all && obj.children.tags("A").length > 0 && obj.children.tags("a")[0].href)
		obj.children.tags("A")[0].click();
	else if (!document.all) {
		if (obj.document && obj.document.links[0]) location.href = obj.document.links[0].href;
		else if (obj.getElementsByTagName("a")){ 
			var links = obj.getElementsByTagName("a");
			if (links[0])
				location.href = links[0].href;
			}
		}
}

function sOver(obj){
	if (obj.className){
		obj.className = subStyleHover;
		if (obj.children){
			if (obj.children.tags("A").length > 0 && obj.children.tags("A")[0].href != ""){
				obj.style.cursor = "hand";
				var link = obj.children.tags("A")[0];
				status = link.href;
				if (!obj.title) obj.title = link.href.split("/")[link.href.split("/").length - 1];
				}
			else status = obj.innerText;
			}
		else if (obj.getElementsByTagName("a"))	status = obj.getElementsByTagName("a")[0].href;
	}
	else {
		obj.bgColor = subBgColorHover;
		if (obj.document.links[0]) status = obj.document.links[0].href;
	}
}

function sOut(obj){
	status = "";
	if (obj.className){
		obj.style.cursor = "";
		obj.className = subStyle;
		}
	else obj.bgColor = subBgColor;
}

function mOver(obj){
	if (obj.className){
		obj.className = mainStyleHover;
		if (obj.children){
			if (obj.children.tags("A").length > 0 && obj.children.tags("A")[0].href != ""){
				obj.style.cursor = "hand";
				var link = obj.children.tags("A")[0];
				status = link.href;
				if (!obj.title) obj.title = link.href.split("/")[link.href.split("/").length - 1];
				}
			else status = obj.innerText;
			}
		else if (obj.getElementsByTagName("a"))	status = obj.getElementsByTagName("a")[0].href;
		}
	else {
		obj.bgColor = mainBgColorHover;
		if (obj.document.links[0]) status = obj.document.links[0].href;
		}
}

function mOverGreen(obj){
	if (obj.className){
		obj.className = greenStyleHover;
		if (obj.children){
			if (obj.children.tags("A").length > 0 && obj.children.tags("A")[0].href != ""){
				obj.style.cursor = "hand";
				var link = obj.children.tags("A")[0];
				status = link.href;
				if (!obj.title) obj.title = link.href.split("/")[link.href.split("/").length - 1];
				}
			else status = obj.innerText;
			}
		else if (obj.getElementsByTagName("a"))	status = obj.getElementsByTagName("a")[0].href;
		}
	else {
		obj.bgColor = mainBgColorHover;
		if (obj.document.links[0]) status = obj.document.links[0].href;
		}
}

function mOutGreen(obj){
	status = "";
	if (obj.className){
		obj.style.cursor = "";
		obj.className = greenStyle;
		}
	else obj.bgColor = mainBgColor;
	}

function mOverRed(obj){
	if (obj.className){
		obj.className = redStyleHover;
		if (obj.children){
			if (obj.children.tags("A").length > 0 && obj.children.tags("A")[0].href != ""){
				obj.style.cursor = "hand";
				var link = obj.children.tags("A")[0];
				status = link.href;
				if (!obj.title) obj.title = link.href.split("/")[link.href.split("/").length - 1];
				}
			else status = obj.innerText;
			}
		else if (obj.getElementsByTagName("a"))	status = obj.getElementsByTagName("a")[0].href;
		}
	else {
		obj.bgColor = mainBgColorHover;
		if (obj.document.links[0]) status = obj.document.links[0].href;
		}
}

function mOutRed(obj){
	status = "";
	if (obj.className){
		obj.style.cursor = "";
		obj.className = redStyle;
		}
	else obj.bgColor = mainBgColor;
	}

function mOut(obj){
	status = "";
	if (obj.className){
		obj.style.cursor = "";
		obj.className = mainStyle;
		}
	else obj.bgColor = mainBgColor;
	}

function cap(obj){
if (document.layers){
	obj.captureEvents(Event.MOUSEUP);
	obj.captureEvents(Event.MOUSEOVER);
	obj.captureEvents(Event.MOUSEOUT);
	obj.onmouseup = function (e) { clk(obj); }
	obj.onmouseover = function (e) { eval(obj.name.substring(0,1).toLowerCase() + "Over(obj);"); } 
	obj.onmouseout = function (e) {eval(obj.name.substring(0,1).toLowerCase() + "Out(obj);"); }
	}
}

function centra(url, width, height)
   {
   if (document.all)
      {
      var x = window.screenLeft;
      var y = window.screenTop;
      var w = window.document.body.offsetWidth;
      var h = window.document.body.offsetHeight;
	  var cntx = x + Math.round((w - width) / 2);
      var cnty = y + Math.round((h - height) / 2);
	  window.open (url, null, 'left=' + cntx + ',top=' + cnty + ',width=' + width + ',height=' + height);
//	  window.showModelessDialog (url,"",'help:0;left:'+cntx+';top:'+cnty+';resizable:1;dialogWidth='+width+';dialogHeight='+height);
      }
  else
   {
   var x = window.screenX;
   var y = window.screenY;
   var w = window.outerWidth;
   var h = window.outerHeight;
   var cntx = x + Math.round((w - width) / 2);
   var cnty = y + Math.round((h - height) / 2);
   window.open (url, null, 'left=' + cntx + ',top=' + cnty + ',width=' + width + ',height=' + height);
   }

}
