var MMenuArray = new Array(
new Array("Info Centre",0,"No",""),
new Array("Freighters",1,"Yes","Freighter Schedule"),
new Array("Fuel Index",9,"Yes","Methodology","Index","Canada Fuel Index","USA Fuel Index","Caribbean Fuel Index","South America Fuel Index","South Pacific","Europe Fuel Index","United Kingdom"),
new Array("Services",4,"Yes","AC Expedair","AC Priority","AC Air Freight","Road Feeder Service"),
new Array("Products",6,"Yes","AC Cool","AC Live","AC DGR","AC Fresh","AC Secure","AC Compassion"),
new Array("Fleet and ULDs",2,"Yes","Fleet","ULDs"),
new Array("Worldwide Offices",0,"No",""),
//new Array("Worldwide Offices",13,"No","Canada","USA","UK and Ireland","Caribbean","South America","Central America & Mexico","Southwest Pacific","East Asia","Indian Subcontinent","Middle East","Europe","Russia & CIS","Africa"),
new Array("Tools and References",0,"No",""),
new Array("Credit Application",2,"Yes","New Application", "Existing Accounts"));

var Level3Array = new Array(
new Array("Products","AC Live",5,"Preparing for travel","Transport regulations","Travel Restrictions","FAQs","Contact us"),
new Array("Products","AC DGR",3,"Dangerous Goods Contacts","Defining Dangerous Goods","Shipper's Responsibility"),
new Array("Products","AC Fresh",6,"Inside Packaging","Outside Packaging","Packaging Acceptance","Refrigerants and Insulation","External Marking and Labelling","Cool Room Facilities"),
new Array("Products","AC Secure",4,"Definition for Valuable Goods","Classes of Valuable Goods","Air Waybill Preparation","Valuation Charges & Liability"),
new Array("Products","AC Compassion",2,"Cremated/Uncremated","Bereave Fares"),
new Array("Services","AC Priority",4,"Domestic Canada","Canada to USA","USA to Canada","Priority International"),
new Array("Services","AC Air Freight",3,"Within Canada","Canada to USA","USA to Canada"),
new Array("Fleet and ULDs","Fleet",2,"Aircraft Specifications","Package Sizing Charts"));



var optionID = ""; 
var mmenu = "";

function toggleClamShellMenu(objectID,optionID) 
{
 var optionLevel="";
 var submenu="";
 var level4showhide="";
 
 for(i = 0 ; i<MMenuArray.length ; i++){
 	if (objectID == MMenuArray[i][0])
	{  
	   document.getElementById(MMenuArray[i][0]+"M").style.display="block";
	}  
 	
	else {
	   for (j=3;j<MMenuArray[i][1]+3;j++){
		   if (objectID == MMenuArray[i][j]){
		        document.getElementById(MMenuArray[i][0]+"M").style.display="block";
			}   
  		}	 
	}
}	
for (x=0;x<Level3Array.length;x++){ 
	optionLevel = "";	
	for(j=3;j<Level3Array[x][2]+3;j++)
	   	  if(optionID==Level3Array[x][j])
			  { optionLevel = Level3Array[x][1]; break;}
		
	if((optionID==Level3Array[x][1]) || ( optionLevel==Level3Array[x][1]))
	{  submenu = Level3Array[x][1];
	   document.getElementById(Level3Array[x][0]+"M").style.display="block";
	   document.getElementById(Level3Array[x][1]+"M").style.display="block";
	   
	 }
 }	
if (optionID != "" )
{ if(submenu == "")
    document.getElementById(optionID).style.color="#405C7F" 
  else{
	    document.getElementById(optionID).style.color="#405C7F";
		document.getElementById(submenu).style.color="#405C7F" 
	    document.getElementById(submenu).style.fontWeight="bold";
	  }	
	  document.getElementById(optionID).style.fontWeight="bold";
    }   
	if (objectID!="")
	     { document.getElementById(objectID).style.color="#97A6B9";
		 document.getElementById(objectID).style.fontWeight="bold";
		 }
	 
return;
}


