

var agt=navigator.userAgent.toLowerCase(); 
var is_major=parseInt(navigator.appVersion); 
var is_minor=parseFloat(navigator.appVersion); 
var is_nav =((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1)); 
var is_nav2=(is_nav && (is_major == 2)); 
var is_nav3=(is_nav && (is_major == 3)); 
var is_nav4=(is_nav && (is_major == 4)); 
var is_nav5=(is_nav && (is_major == 5)); 
var is_nav5up=(is_nav && (is_major >= 5)); 
var is_nav4down=(is_nav && (!is_nav5up)); 
var is_ie  =(agt.indexOf("msie") != -1); 
var is_ie3 =(is_ie && (is_major < 4)); 
var is_ie4 =(is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) ); 
var is_ie4up =(is_ie  && (is_major >= 4)); 
var is_ie4down =(is_ie  && (is_major <= 4)); 
var is_ie5 =(is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) ); 
var is_ie5up =(is_ie  && !is_ie3 && !is_ie4); 
var is_5up=(is_ie5up || is_nav5up);
var is_hotjava=(agt.indexOf("hotjava")!=-1);
var is_opera=(agt.indexOf("opera") != -1); 
var is_webtv=(agt.indexOf("webtv") != -1); 
var is_win  =( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_mac   =(agt.indexOf("mac")!=-1);
var vIE55Win=navigator.appVersion.toLowerCase().indexOf("msie 5.5")!=-1 && is_win;
var vIE4Win=is_ie4 && is_win;
var vIE4Mac=is_ie4 && is_mac;
var vFurns=new Array();
var vBanners=new Array();
var vPreloadedImages=new Array();
var vIndexOff=20,vIndexOn=60;
var gToolIndexOff=20,gToolIndexOn=300; 
var vMaskDif=10,vLabelDif=5;
var vMask,vTooltips; 
var vInterval=null; 
var vTooltipTimer=null; 
var vItemNo=0; 
var vMenuPad=10; 
var vOnImageDelay=150; 
var vOnImageTimer=null; 
var vMenuDelay=150; 
var vMenuTimer=null; 
var vMenuObj=null;
var vMenuCloseObj=null;
var vMenuCloseTimer=null;

function mMenu(menuText,top,left,subject,parent,url,imagemap, highLight, lowLight){
this.dKids=new Array();
this.dName="item" + vItemNo++ ; 
this.dState=0; 
this.dOpen=false; 
this.dSubject=(subject)?subject:""; 
this.dURL=(url)?url:""; 
this.dMap=(imagemap)?imagemap:""; 
this.dPosAbs=(top == 0 && left == 0)?false:true;
this.dKidsMaxWidth=0; 
this.dAutoHilite=true; 
this.dTop=top;
this.dLeft=left;
this.dWidth=vMenuWidth;
this.dHeight=vMenuHeight;
this.dMenuText=menuText;
this.dHi=highLight;
this.dLo=lowLight;
this.dKidPlaced=false;

if(parent){// if it has a parent refernce it is assigned that parents color scheme
	parent.mAddKid(this);
	// if no child colour scheme then use parents	
		if(!this.dLo){
		this.dHi=parent.dHi;
		this.dLo=parent.dLo;
		}
	}
	
else{ // parents are assigned a main colour scheme
	vFurns[vFurns.length]=this;
	this.dHi=vOnColour;
	this.dLo=vOffColour;
}
}
function mWriteStyleText(inDoc){
var tClip="clip: rect(0," + this.dWidth + "," + this.dHeight  + ",0); ";
var tStyle  ="#" + this.dName + "Div{position:absolute;top:" + this.dTop +
		   ";left:" + this.dLeft + ";width:auto;height:" + this.dHeight +
		   "; visibility: hidden; overflow:visible; z-index:" + ((this.dParent)?vIndexOn:vIndexOff) + "; " +
		   ((vIE4Mac)?" ":tClip) + vMenuItemTextStyle + " } ";
var tImageStyle="";
if(this.dImage){
	if(vIE4Mac){
		tStyle=" #" + this.dName + "Div{position:absolute;width:" + this.dWidth + ";height:" +
			 this.dHeight + ";top:" + this.dTop + ";left:" + this.dLeft  +
			 "; visibility: hidden; clip: rect(0," + this.dWidth + "," + this.dHeight  +
			 ",0);font-size:12px;font-family:geneva,verdana,arial,sais_nav4-serif;z-index:" + 
			 ((this.dParent)?vIndexOn:vIndexOff) + "; } ";
		tImageStyle=" #" + this.dName + "Image{ position:absolute; top:0px; left:0px; height:" +
				  this.dHeight + "px; width:" + this.dWidth + "px; } ";
	}
	else{
		tImageStyle=" #" + this.dName + "Image{ position:absolute; top:0px; left:0px; height:" +
				  (this.dHeight + this.dScrollOffset ) + "px; width:" + this.dWidth + "px; } ";
	}
}
inDoc.write(tStyle + tImageStyle);
for(var i=0;i < this.dKids.length;i++ ){
	inText=this.dKids[i].mWriteStyleText(inDoc);
}
}
function mWriteDivText(inDoc){

var tDivs="<div id=\"" + this.dName + "Div\">";
if(this.dMenuText != ""){
	if (is_nav4down) {
		tDivs += "&nbsp;" + this.dMenuText;
	} else {
		var tHref="javascript:fGetTarget('"+this.dName+"').mMouseUp();"; 
		var t1="onmouseover=\"fGetTarget('"+this.dName+"').mMouseOver();\"";
		var t2="onmouseout=\"fGetTarget('"+this.dName+"').mMouseOut();\"";
		tDivs +=	"&nbsp;<A href=\""+tHref+"\" id=\"" +  this.dName + "A\" "+ t1 + " " + t2 + " style=\"text-decoration:none; font-size:10px; line-height:14px; font-family:geneva,verdana,arial,sans-serif; color:black;\">&nbsp;" + this.dMenuText +"<\/A>"
	}
}
else if(this.dBannerImages){
	if (is_nav4down) {
		var tHref="javascript:fGetTarget('"+this.dName+"').mMouseUp()"; 
		tDivs += "<A href=\""+tHref+"\"><img name='" + this.dName + "BannerImg' id='" + this.dName + "BannerImg' src='" + this.dBannerImages[0].dPath + "' border=0><\/A>"; 
	} else {
		tDivs += "<img name='" + this.dName + "BannerImg' id='" + this.dName + "BannerImg' src='" + this.dBannerImages[0].dPath + "' border=0>";
	}
}
else if(this.dImage){
	if (is_nav4down) {
		var tMap=(this.dMap)?" usemap='#"+this.dMap+"'":"";
		var tHref=(this.dURL=="")?"#":"javascript:fGetTarget('"+this.dName+"').mMouseUp()"; 
		tDivs += "<div id=\"" + this.dName + "Image\"><A href=\""+tHref+"\"><img name='"+ this.dName +"RollImage' id='"+ this.dName +"RollImage' src='" + this.dImage + "'"+tMap+" border=0><\/A><\/div>";
	} else {
		var tMap=(this.dMap)?" usemap='#"+this.dMap+"'":"";
		tDivs += "<div id=\"" + this.dName + "Image\"><img name='"+ this.dName +"RollImage' id='"+ this.dName +"RollImage' src='" + this.dImage + "'"+tMap+" border=0><\/div>"; 
	}
}



tDivs += "<\/div>";
inDoc.write(tDivs);
for(var i=0;i < this.dKids.length;i++ ){
	this.dKids[i].mWriteDivText(inDoc);
}
}
function mWriteDivContent()
{
var tHref=(this.dKids.length>0)?"#":"javascript:fGetTarget('"+this.dName+"').mMouseUp()"; 
	var tDoc =eval("document." + this.dName + "Div.document");
	tDoc.open();
	tDoc.write("<table width=\"" + this.dWidth + "<table width=\"" + this.dWidth + "\" border=\"0\" CELLSPACING=\"0px\"><tr><td border=0 class=\"menuTD\" valign=\"middle\"><A href=\""+tHref+"\" style=\"text-decoration:none; font-size:10px; line-height:14px; font-family:geneva,verdana,arial,sans-serif; color:black;\">&nbsp;" + this.dMenuText + "<\/A><\/td><\/tr><\/table>");
	tDoc.close();
}
function mGetDivText(inText){
var tDivs="<div id=\"" + this.dName + "Div\">";

//additional arrow
this.dArrow ="";
if(!this.dImage){
var thisAlign;
var tHref="javascript:fGetTarget('"+this.dName+"').mMouseUp();"; 
var t1="onmouseover=\"fGetTarget('"+this.dName+"').mMouseOver();\"";
var t2="onmouseout=\"fGetTarget('"+this.dName+"').mMouseOut();\"";
	if (is_mac){thisAlign = " align='right' ";}
	if (this.dKids.length > 0){this.dArrow = "<a href='"+ tHref +"' "+ t1  +" "+ t2 +" style=\"text-decoration:none; font-size:13px; line-height:14px; font-family:webdings;text-align:right; color:white;\" >&#32;&#052;</a>";}
	else{this.dArrow ="";}
}

if(this.dMenuText != ""){
	if(vIE4Win){
		tDivs += "<TABLE id='"+this.dName+"Table' border=0 cellspacing=0 cellpadding=0  width="+this.dParent.dKidsMaxWidth+"><TR><TD class='cMIText' nowrap><P id='"+this.dName+"P'>&nbsp;" + this.dMenuText + this.dArrow +"<\/P><\/TD><\/TR><\/TABLE>";
	} 
	//mac
	else{		tDivs += "&nbsp;" + this.dMenuText + this.dArrow;	}
}
else if(this.dBannerImages){
	tDivs += "<img name='" + this.dName + "BannerImg' id='" + this.dName + "BannerImg' src='" + this.dBannerImages[0].dPath + "' border=0>";
}
else if(this.dImage){
	var tMap=(this.dMap)?" usemap='#"+this.dMap+"'":"";
	tDivs += "<div id=\"" + this.dName + "Image\"><img name='"+ this.dName +"RollImage' id='"+ this.dName +"RollImage' src='" + this.dImage + "'"+tMap+" border=0 alt=''><\/div>"; 
}



tDivs += "<\/div>";
inText  += tDivs;
for(var i=0;i < this.dKids.length;i++ ){
	inText=this.dKids[i].mGetDivText(inText);
}
return inText;
}
function mInstallHandler(inVisible){
if(!this.dMap){
	var tTarget;
	if(is_nav4){
		eval("tTarget=document." + this.dName + "Div");
		this.dCss=tTarget;
		if(this.dImage){
			eval("this.dImageCss=this.dCss.document." + this.dName + "Image"); 
			eval("this.dRollImageCss=this.dImageCss.document.images['" + this.dName + "RollImage']");
			this.dImageCss.document.onmouseup= fHandleUp;		
			this.dImageCss.document.dJSObj=this;		
			this.dRollImageCss.onmouseup= fHandleUp;
			this.dRollImageCss.dJSObj=this;
		}
		else if(this.dBannerImages){
			eval("this.dBannerDoc=this.dCss.document.images['" + this.dName + "BannerImg']");
			this.dBannerDoc.onmouseup= fHandleUp;
			this.dBannerDoc.dJSObj=this;
			this.dCss.document.onmouseup= fHandleUp;
			this.dCss.document.dJSObj=this;
		}
		else{
			tTarget.document.onmouseup= fHandleUp;
			tTarget.document.captureEvents(Event.MOUSEUP);						
			tTarget.document.dJSObj=this;
		}
	}
	else{
		tTarget=(is_ie4)?document.all[this.dName + "Div"] : document.getElementById(this.dName + "Div"); 
		this.dCss=tTarget.style;
		if(this.dImage){
			this.dImageCss=(is_ie4)?document.all[this.dName + "Image"].style : document.getElementById(this.dName + "Image").style; 
			this.dRollImageCss=(is_ie4)?document.all[this.dName + "RollImage"] : document.getElementById(this.dName + "RollImage");
			tTarget=this.dRollImageCss;
		}
		else if(this.dBannerImages){
			this.dBannerDoc=(is_ie4)?document.all[this.dName + "BannerImg"] : document.getElementById(this.dName + "BannerImg");
			tTarget=this.dBannerDoc;
		}
		else if(vIE4Win){
			var tTarget2=document.all[this.dName + "P"];
			tTarget2.dJSObj=this;
			tTarget2.onmouseover= fHandleOver;
			tTarget2.onmouseup= fHandleUp;
		}
	}
	if (is_nav5) {
		tTarget.dJSObj=this;
		tTarget.addEventListener("mouseover",fHandleOver,false);
		tTarget.addEventListener("mouseout",fHandleOut,false);
		tTarget.addEventListener("mouseup",fHandleUp,false);
		var tTarget2=document.getElementById(this.dName + "A");
	 if (tTarget2 != null ){
			tTarget2.dJSObj=this;
			tTarget2.addEventListener("mouseover",fHandleOver,false);
			tTarget2.addEventListener("mouseout",fHandleOut,false);
			tTarget2.addEventListener("mouseup",fHandleUp,false); 
		}
	}	else {
		tTarget.dJSObj=this;
		tTarget.onmouseover= fHandleOver;
		tTarget.onmouseout= fHandleOut;
		tTarget.onmouseup= fHandleUp;
	}
} 
else {
	if(is_nav4){ 
		eval("tTarget=document." + this.dName + "Div");
		this.dCss=tTarget;
	}
	else{		this.dCss=(is_ie4)?document.all[this.dName + "Div"].style : document.getElementById(this.dName + "Div").style;	}
}	
for(var i=0;i < this.dKids.length;i++ ){
	this.dKids[i].mInstallHandler();
}
var tCurrWidth=this.dWidth;
if(this.dAutoHilite){
	this.mToggleHilite(this.dLo);
	if(is_nav4) {
		eval("tCurrWidth=document." + this.dName + "Div.document.width");
	} else {
		if(vIE4Win)		tCurrWidth=document.all[this.dName + "Table"].offsetWidth;
		else	tCurrWidth=(is_ie4)?document.all[this.dName + "Div"].offsetWidth :  document.getElementById(this.dName + "Div").offsetWidth;
	}
}
if(this.dParent){
	this.dParent.dKidsMaxWidth=Math.max(this.dParent.dKidsMaxWidth,tCurrWidth);
}
else{
	this.mSetVisible(true);
	return tCurrWidth;
}
}
function mPreloadImages(){
if(this.dBannerImages){
	for (var i=0;i < this.dBannerImages.length;i++ ) {
		fPreloadImage(this.dBannerImages[i].dPath);
	}
}
else if(this.dRolloverImage){	fPreloadImage(this.dRolloverImage);	}
for(var i=0;i < this.dKids.length;i++ ){
	this.dKids[i].mPreloadImages();
}
}

function mAddKid(inKid){
inKid.dParent=this;
if(inKid.dPosAbs){
	inKid.dTop=this.dTop + (this.dKids.length * vMenuHeight);
	inKid.dLeft=this.dLeft + this.dWidth;
}
this.dKids[this.dKids.length]=inKid;
} 

function mSetVisible(inVis){
fShowDiv(this.dCss,inVis);
}

function mSetZorder(inIndex){
this.dCss.zIndex=inIndex;
}

function mMoveTo(x,y){
this.dLeft=x;
this.dTop=y;
fMoveDiv(this.dCss,x,y);
}

function mSizeTo(inWidth,inHeight){
if(this.dImage) { return; } 
this.dWidth=inWidth;
this.dHeight=inHeight;
fSizeDiv(this.dCss,inWidth,inHeight);
fClipDiv(this.dCss,0,inWidth,inHeight,0);
if(is_nav4down)
	this.mWriteDivContent();
else if(vIE4Win)  
	fSizeDiv(document.all[this.dName+"Table"],inWidth,inHeight,true);
}

// This section needs to modded for it to work differently
function mOpenKids(){

if(gMenuType =="rows"){// this will be the autonomy style menu
var a = 0;// a filler variable to make the kids fill the line

if(this.dKids.length>0){
	if(!this.dParent) {var y=this.dTop + this.dHeight;}
		else {var y=this.dTop + vMenuHeight;}
	
	// if its not a parent it opens next it
	if(!this.dParent) {var x=0}
		else {var x=0}
	
	
	if((this.dParent) && (this.dKids.length>0))
		x--;
	for(var i=0;i < this.dKids.length;i++ ){// we run through the array of this object children
		if(this.dKidPlaced == false){
			this.dKids[i].mMoveTo(x,y);
			
			//var tBot=(i==this.dKids.length-1)?3:0; // only for use in drop down version (adds a bit on the boot of the last child)
			var tBot= 0;
			
			// if its the last one in the array we size it to fill the block
			if(this.dKids.length-1 == i){
			if(x < 550){a = 550 - x;}
			}
			
			this.dKids[i].mSizeTo(this.dKidsMaxWidth+vMenuPad+a,this.dKids[i].dHeight+tBot);
			
			
		// if the length gets longer than the screen we move downwards
			if(x > 500){
			y  += this.dKids[i].dHeight; // the y value is incleased by the height (it moves down)
			y--;
			x = 0;// we set x to zero so that it starts at the beginning of the screen
			}
			else {x  += this.dKids[i].dWidth;}
			
			if(this.dKids[i].dAutoHilite){
				if(!is_nav4){
					this.dKids[i].dCss.border=vMenuItemBorderStyle;
				}
			}
		}
		this.dKids[i].mSetVisible(true);
	}
	this.dKidPlaced=true;
	}

}


if(gMenuType =="drop"){// this will be the dropDown style menu

if(this.dKids.length>0){
	if(!this.dParent) {var y=this.dTop + 20;}
		else {var y=this.dTop;}
	
	
	//if(this.dTop + (this.dKids.length * vMenuHeight) > vWinHeight){
	//	y=this.dTop - ((this.dTop + (this.dKids.length * vMenuHeight))-vWinHeight);
	//}
	
	
	// if its not a parent it opens next it
	if(!this.dParent) {var x=this.dLeft}
		else {var x=this.dLeft + this.dWidth;}
	
	
	if((this.dParent) && (this.dKids.length>0))
		x--;
	for(var i=0;i < this.dKids.length;i++ ){
		if(this.dKidPlaced == false){
			this.dKids[i].mMoveTo(x,y);
			var tBot=(i==this.dKids.length-1)?3:0;
			this.dKids[i].mSizeTo(this.dKidsMaxWidth+vMenuPad,this.dKids[i].dHeight+tBot);
			y  += this.dKids[i].dHeight;
			y--;
			if(this.dKids[i].dAutoHilite){
				if(!is_nav4){
					this.dKids[i].dCss.border=vMenuItemBorderStyle;
				}
			}
		}
		this.dKids[i].mSetVisible(true);
	}
	this.dKidPlaced=true;
}


}

}

function mCloseKids(){
if(this.dParent){
	this.dParent.dKidOpen=null;
}
for(var i=0;i < this.dKids.length;i++ ){
	this.dKids[i].mCloseKids();
	this.dKids[i].mSetVisible(false);
}

if(this.dImage){
	if(this.dState != 0){
		if(this.dRolloverImage){
			this.dRollImageCss.src=this.dImage;
		}
		else{
			this.dImageCss.top=0;
		}
	}
	this.dState=0;
}
if(this.dAutoHilite){
	this.mToggleHilite(this.dLo);
}
this.dOpen=false;
}


function mToggleHilite(inColor){
if(is_nav4){
	this.dCss.bgColor=inColor;
}
else{
	this.dCss.backgroundColor=inColor;
}
}


function mSetBannerImages(inImages,inListen,inWidth,inHeight){
this.dBannerImages=inImages;
this.dListen=inListen;
this.dCurrBanner=0;
this.dAutoHilite=false;
this.dWidth=inWidth;
this.dHeight=inHeight;
this.mToggleBanner("on");
vBanners[vBanners.length]=this;
}
function mToggleBanner(inState){
this.dBannerState=inState;
}
function mShowBanner(inIndex){
this.dCurrBanner=inIndex;
this.dBannerDoc.src=this.dBannerImages[inIndex].dPath;
}
function mCycleBanner(inSubject){
if(this.dBannerState == "on"){
	if(inSubject){
		if (this.dListen == true && inSubject != ""){
			for (var i=0;i<this.dBannerImages.length;i++ ) {
				if(this.dBannerImages[i].dSubject == inSubject) {
					this.mShowBanner(i);
					this.mToggleBanner("off");
					break;
				}
			}
		}
	}
	else{
		var i=this.dCurrBanner   + 1;
		if(i >= this.dBannerImages.length){ i=0; }
		this.mShowBanner(i);
	}
}
}


function mSetImage(inImage,inWidth,inHeight,inRollOverOffset){
this.dImage=inImage;
this.dScrollOffset=(inRollOverOffset)?inRollOverOffset:0;
this.dAutoHilite=false;
this.dWidth=inWidth;
this.dHeight=inHeight;
}


function mSetRolloverImage(inRolloverImage){
this.dRolloverImage=inRolloverImage;
}


function mSetTooltip(inText){
this.dTooltip=inText;
}


function mSetHiLoColor(inHi,inLo){
this.dHi=inHi;
this.dLo=inLo;
}


function mMouseOut(){
if(gIsMenuLoaded==true){
	clearTimeout(vOnImageTimer); 
	clearTimeout(vMenuTimer);
	
	vMenuObj=null; 
	for (var i=0;i<vBanners.length;i++ ) {
		vBanners[i].mToggleBanner("on");
	}
	if((this.dAutoHilite) && (!this.dOpen)) {
		this.mToggleHilite(this.dLo);
	}
	fTooltip();
}

		window.status= "Powered by e-CHO @ GateWest New Media -- http://www.gatewest.co.uk -- "; return true;
return false; 
}


function mMouseUp(){
if(gIsMenuLoaded==true){
	var tURL=(this.dBannerImages)?this.dBannerImages[this.dCurrBanner].dURL : this.dURL;
	if(tURL != "") {
		
		var tIE4MacMenuPopup=((vIE4Mac) && (this.dMenuText!=""));
		tURL=fURL(tURL,tIE4MacMenuPopup);
		if(tURL.indexOf("fOpenWin")!=-1){
			fCloseAll(); 
			fTooltip(); 
		}
		if(is_ie ) this.dCss.cursor="default";
		location.href=tURL;
	}
}
return false; 
}
function mMouseOver(){
clearTimeout(vMenuCloseTimer); 
if(gIsMenuLoaded==true){
	if(!this.dParent){	
		fCloseAll();
	}
	if(!this.dParent){ 
		this.mSetZorder(vIndexOn);
	}
	else{
		
		if((this.dParent.dKidOpen)&&(this.dParent.dKidOpen!=this)){
			this.dParent.dKidOpen.mCloseKids();
		}
		this.dParent.dKidOpen=this;
		
	}
	if(this.dKidOpen){
		this.dKidOpen.mCloseKids();
	}
	if(this.dAutoHilite){
		this.mToggleHilite(this.dHi);

	}
	else if(this.dImage){
		vMenuObj=this;		
		vOnImageTimer=setTimeout("fOnImage()",vOnImageDelay);			
	}
	this.dOpen=true;
	if(this.dKids.length>0){
		if(vMenuObj!=this) vMenuObj=this;		
		vMenuTimer=setTimeout("fOpenMenu()",vMenuDelay);			
	}
	fShowDiv(vMask,true);
	if(this.dSubject && this.dSubject != ""){
		for (var i=0;i<vBanners.length;i++ ) {
			vBanners[i].mCycleBanner(this.dSubject);
		}
	}
	if(this.dBannerImages){
		this.mToggleBanner("off");
	}
	if(this.dTooltip){
		//fTooltip(this.dTooltip,this.dLeft + this.dWidth,this.dTop);
		fTooltip("<b>Page Summary:</b><BR>"+this.dTooltip,this.dLeft + 10,this.dTop+this.dHeight);
	}
	if(!is_nav4){	this.dCss.cursor="hand";	}
	if(is_nav5up){	this.dCss.cursor="pointer";	}
}

window.status= this.dMenuText; return true;
return false; 
}


mMenu.prototype.mWriteStyleText=mWriteStyleText;
mMenu.prototype.mWriteDivText=mWriteDivText;
mMenu.prototype.mWriteDivContent=mWriteDivContent;
mMenu.prototype.mGetDivText=mGetDivText;
mMenu.prototype.mInstallHandler=mInstallHandler;
mMenu.prototype.mPreloadImages=mPreloadImages;
mMenu.prototype.mAddKid=mAddKid;
mMenu.prototype.mSetVisible=mSetVisible;
mMenu.prototype.mSetZorder=mSetZorder;
mMenu.prototype.mOpenKids=mOpenKids;
mMenu.prototype.mCloseKids=mCloseKids;
mMenu.prototype.mMoveTo=mMoveTo;
mMenu.prototype.mSizeTo=mSizeTo;
mMenu.prototype.mToggleHilite=mToggleHilite;
mMenu.prototype.mToggleBanner=mToggleBanner;
mMenu.prototype.mShowBanner=mShowBanner;
mMenu.prototype.mCycleBanner=mCycleBanner;
mMenu.prototype.mSetTooltip=mSetTooltip;
mMenu.prototype.mSetBannerImages=mSetBannerImages;
mMenu.prototype.mSetImage=mSetImage;
mMenu.prototype.mSetRolloverImage=mSetRolloverImage;
mMenu.prototype.mSetHiLoColor=mSetHiLoColor;
mMenu.prototype.mMouseOver=mMouseOver;
mMenu.prototype.mMouseOut=mMouseOut;
mMenu.prototype.mMouseUp=mMouseUp;


function cBannerImage(inPath,inSubject,url){
	this.dPath=inPath;
	this.dSubject=inSubject;
	this.dURL=url;
}


function fCycle() {
for (var i=0;i<vBanners.length;i++ ) {
	vBanners[i].mCycleBanner();
}
}
function fGetTarget(inName){
var obj;
if (is_nav4) obj=eval("document."+inName+"Div.dJSObj");
if (is_ie4) obj=eval("document.all."+inName+"Div.dJSObj");
if (is_5up) obj=document.getElementById(inName+"Div").dJSObj;
return obj;
}
function fOpenMenu(){
vMenuObj.mOpenKids();
}
function fOnImage(){
if(vMenuObj.dState!= 1){
	if(vMenuObj.dRolloverImage){	vMenuObj.dRollImageCss.src=vMenuObj.dRolloverImage;}
	else{vMenuObj.dImageCss.top=-vMenuObj.dScrollOffset;	}
}
vMenuObj.dState=1;
}

function fURL(inParms,inIE4MacMenuPopup){
var tURL="";
var tOW=false;
var tParms=inParms.split(",");
for(var i=0;i<tParms.length;i++){
	switch(tParms[i].substring(0,2)){
		case "ab": 
			tURL += tParms[i].substring(3,tParms[i].length);
			break;
		case "ow": 
			if (!inIE4MacMenuPopup){
				tOW=true;
				tURL += "javascript:fOpenWin('";					
			}			
		break;
			
		case "02": // 2002 Press Releases
			tURL += "/cgi-bin/autonomy/echo/fetch.pl?element=2002+Archive&x=8&y=10&action=retrieve_two&type=patterns&binary=and&field=Link&sort_field=Date&menu=Press_Release_Archives&menulink=biiaArchive";
		break;
		
		case "03": 
			tURL += "javascript:window_open_plain('/toolkit/toolkit.html', 800, 480);";								
		break;
	
		}		
}
if(tOW) tURL += "');"; 
return tURL;
}

function fMenuOff(){
vMenuCloseTimer = setTimeout("fCloseAll()",100);
}

function fCloseAll(){
fShowDiv(vMask,false);
for(var i=0;i<vFurns.length;i++ ){
	vFurns[i].mCloseKids();
	vFurns[i].mSetZorder(vIndexOff);
}
return false;
}

function fHandleOut(e){
var tTarget;
if(is_nav){ tTarget=e.target.dJSObj; }
if(is_ie){
	e=window.event;
	tTarget=e.srcElement.dJSObj;
	e.cancelBubble=true;
	
	showme();
	}
if(tTarget){tTarget.mMouseOut();	}
return false;
}


function fHandleOver(e){
var tTarget;
if(is_nav){	tTarget=e.target.dJSObj;	}
if(is_ie){
	e=window.event;
	tTarget=e.srcElement.dJSObj;
	e.cancelBubble=true;
	
	hideme();
	}

if(tTarget){ tTarget.mMouseOver();	}
return false;
}

function fHandleUp(e){
var tTarget;
if(is_nav){tTarget=e.target.dJSObj;	}
if(is_ie){
	e=window.event;
	tTarget=e.srcElement.dJSObj;
e.cancelBubble=true;  
}

if(tTarget){ tTarget.mMouseUp();}
return false;
}
function fWriteStyles(){
var tStyleText="<STYLE TYPE=\"text/css\"> #MaskDiv {position:absolute;top:0;left:0;width:100;height:100;visibility:hidden;z-index:" + (vIndexOn - vMaskDif) + ";} ";
tStyleText  += "#ToolTipDiv {border: solid 1px black; position:absolute;top:0;left:0;width:200;visibility:hidden;z-index:" + gToolIndexOn + ";background-color:#ffffff; border-color:black; border-style:solid; border-width: 1px;} ";
tStyleText += " .cMIText {" + vMenuItemTextStyle + "} .cToolTipText {" + vToolTipTextStyle + "} ";
document.write(tStyleText);
for(var i=0;i<vFurns.length;i++ ){
	vFurns[i].mWriteStyleText(document);
}
document.write(" <\/STYLE>");
}
function buildDivs(){
if(is_nav){
	document.write("<div id='MaskDiv'><\/div><div id='ToolTipDiv'>help text<\/div>");
	for(var i=0;i<vFurns.length;i++ ){
		tDivsText=vFurns[i].mWriteDivText(document);
	}
} else{
	var tDivsText="<div id='MaskDiv'><\/div><div id='ToolTipDiv'>help text<\/div>";
	for(var i=0;i<vFurns.length;i++ ){
		tDivsText=vFurns[i].mGetDivText(tDivsText);
	}
	document.open();
	document.write(tDivsText);
	document.close();
}
}

function fNotify(inText){
window.status=inText;
}


function fTooltip(inText,x,y ){
if(vTooltipTimer!=null){
	clearTimeout(vTooltipTimer);
	vTooltipTimer=null;
}

fShowDiv(vTooltips,false);
if(x){
	if(is_nav4){
		fWriteDiv("ToolTipDiv","<TABLE id='ttTab' WIDTH=110 BGCOLOR='white' CELLPADDING=2 CELLSPACING=0 border=1><TR><TD><FONT FACE='Verdana,Arial,Helvetica' SIZE='1'>"+inText+"<\/FONT><\/TD><\/TR><\/TABLE>");
	}
	else{
		inText="<p class='cToolTipText'>" + inText + "<\/p>";
		fWriteDiv("ToolTipDiv",inText);
	}
	fMoveDiv(vTooltips,x,y);
	vTooltipTimer=setTimeout("fShowDiv(vTooltips,true)",vTooltipDelay*1000);
}
}


function fShowDiv(inDiv,inVis){
if(inVis){ inDiv.visibility=(is_nav4)?'show':'visible';}
else{inDiv.visibility=(is_nav4)?'hide':'hidden';} 
}


function fMoveDiv(inDiv,x,y){
if(is_nav4) {inDiv.left=x; inDiv.top=y;	}
if(is_ie4) {inDiv.pixelLeft=x;	inDiv.pixelTop=y;}
if(is_5up) {inDiv.left=x+"px"; inDiv.top=y+"px"};
}


function fSizeDiv(inDiv,inWidth,inHeight){
if(is_nav4 || is_5up){
	inDiv.width=inWidth;
	inDiv.height=inHeight;
}
else{  
	inDiv.pixelWidth=inWidth;
	inDiv.pixelHeight=inHeight;
	}
}
function fClipDiv(inDiv,inTop,inRight,inBottom,inLeft){
if(!vIE4Mac){
	if(is_nav4){
		inDiv.clip.left=inLeft;
		inDiv.clip.top=inTop; 
		inDiv.clip.bottom=inBottom;
		inDiv.clip.right=inRight;
	}else if (is_ie4){
		inDiv.clip="rect("+inTop+"px," + inRight + "px," + inBottom + "px,"+inLeft+"px)";
	}else if (is_5up) {
		inDiv.clip="rect("+inTop+"px " + inRight + "px " + inBottom + "px "+inLeft+"px)";  
	}
}
}
function fWriteDiv(inName,inText){
var tDoc;
if(is_nav4){
	eval("tDoc=document." + inName + ".document");
	tDoc.open();
	tDoc.write(inText);
	tDoc.close();
}
if  (is_ie4){document.all[inName].innerHTML=inText;	}
if  (is_5up){document.getElementById(inName).innerHTML=inText;	}  
}
function fPreloadImage(inPath){
var tImage=new Image();
tImage.src=inPath;
vPreloadedImages[vPreloadedImages.length]=tImage;
}
function fPreloadImages(){
for(var i=0;i<vFurns.length;i++ ){
	vFurns[i].mPreloadImages();
}
}
function fSetMenuItemWidths(inFurns,inMaxWidth){
if(inFurns){
	for(var i=0;i<inFurns.length;i++ ){
		if(inFurns[i].dPosAbs == false){
			inFurns[i].mSizeTo(inMaxWidth+vMenuPad,inFurns[i].dHeight);
		}
	}
}
}
function showMenu(){
gDrawTime[++vMSTIndex]=new Date();
var tMaxWidth=0;
if(is_nav4){
	vWinHeight=window.innerHeight; 
	vWinWidth=window.innerWidth; 
	vMask=document.MaskDiv;
	vTooltips=document.ToolTipDiv; 
	vMask.onmouseover=fMenuOff; 
	fClipDiv(vMask,0,vWinWidth,vWinHeight,0); 
}
if (is_ie4 || is_ie5) {
	vWinHeight=document.body.clientHeight;
	vWinWidth=document.body.clientWidth;
	document.all.MaskDiv.onmouseover=fMenuOff; 
	vMask=document.all.MaskDiv.style;
	vTooltips=document.all.ToolTipDiv.style;
	fSizeDiv(vMask,vWinWidth-16,vWinHeight-16); 
}
if (is_nav5up) {
	vWinHeight=window.innerHeight; 
	vWinWidth=window.innerWidth; 
	document.getElementById("MaskDiv").onmouseover=fMenuOff;
	vMask=document.getElementById("MaskDiv").style;
	vTooltips=document.getElementById("ToolTipDiv").style;
	fSizeDiv(vMask,vWinWidth-16,vWinHeight-16); 
}
window.onresize=fResize;	 
for(var i=0;i<vFurns.length;i++ ){
	vFurns[i].mInstallHandler(true);
}
vInterval=setInterval("fCycle()",vBannerTime*1000);
setTimeout("fPreloadImages()",200);	
gDrawTime[vMSTIndex]="load:" + (new Date()-gDrawTime[vMSTIndex]);
if(vDebug){
	if(gDrawTime != null){
		alert(new Date()-vStartTime + "\n" + gDrawTime );
	}
	else{
		alert(new Date()-vStartTime);
	}
}	
return true;
}

//these items hide all drop menus on a page
function hideme(){
	var selNodes = document.getElementsByTagName('select')
	var i=0;
	if (!selNodes.item(0)){
		return false;
	}
	else{
		do{selNodes.item(i).style.visibility = 'hidden';}
		while(++i < selNodes.length);
	}
}

function showme(){
	var selNodes = document.getElementsByTagName('select')
	var i=0;
	if (!selNodes.item(0)){
		return false;
	}
	else{
		do{selNodes.item(i).style.visibility = 'visible';}
		while(++i < selNodes.length);
	}
}


function fResize(){
if(is_nav4){
	if(vWinHeight != window.innerHeight && vWinHeight != window.innerWidth) history.go(0);
}
if (is_ie) {
	vMask.width=document.body.clientWidth-16;
	vMask.height=document.body.clientHeight-16;
}
if (is_nav5up) {
	vMask.width=window.innerWidth-16; 
	vMask.height=window.innerHeight-16; 
}
}

gDrawTime[vMSTIndex]=new Date();
fInit(); 
gDrawTime[vMSTIndex]="init:" + (new Date()-gDrawTime[vMSTIndex]);
gDrawTime[++vMSTIndex]=new Date();
fWriteStyles();  
gDrawTime[vMSTIndex]="style:" + (new Date()-gDrawTime[vMSTIndex]);


function fTrim(strText) { 
while (strText.substring(0,1) == ' ') 
strText=strText.substring(1,strText.length);
while (strText.substring(strText.length-1,strText.length) == ' ')
strText=strText.substring(0,strText.length-1);
return strText;
} 
var vFocused=0;
function fFocus() {
if (vFocused == 0) fClearBox();
}
function fClearBox() {
vFocused=1;
if (is_ie4down) document.all.free_text.value="";
else if (is_nav4down) document.layers.divSearch.document.forms.fsearch.free_text.value="";
else if (is_5up) document.getElementById("free_text").value="";
}


