var fwHideMenuTimer;

function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion 
    this.dom=document.getElementById?1:0 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ie5p=(document.all && this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
    return this 
} 
bw=new verifyCompatibleBrowser();

function getOffsetLeft(obj)
{
var o, offset;
	offset=0;
	for (o=obj;o.offsetParent;o=o.offsetParent)
	{
		if (!isNaN(o.offsetLeft)) offset = offset + o.offsetLeft;
	};
	return offset;
}

function getOffsetTop(obj)
{
var o, offset;
	offset=0;
	for (o=obj;o.offsetParent;o=o.offsetParent)
	{
		if (!isNaN(o.offsetTop)) offset = offset + o.offsetTop;
	};
	return offset;
}

function selectm(n) {
	img = new getObj(n)
	if (img.obj){
		newsrc = "/img/" + n + "_b.gif";
		img.obj.src = newsrc;
	}
	img = null;
}
function bover(n) {
	if (n=='b_'+'<%= selectedmi %>')
	{
		//alert(n);
		return true;
	};
	img = new getObj(n)
	if (img.obj){
		newsrc = "/img/" + n + "_a.gif";
		img.obj.src = newsrc;
	}
	img = null;
}
function bout(n) {
	if (n=='b_'+'<%= selectedmi %>')
	{
		//alert(n);
		return true;
	};
	img = new getObj(n)
	if (img.obj){
		newsrc = "/img/" + n + ".gif";
		img.obj.src = newsrc;
	}
	img = null;
}

agent = navigator.appName;
if (agent == "Microsoft Internet Explorer")
{
	ie=true; nn=false;
}
if (agent == "Netscape")
{
	ie=false; nn=true;
};
function getObj(name)
{
  if (document.getElementById)
  {
//	alert (document.images[name]);
//	alert (document.getElementById(name));
  	this.obj = document.getElementById(name);
	if (!this.obj) return null;
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	if (!this.obj) return null;
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	if (!this.obj) return null;
	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	if (obj.document)
	{
		var y = obj.document.images;
	}
	else
	{
		var y = obj.images;
	};
	var thereturn;
	var ss="";
	for (var i=0;i<y.length;i++)
	{
		if (y[i].name)
		{
			ss=ss+y[i].name+" , ";
			if (y[i].name == name)
			{
				return y[i];
			}; //if (y[i].name == name)
		};// if (y[i].name)
	}; // for i
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		{
		 	thereturn = x[i];
			return thereturn;
		}
		else
		{
			if (x[i].layers.length||x[i].document.images.length)
			{
				var tmp = getObjNN4(x[i],name);
			};
			if (tmp) thereturn = tmp;
		};
	};
	return thereturn;
};

function showDiv(which, x,y) {
		//alert(which);
		divobj= new getObj(which);
		if (x>=0){
			if (divobj.obj.left) {divobj.obj.left=x}
			if (divobj.style.pixelLeft) {divobj.style.pixelLeft=x}
			if (divobj.obj.top) {divobj.obj.top=y}
			if (divobj.style.pixelTop) {divobj.style.pixelTop=y}
			if (bw.ns5){
				divobj.style.left = x + 'px';
				divobj.style.top = y + 'px';
			};
		};
//		for (i=0; divobj.style.left!=x + 'px' || divobj.style.top!=y + 'px';i++);
//		alert(i);
//		window.setTimeout("divobj.style.visibility='visible';", 50);
		divobj.style.visibility='visible';
		divobj=null;
//        if (nn) document.layers[which].visibility = "show";
//        if (ie) document.all[which].style.visibility = "visible";
}

function hideDiv(which) {
//        alert(which);
		divobj= new getObj(which);
		divobj.style.visibility='hidden';
		divobj=null;
//        if (nn) document.layers[which].visibility = "hide";
//        if (ie) document.all[which].style.visibility = "hidden";
}

function FW_clearTimeout()
{
	if (fwHideMenuTimer) clearTimeout(fwHideMenuTimer);
	fwHideMenuTimer = null;
	fwDHFlag = false;
}
function FW_startTimeout(execS)
{
	fwStart = new Date();
	fwDHFlag = true;
	fwHideMenuTimer = setTimeout(execS, 500);
}

function fwDoHide()
{
	if (!fwDHFlag) return;
	var elapsed = new Date() - fwStart;
	if (elapsed < 500) {
		fwHideMenuTimer = setTimeout("fwDoHide()", 600-elapsed);
		return;
	}
	fwDHFlag = false;
	HideAllLayers();
	MM_swapImgRestore();
}

function over(n,anchor_name,dx,dy) {
	var x,y,dx,dy;
	if (!dx) dx=0;
	if (!dy) dy=0;
	if (bw.ns5) dy=0;
	//HideAllLayers();
	anchor_obj= new getObj(anchor_name);
//	debugger;
	if (bw.ns4) {
		x=anchor_obj.obj.pageX+dx;
		y=anchor_obj.obj.pageY+dy;
	};
	if (bw.ie5p||bw.ie5||bw.dom) {
		x=getOffsetLeft(anchor_obj.obj)+dx;
		y=getOffsetTop(anchor_obj.obj)+dy;
	}
//	alert('x: '+x+', y: '+y);
//	y=0;
	showDiv(n,x,y);
}

function out(n) {
	  hideDiv(n)
}
function HideAllLayers()
{
  FW_clearTimeout();
  hideDiv('m_1');
  hideDiv('m_2');
  
  restoreIMG('b1');
  restoreIMG('b4');
//  hideDiv('m_7');
//  hideDiv('m_8');
//  hideDiv('m_4');
//  hideDiv('m_5');
//  hideDiv('m_6');
//  hideDiv('m_7');
}




function windowOpener(fileName, w, h, l, t){
	msgWindow=window.open(fileName,"winName","width="+w+",height="+h+",left="+l+",top="+t+",toolbar=0,directories=0,menubar=0,resizable=0,location=0,scrollbars=0,copyhistory=0");
}
