var bw=new checkBrowser();

function init() {

	checkBrowser();
	if(bw.ie4)
	{
		document.getElementById = document.all;
	}

}



// this will toggle the submenu
// returns true if it was turned off, or does not have children, returns false if it was on already
function toggle(eventId) {
	// loop through all the menus
	
	var i = 0;
	var menu = document.getElementById("menu" + i)
	var retval = false;
	while(menu != null)
	{
		if(i == eventId && (menu.className == "hasChildren" || menu.className == "airlinebus" || menu.className == "aon"))
		{
			// this is the one that the user clicked on and its hidden - unhide it!
			
			menu.className += "Landed";
			document.getElementById("child" + i).style.display = "";	
			retval = true;
		}
		else if(menu.className == "hasChildrenLanded" || menu.className == "airlinebusLanded" || menu.className == "aonLanded")
		{
			// hide it
			menu.className = menu.className.substr(0, menu.className.length - 6);
			document.getElementById("child" + i).style.display = "none";
		}
		else if(i == eventId)
		{
			retval = true;
		}
		
		// loop through to the next one
		var menu = document.getElementById("menu" + (++i))
	}
	return retval;
}



function processClick(strTarget){
	//***************************************************************************************
	//Author: Paul Stinton
	//Date	: 23 Feb 2001
	//Desc	: Process the target URL/ banner flag parameter. Construct HTML forthe parent frameset
	//		  to show/hide the banner frame appropriately. The strTarget parameter will be in the form
	//		  "URL|Bannerflag" e.g. "..\news.asp|on"
	//
	//Change History
	//
	//Author			Date		Desc
	//
	//***************************************************************************************
	//Local vars
	var strParentFramesetHTML;		//HTML for parent frameset
	var strTargetURL;					//Target URL
	var strBannerOn;					//Banner  On/Off flag
	var intBannerSep;					//Control character position (Control character is a "|")
	var bw = new checkBrowser();		//Client browser

	//Get the banner flag and URL from the parameter
	intBannerSep = strTarget.indexOf('|');
	if (intBannerSep != -1)
	{
	  strBannerOn = strTarget.substr(intBannerSep + 1);
	  strTargetURL = strTarget.substr(0, intBannerSep);
	}
	else
	{
	  strTargetURL = strTarget;
	}
  
	//If we are in I.E. then just adjust the rows property of the main frameset
	if (!bw.ns4){
		 window.parent.frames['content'].window.location = strTargetURL
		if (strBannerOn == 'on'){
		  window.parent.parent.document.all.frsMain.cols = '*,130';     
		}
		else{
		   window.parent.document.all.frsMain.rows = '*,0';
		}
	//  Netscape. Well, we're going to have to rewrite the calling fameset, here we go
	}else{
		window.parent.parent.document.open()
		if (strBannerOn == 'on'){
		  	strParentFramesetHTML = "<html><head><title>ATI- Air Transport Intelligence</title><meta name='description' content='Airline Transport Intelligence'></head>";
		strParentFramesetHTML = strParentFramesetHTML & "<!-- " & vstrTarget & " -->" & vbCrLf 
		strParentFramesetHTML = strParentFramesetHTML & "<frameset rows='91,*'  BORDER=0 FRAMESPACING=0 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0>" & vbCrLf 
		strParentFramesetHTML = strParentFramesetHTML & "<frame src='header.htm'  scrolling='no' topmargin='0' leftmargin='0' marginwidth='0' marginheight='0' border='0' noresize>" & vbCrLf 

		strParentFramesetHTML = strParentFramesetHTML & "<frameset cols='138,*' border='0' framespacing='0' frameborder='0' marginwidth='0' marginheight='0'>" & vbCrLf 
		strParentFramesetHTML = strParentFramesetHTML & "<frame src='leftnav.asp?target=" & vstrTarget & "' name='leftnav' SCROLLING=NO topmargin=0 leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 BORDER=0 noresize>" & vbCrLf
		strParentFramesetHTML = strParentFramesetHTML & "<frameset cols='*,130' name='frsMain' id='frsMain' BORDER=0 FRAMESPACING=0 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0>" & vbCrLf
		strParentFramesetHTML = strParentFramesetHTML & "<frame src='" & vstrTarget & "' name='content' SCROLLING=AUTO topmargin=0 leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 BORDER=0 noresize>" & vbCrLf
		strParentFramesetHTML = strParentFramesetHTML & "<frame src='" & fnBannerAdsForModules(vstrTarget) & "' name='bannerads' SCROLLING=NO topmargin=0 leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 BORDER=0 noresize>" & vbCrLf
		strParentFramesetHTML = strParentFramesetHTML & "</frameset>" & vbCrLf
		strParentFramesetHTML = strParentFramesetHTML & "</frameset>" & vbCrLf
		}else{
		  	strParentFramesetHTML = "<html><head><title>ATI- Air Transport Intelligence</title><meta name='description' content='Airline Transport Intelligence'></head>";
		strParentFramesetHTML = strParentFramesetHTML & "<!-- " & vstrTarget & " -->" & vbCrLf 
		strParentFramesetHTML = strParentFramesetHTML & "<frameset rows='91,*'  BORDER=0 FRAMESPACING=0 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0>" & vbCrLf 
		strParentFramesetHTML = strParentFramesetHTML & "<frame src='header.htm'  scrolling='no' topmargin='0' leftmargin='0' marginwidth='0' marginheight='0' border='0' noresize>" & vbCrLf 

		strParentFramesetHTML = strParentFramesetHTML & "<frameset cols='138,*' border='0' framespacing='0' frameborder='0' marginwidth='0' marginheight='0'>" & vbCrLf 
		strParentFramesetHTML = strParentFramesetHTML & "<frame src='leftnav.asp?target=" & vstrTarget & "' name='leftnav' SCROLLING=NO topmargin=0 leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 BORDER=0 noresize>" & vbCrLf
		strParentFramesetHTML = strParentFramesetHTML & "<frameset rows='*,0' name='frsMain' id='frsMain' BORDER=0 FRAMESPACING=0 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0>" & vbCrLf
		strParentFramesetHTML = strParentFramesetHTML & "<frame src='" & vstrTarget & "' name='content' SCROLLING=AUTO topmargin=0 leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 BORDER=0 noresize>" & vbCrLf
		strParentFramesetHTML = strParentFramesetHTML & "<frame src='" & fnBannerAdsForModules(vstrTarget) & "' name='bannerads' SCROLLING=NO topmargin=0 leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 BORDER=0 noresize>" & vbCrLf
		strParentFramesetHTML = strParentFramesetHTML & "</frameset>" & vbCrLf
		strParentFramesetHTML = strParentFramesetHTML & "</frameset>" & vbCrLf
		}
		window.parent.parent.document.write(strParentFramesetHTML)
		window.parent.parent.document.close()
		//window.alert(strParentFramesetHTML)
	}
	return ;
}
/*
function TopMenuProcessClick()

This function is called on all top level menu items of the new menu eg news airlines etc. If its an inital click 
on this item - so as the menu items state has just be set to "down" by calling the toggle function - then this 
click will also load the main frame with the default page of this menu item by the calling of the processClick 
function passing in the target URL parameter.

Andy Flynn 14th November 2003
*/
function TopMenuProcessClick(DataItem,Target){
	//test to see if click menu item is down or if another menu item is down
	if(toggle(DataItem))
	{
		processClick(Target);
	}
}

