// check browser version
var myWidth = 0; 
var myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
  	//Non-IE
 	myWidth = window.innerWidth;
  	myHeight = window.innerHeight;
	} 
else {
  	if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    	//IE 6+ in 'standards compliant mode'
    	myWidth = document.documentElement.clientWidth;
    	myHeight = document.documentElement.clientHeight;
  	} 
	else {
    	if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      	//IE 4 compatible
      	myWidth = document.body.clientWidth;
      	myHeight = document.body.clientHeight;
    		}
  		}
	}


var menuXpos = (myWidth/2);
//var menuXpos = 0;
//alert(menuXpos)
//ar menuYpos = (myHeight/2-190);
  
NS4 = (document.layers) ? 1 : 0;

//// Don't change these parameters
var delay  = 500; /////
var active_layer_id = -1;  /////
var on_layer_id  = -1;  /////
var buff_id  = -1;  /////
/// ----------------------------

function layer_enter (id)

{

	on_layer_id = id;

}

function layer_exit (id)

{

	on_layer_id = - 1;

	setTimeout ('hide('+ id +')', delay/5);

}

function menu_enter (id,posDiff)

{

	if (buff_id >= 0)

		hide (buff_id);



	show (id,posDiff);

	active_layer_id = id;

}

function menu_exit (id)

{

	setTimeout ('hide('+ id +')', delay);

	buff_id = active_layer_id;

	active_layer_id = -1;

}

function show (id,posDiff)

{
	if (!NS4){		
		document.all['Menu' + id].style.visibility = "visible";
		//Right aligning menus so dont need to work out middle any more!
		if (window.innerWidth) {
			middle = (window.innerWidth/2)-382
		}
		
		if (document.body.clientWidth) {
			middle = (document.body.clientWidth/2)-382
		}
	//	middle = 0;
		
		document.getElementById('Menu'+id).style.left = (middle+posDiff);
		document.getElementById('Menu'+id).posLeft = posDiff;
		document.getElementById('Menu'+id).style.visibility = "visible";
		}
	else{document.layers[id].visibility = "visible";}
}

function hide (id)

{

	if (active_layer_id != id && on_layer_id != id)

	{

		if (!NS4)

			//document.all['Menu' + id].style.visibility = "hidden";
			document.getElementById('Menu' + id).style.visibility = "hidden";

		else

			document.layers[id].visibility = "hide";

	}

}

function parseForHyphen(strTitle) {
	if (!document.all) {
		if (strTitle.indexOf('-') != -1) {
			strTitle = strTitle.substring(0,(strTitle.indexOf('-')+1))+"<br/>"+strTitle.substring((strTitle.indexOf('-')+1),(strTitle.length-1));
			document.write(strTitle);
		} else {
			document.write(strTitle);
		}
	} else {
		document.write(strTitle);
	}
}

function returnRelLeft(divid) {
		//alert(document.getElementById(divid).offsetLeft);
		return document.getElementById(divid).offsetLeft;
}