function highlightMenu()
{
var fulltitle = parent.document.title;
var thistitle = fulltitle.substring(fulltitle.lastIndexOf('-')+2,fulltitle.length);
var loc;
ispipe=thistitle.indexOf('|');
if(ispipe != -1)
	thistitle=thistitle.substring(0,ispipe-1);

if (thistitle == "Investor Relations" || thistitle == "Our Fleet" || thistitle == "Corporate Profile")
{	
	loc = parent.window.location.href;
	anchortitle=loc.substring(loc.lastIndexOf('#')+1,loc.length);
	if (anchortitle == "quarterly")
		thistitle = "Quarterly Results";
	else if (anchortitle == "reports")
		thistitle = "Annual Reports";
	else if (anchortitle == "form")
		thistitle = "Annual Information Form";
	else if (anchortitle == "proxy")
		thistitle = "Management Proxy Circular";
	else if (anchortitle == "shareholder")
		thistitle = "Shareholder/Investor Information";
	else if (anchortitle == "current")
		thistitle = "Current Air Canada Fleet";
	else if (anchortitle == "historical")
		thistitle = "Historical Fleet";
	else if (anchortitle == "financial")
		thistitle = "Financial Profile";
}	
var msubmenu="";
mmenu="";
moption ="";

for(i=0;i<MMenuArray.length;i++)
{  
    if (thistitle== MMenuArray[i][0])
	  {mmenu = MMenuArray[i][0];
	   moption = "";
	   break;}
 	for(j=3;j<MMenuArray[i][1]+3;j++)
	  if (thistitle ==  MMenuArray[i][j])
  	  { mmenu=MMenuArray[i][0];
	   moption = thistitle;
	   break;}
 }
 if (mmenu=="")
 {
    for(i=0;i<Level3Array.length;i++)
	{
	  for(j=3;j<Level3Array[i][2]+3;j++)	
	   if (thistitle ==  Level3Array[i][j])
  	    { mmenu=Level3Array[i][0];
		  msubmenu=Level3Array[i][1];
	      moption = thistitle;
	      break;}
    if(mmenu != "")
	  break; 
  }	  
 }
if (mmenu != "")  
	toggleClamShellMenu(mmenu,moption);
else 
	toggleClamShellMenu("","");
}

function showLevels(objectID){
	var fulltitle = parent.document.title;
	var thistitle = fulltitle.substring(fulltitle.lastIndexOf('-')+2,fulltitle.length);

	ispipe=thistitle.indexOf('|');
	if(ispipe != -1)
		thistitle=thistitle.substring(0,ispipe-1);
    	var foundflag;
	var menuTitle="";
	for(i = 0 ; i<Level3Array.length ; i++){
	   		foundflag = false;
			for (j=3;j<Level3Array[i][2]+3;j++)
				
				if(Level3Array[i][j] == thistitle){
					foundflag = true;
					menuTitle = Level3Array[i][0];
					break;}
			if (foundflag == false)		
				document.getElementById(Level3Array[i][1]+"M").style.display="none";
	}  
	if(menuTitle !=""){
	 for(i = 0 ; i<MMenuArray.length; i++){
		if(menuTitle != MMenuArray[i][0]) 
			document.getElementById(MMenuArray[i][0]+"M").style.display="none";
	 }
	} else{
	  for(i = 0 ; i<MMenuArray.length; i++){
	    foundflag=false;
		for(j=3;j<MMenuArray[i][1]+3;j++)
			if(thistitle == MMenuArray[i][j]){
				foundflag = true;
				break;
			}
		 if(foundflag!=true)
		 {
		 	document.getElementById(MMenuArray[i][0]+"M").style.display="none";}
		}
	 }			
	
	toggleClamShellMenu(objectID,'');
}	  

