var NS5 = document.layers;
var IE = document.all;
var NS6 = document.getElementById
var IntervalID = -1;
var gCurLayer = "lay02";
var timer = 100;
var imgNameGlobal = 'dummy';
var imgSrcGlobal = '../images/global/pixel.gif';
var gTurnOff = false;

function Menu(name,imgName,rollImg,upImg) {	
	if (NS5) {				
		document.layers[name].onmouseover = openMenu;
		document.layers[name].onmouseout = closeMenu;
	}
	else if (IE) {
		document.all[name].onmouseover = openMenu;				
		document.all[name].onmouseout = closeMenu;				
	}
	else if (document.getElementById) {  //NS6		
		document.getElementById(name).onmouseover = openMenu;
		document.getElementById(name).onmouseout = closeMenu;
	}

}
function openMenu() {				
	gTurnOff = true;
	clearTimeout(IntervalID)		
	if (IE) document.all[this.id].style.visibility = "visible";
	else if (NS5) document.layers[this.id].visibility = "visible";			
	else if (NS6) document.getElementById(this.id).style.visibility = "visible";							
}
function closeMenu(e) {	
	if (gTurnOff) turnOffMenu(this.id);						
	gTurnOff = false;
}

function openMenuRoll(lyr,iname,isrc) {		
	gTurnOff = true;
	//first make sure previous image is restored:
	//if (document.images[imgNameGlobal]) document.images[imgNameGlobal].src = imgSrcGlobal;
	//imgNameGlobal = iname;	
	//imgSrcGlobal = isrc;	
	
	if (IE && (gCurLayer != lyr) && (document.all[gCurLayer].style.visibility == "visible"))
		turnAllOff();
	else if (NS5 && (gCurLayer != lyr) && (document.layers[gCurLayer].visibility == "show")) {		
		turnAllOff();									
	}
	else if (document.getElementById) {
		if (!NS5 && ((gCurLayer != lyr) && (document.getElementById(gCurLayer).style.visibility == "visible")))	
		turnAllOff();					
	}
	
	clearTimeout(IntervalID)		

	if (IE) {
		document.all[lyr].style.visibility = "visible";		
	}
	else if (NS5) {
		document.layers[lyr].visibility = "visible";				
	}
	else if (NS6) { 
		document.getElementById(lyr).style.visibility = "visible";						
	}	
}
function closeMenuRoll(lyr) {		
	if (IE) {
		document.all[lyr].style.visibility = "hidden";	
	}
	else if (NS5) {
		document.layers[lyr].visibility = "hidden";					
	}
	else if (NS6) {
		document.getElementById(lyr).style.visibility = "hidden";			
	}	
	gTurnOff = false;
}

function turnAllOff() {	
	closeMenuRoll(gCurLayer);			
	//document.images[imgNameGlobal].src = imgSrcGlobal;		
}

function turnOffMenu(lyr) {		
	gCurLayer = lyr;			
	IntervalID = setTimeout("turnAllOff()",timer);				
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function rollimg(mname,imgname,imgsrc) { //v3.0
  if (IE) {
   document.images[imgname].src = "../images/global/" + imgsrc;
  }
  else if (NS5) {
   document.layers[mname].document.images[imgname].src = "../images/global/" + imgsrc;
  }
  else if (NS6) {
   document.getElementById(mname).document.images[imgname].src = "../images/global/" + imgsrc;
  }
}




////footer---------------

function moveFooter() {
	var iBottom = 0;
	
	if (document.all) {
		if (parseInt(document.body.scrollHeight) > parseInt(document.body.clientHeight)) {
			iBottom = parseInt(document.body.scrollHeight);
		}	
		else iBottom = parseInt(document.body.clientHeight);
		document.all["lyfooter"].style.pixelTop = iBottom - parseInt(document.all["lyfooter"].style.height);
		document.all["lyfooter"].style.visibility = "visible";
	}
	else if (document.layers)	{
		if (document.height > self.innerHeight) {
			iBottom = document.height;
		}	
		else iBottom = self.innerHeight;				
		document.layers["lyfooter"].top = parseInt(iBottom - document.layers["lyfooter"].document.height);
		document.layers["lyfooter"].visibility = "visible";				
	}
	else if (document.getElementById) { //NS6
		if (document.height > self.innerHeight) {
			iBottom = document.height;
		}	
		else iBottom = self.innerHeight;					
		document.getElementById("lyfooter").style.top = (parseInt(iBottom - parseInt(document.getElementById("lyfooter").style.height))) + "px";		
		document.getElementById("lyfooter").style.visibility = "visible";		
		
	}
	
}



/* open new window function*/

var win1;
function closeme(){
        if (win1!=null) win1.close();
}

function openWin(file,w,h) {
        //change any parameter to 1 if you want it displayed
        //for IE3.0 some of the parametrs have to be deleted - need to be tested
          //if(win1 == null)
        win1 = open(file,"pt","status=yes,scrollbars=1,location=0,menubar=0,resizable=0,toolbar=0,top=0,left=0,width="+w+",height="+h);
        
        win1.focus();

}