var pageType="home";
var menuActive=new Image();
menuActive.src="images/"+pageType+"/nav_filler.gif";
var menuInactive=new Image();
menuInactive.src="images/blank.gif";
var visible = (ns4 ? "show":"visible")

function init() {
	divObjectInit() ;
	menuInit();
	

}

function menuInit() {  // makes dropdown menus transparent for IE
	if (ie)
		{
		var i=1;
		while (eval("typeof topmenu"+i+"=='object'")){
			eval('topmenu'+i+'.css.filter="alpha(opacity=95)"');
			i++;
		}
	}
	if(!isMac) document.onmousemove=getMouseX;
	else document.onmouseover = getMouseX;
	if(ns)document.captureEvents(Event.MOUSEMOVE)
}


var curX;
var topNavElm;

function getMouseX(e){
	curX=parseInt(ns ? e.pageX : event.clientX);
	if(topNavElm){
		var i=1;
		while (eval("typeof topmenu"+i+"=='object'")){
			var curObj=eval("topmenu"+i);
			if(curObj.css.visibility==visible){
				if(!isMac) curObj.easeTo(curX-25,null,1,30);
				else curObj.moveTo(curX-25,null,1,30);
			}
			i++;
		}
	}
}

function hideDetector() {
	upperdetector.hide();
	lowerdetector.hide();
	var i=1;
	while ((eval("typeof topmenu"+i+"=='object'"))&&('topmenu'+i+'.css.visibility=="'+visible+'"')){
		eval("topmenu"+i+".fadeOut()");
		i++;
	}
}

divObject.prototype.fadeOut=divObjectFade;

function divObjectFade(){
	if(ie5&&!isMac){
		this.css.filter='blendTrans(duration=0.2)';
		this.ref.filters.blendTrans.apply();
		this.hide();
		this.ref.filters.blendTrans.play();
	}
	else this.hide();
}

function showDropdown(navNo){
	var i=1;
	while (eval("typeof topmenu"+i+"=='object'")){
		var curObj=eval("topmenu"+i)
		if(i==navNo){
			curObj.css.zIndex=6;
			if(ie) curObj.css.filter[0] = "alpha(opacity=90)";
			curObj.inherit();
			if(ns4 && typeof(textarea)=='object' ) {textarea.hide();textarea.moveTo(-1000,0)}
		}
		else {
			curObj.css.zIndex=5;
			curObj.fadeOut();
			
		}
		i++;
	}
	
	if (!ie4)
		{
			if (eval("typeof topmenu"+navNo+"=='object'")&&curX){
				eval('topmenu'+navNo+'.moveTo(curX-25,null,1,10)');
			}
		}
	
	if(typeof upperdetector=='object'){
		upperdetector.inherit();
	}
	
	if(typeof lowerdetector=='object'){
		lowerdetector.inherit();
	}
	
	//changeBackground(navNo);	// this line fixes the scrollbar position on mac IE5
	
}

function moveDropdown(navNo,e){
	eval('topmenu'+navNo+'.easeTo(curX-20,null,1,50)');
}

function changeBackground(navNo) {
	if (ie){
		var i=1;
		while(typeof document.images["navcolour" + navNo + i]=="object"){
		 	document.images["navcolour" + navNo + i].src = menuActive.src;
			i++;
		}
	}
	topNavElm=navNo;
}

function undoBackground(navNo) {
	if (ie){
		var i=1;
		while(typeof document.images["navcolour" + navNo + i]=="object"){
		 	document.images["navcolour" + navNo + i].src = menuInactive.src;
			i++;
		}
	}
	topNavElm=false;
}
//----------------------------------------------------------------------------------------------
function colourOn(whichcell) {
	if (ie)
	{
		whichcell.className='tableOn'
	}
}
//----------------------------------------------------------------------------------------------
function colourOff(whichcell) {
	if (ie)
		{
			whichcell.className='tableOff'
		}
}
	