var LoadWithMap = false;

function trimMe(str){
	var	str = str.replace(/^\s\s*/, ''),
		ws = /\s/,
		i = str.length;
	while (ws.test(str.charAt(--i)));
	return str.slice(0, i + 1);
}


function isIE()
{
return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}

function ShowHideMainMenu(MenuIDtoShow, SiteName, Section){



var ButtonToHighlight = "Top"+MenuIDtoShow+"_select";

//highlight the button if exists
if (document.getElementById(ButtonToHighlight)){



//if ((ButtonToHighlight == "TopNavItem7_select")&&(SiteName == "Group")&&(Section == "careers")){

if ((ButtonToHighlight == "TopNavItem7_select")&&(Section == "careers")){

document.getElementById(ButtonToHighlight).style.border = "2px solid #FFFFFF";

}else{

document.getElementById(ButtonToHighlight).style.border = "2px solid #FFFFFF";
document.getElementById(ButtonToHighlight).style.top = "-99px";
document.getElementById(ButtonToHighlight).style.left = "-8px";
document.getElementById(ButtonToHighlight).style.width = "106px";
document.getElementById(ButtonToHighlight).style.height = "106px";
document.getElementById(ButtonToHighlight).style.position = "relative";

}
	
}


if (!(document.getElementById("PreventMenu"))){


//if menu exists then try to show it
if (document.getElementById(MenuIDtoShow)){

//var HeadingInnerText = "";
//var Headings = document.getElementsByTagName("H1");
//for (var i = 0; i < Headings.length; i++) { 
  //alert(Headings[i].innerText);
//  HeadingInnerText = "";
//  if(document.all){
//     HeadingInnerText = Headings[i].innerText;
//} else{
//    HeadingInnerText = Headings[i].textContent;
//}
   
  //HighlightMenuItem(HeadingInnerText,MenuIDtoShow);
//}



//alert('Opening menu');
ShowMenuNow(MenuIDtoShow, SiteName, Section,'#FFFFFF');


}





}
}


function ShowHideMainMenu2(MenuIDtoShow, SiteName, Section,TextColorOver){

var ButtonToHighlight = "Top"+MenuIDtoShow+"_select";

//highlight the button if exists
if (document.getElementById(ButtonToHighlight)){



//if ((ButtonToHighlight == "TopNavItem7_select")&&(SiteName == "Group")&&(Section == "careers")){

if ((ButtonToHighlight == "TopNavItem7_select")&&(Section == "careers")){

//document.getElementById(ButtonToHighlight).style.border = "2px solid #FFFFFF";
//document.getElementById(ButtonToHighlight).style.backColor = "#FFFFFF";
//document.getElementById(ButtonToHighlight).style.color = "#668bb2";



}else{


//document.getElementById(ButtonToHighlight).style.border = "2px solid #FFFFFF";
//document.getElementById(ButtonToHighlight).style.top = "-99px";
//document.getElementById(ButtonToHighlight).style.left = "-8px";
//document.getElementById(ButtonToHighlight).style.width = "106px";
//document.getElementById(ButtonToHighlight).style.height = "106px";
//document.getElementById(ButtonToHighlight).style.position = "relative";


//alert(MenuIDtoShow);


var BoxColor;

if (isIE()==true){

BoxColor = document.getElementById("Top"+MenuIDtoShow).currentStyle['backgroundColor'];
}else{

BoxColor = window.getComputedStyle(document.getElementById("Top"+MenuIDtoShow),null).backgroundColor;

//BoxColor = document.getElementById("Top"+MainMenuItemToHighlight).getPropertyValue('background-color');

}

var OriginalBoxHeight;

OriginalBoxHeight = document.getElementById("Top"+MenuIDtoShow).offsetHeight;

//alert(BoxColor);

document.getElementById("Top"+MenuIDtoShow).style.backgroundColor = "#FFFFFF";
document.getElementById("Top"+MenuIDtoShow).style.color = TextColorOver;
//document.getElementById("Top"+MenuIDtoShow).style.height = (OriginalBoxHeight-12)+"px";
document.getElementById("Top"+MenuIDtoShow).style.borderTop = "2px solid " + BoxColor;
document.getElementById("Top"+MenuIDtoShow).style.borderLeft = "2px solid " + BoxColor;
document.getElementById("Top"+MenuIDtoShow).style.borderRight = "2px solid " + BoxColor;

//document.getElementById("Top"+ MenuIDtoShow).style.backgroundColor = "#FFFFFF";
//document.getElementById("Top"+ MenuIDtoShow).style.color = TextColorOver;

}
	
}


if (!(document.getElementById("PreventMenu"))){


//if menu exists then try to show it
if (document.getElementById(MenuIDtoShow)){

//var HeadingInnerText = "";
//var Headings = document.getElementsByTagName("H1");
//for (var i = 0; i < Headings.length; i++) { 
  //alert(Headings[i].innerText);
//  HeadingInnerText = "";
//  if(document.all){
//     HeadingInnerText = Headings[i].innerText;
//} else{
//    HeadingInnerText = Headings[i].textContent;
//}
   
  //HighlightMenuItem(HeadingInnerText,MenuIDtoShow);
//}



//alert('Opening menu');
ShowMenuNow(MenuIDtoShow, SiteName, Section, BoxColor);


}

}


}



function ShowMenuNow(MenuIDtoShow, SiteName, Section,BoxColor){


var elem = document.getElementById(MenuIDtoShow);

//var BoxColor;

//if (isIE()==true){

//BoxColor = document.getElementById("Top"+MenuIDtoShow).currentStyle['borderColor'];
//}else{

//BoxColor = window.getComputedStyle(document.getElementById("Top"+MenuIDtoShow),null).borderColor;

////BoxColor = document.getElementById("Top"+MainMenuItemToHighlight).getPropertyValue('background-color');

//}

//elem.style.left = "0px";
		elem.style.top = "-529px"; // the number here sets the y position to start on, normally the same as the height of the div.


//loop through the breadcrumb if it exists and count levels

if (document.getElementById("breadcrumbFirstMenu")){

var BreadcrumbString = "";
var BreadCrumbStringHTML = "";

BreadCrumbStringHTML = document.getElementById('breadcrumbFirstMenu').innerHTML;

//alert(BreadCrumbStringHTML);

//if(document.all){
     //BreadcrumbString = document.getElementById('breadcrumbFirstMenu').innerText;
//} else{
   // BreadcrumbString = document.getElementById('breadcrumbFirstMenu').textContent;
//}

//var BreadcrumbString = document.getElementById("breadcrumbFirstMenu").innerText;
var BreadcrumbArray = BreadcrumbString.split(">");

//i = 0;

var BreadcrumbElemmentInnerText = "";
var BreadcrumbAelementHREF = "";

//loop through all a hrefs for the breadcrumb
var divToSearchIn = document.getElementById('breadcrumbFirstMenu'); 
var aLinksvar = divToSearchIn.getElementsByTagName("A"); 
for( var a = 0; a < aLinksvar.length; a++ ){  

//alert(aLinksvar.item(a).href)
//aNodeList.item(a).onclick = intercept;
BreadcrumbAelementHREF = "";
BreadcrumbAelementHREF = aLinksvar.item(a).href;
var aLinksItemArrayVar = BreadcrumbAelementHREF.split("/");
//split the url found for each item and get the last element address for the item found
for(var b = 0; b < aLinksItemArrayVar.length; b++ ){  

//alert(aLinksItemArrayVar.length);

//only get the last element to find
if (b==(aLinksItemArrayVar.length-1)){

//alert(aLinksItemArrayVar[b]);

//dont highlight latest news
if (aLinksItemArrayVar[b] != "News.aspx"){
//alert('link found');
HighlightMenuItem(aLinksItemArrayVar[b],MenuIDtoShow,BoxColor,"2px","2px","2px","2px",Section,SiteName);
}else{
//HighlightMenuItem(aLinksItemArrayVar[b],MenuIDtoShow,"#000000","2px","2px","2px","2px",Section,SiteName);

}


}


}

} 



//for (var a = 0; a < document.getElementById('breadcrumbFirstMenu').links.length; a++) { 
  //alert(i);
  
  //BreadcrumbElemmentInnerText = "";
 
    //BreadcrumbElemmentInnerText = BreadcrumbArray[i];
 
  //alert(document.getElementById('breadcrumbFirstMenu').links[a].href);
  
  //HighlightMenuItem(BreadcrumbElemmentInnerText,MenuIDtoShow,"#ffffff","2px","2px","2px","2px",Section,SiteName);
  
  
  
//}



//for (var i = 0; i < BreadcrumbArray.length; i++) { 
  //alert(i);
  
  //BreadcrumbElemmentInnerText = "";
 
    //BreadcrumbElemmentInnerText = BreadcrumbArray[i];
 
  //alert(BreadcrumbElemmentInnerText);
  
  //HighlightMenuItem(BreadcrumbElemmentInnerText,MenuIDtoShow,"#ffffff","2px","2px","2px","2px",Section,SiteName);
  
  
  
//}


if (a > 2){

elem.style.top = "0px";

}else{


if (document.getElementById("StaticMenu")){  		
  	elem.style.top = "0px";	   		 		
}else{
moveElement(MenuIDtoShow,0); // the number here sets the y position to end on.
}


}

}else{

if (document.getElementById("StaticMenu")){  		
  	elem.style.top = "0px";	   		 		
}else{
moveElement(MenuIDtoShow,0); // the number here sets the y position to end on.
}



}

}


function HighlightMenuItem(StringToFind, MenuToSearchIn,BorderColor,BorderWidthTop,BorderWidthBottom,BorderWidthLeft,BorderWidthRight,Section,SiteName){
      
       
if (document.getElementById(MenuToSearchIn)){

//look for a text that matches page h1 and highlight it
var divElem = document.getElementById(MenuToSearchIn);
var MenuItemAHrefText = "";
var PreviousID = 0;
var MenuITEMAelementHREF = "";

var MenuLinks = divElem.getElementsByTagName("a");
//loop through the a hrefs for the navigation element
for (var i = 0; i < MenuLinks.length; i++) { 
  
  MenuItemAHrefText = "";
  
  //if(document.all){
  
  MenuItemAHrefText = MenuLinks.item(i).href;
     //MenuItemAHrefText = MenuLinks[i].innerText;
//} else{
    //MenuItemAHrefText = MenuLinks[i].textContent;
//}
    
    
    
    //alert(aLinksvar.item(a).href)
//aNodeList.item(a).onclick = intercept;
MenuITEMAelementHREF = "";
MenuITEMAelementHREF = MenuLinks.item(i).href;
var aMenuItemLinksItemArrayVar = MenuITEMAelementHREF.split("/");
//split the url found for each item and get the last element address for the item found
for(var c = 0; c < aMenuItemLinksItemArrayVar.length; c++ ){  

//alert(aLinksItemArrayVar.length);

//only get the last element to find
if (c==(aMenuItemLinksItemArrayVar.length-1)){

//alert(aLinksItemArrayVar[b]);
//HighlightMenuItem(aMenuItemLinksItemArrayVar[c],MenuIDtoShow,"#ffffff","2px","2px","2px","2px",Section,SiteName);

MenuItemAHrefText = aMenuItemLinksItemArrayVar[c];


}


}
    
    
    
    
    
    //MenuItemAHrefText = MenuItemAHrefText.replace("&amp;","&");
    //MenuItemAHrefText = MenuItemAHrefText.replace("&nbsp;"," ");
    //MenuItemAHrefText = MenuItemAHrefText.replace(\/n," ");

//StringToFind = StringToFind.replace("&amp;","&");
    //StringToFind = StringToFind.replace("&nbsp;"," ");
    //StringToFind = StringToFind.replace(\/n," ");
    
    //MenuItemAHrefText = trimMe(MenuItemAHrefText.toLowerCase());
    //StringToFind = trimMe(StringToFind.toLowerCase());
       
       //alert('"'+StringToFind+'"-"'+MenuItemAHrefText+'"');
         
  if (StringToFind == MenuItemAHrefText){
//  //alert(MenuLinks[i].innerText);
  //alert(MenuLinks[i].currentStyle['height']);
    
  MenuLinks[i].style.borderTop = "solid "+BorderWidthTop+" "+BorderColor;
  MenuLinks[i].style.borderBottom = "solid "+BorderWidthBottom+" "+BorderColor;
  MenuLinks[i].style.borderLeft = "solid "+BorderWidthLeft+" "+BorderColor;
  MenuLinks[i].style.borderRight = "solid "+BorderWidthRight+" "+BorderColor;
   
  //highlight different for a to z listing
  if ((Section=="IntegratedServices") && (SiteName=="Group")){
  
  
  
  if (i > 0){
    
    PreviousID = (i-1);
       
       
       if (MenuLinks[PreviousID]){
  
  //MenuLinks[PreviousID].style.borderRight = "solid 1px #5191CD";
    
  } 
       
  }
    
 
    
    
  MenuLinks[i].style.paddingLeft = "3px";
  MenuLinks[i].style.paddingRight = "4px";
  MenuLinks[i].style.paddingTop = "2px";
  MenuLinks[i].style.paddingBottom = "2px"
    
  
  
    
  }else{
  MenuLinks[i].style.paddingLeft = "4px";
  }
  
      
  }else{
  
  //MenuLinks[i].style.border = "solid 2px #000000";
  
  //alert("no match - Menu Text="+MenuItemAHrefText+ " - String To Match=" +StringToFind);
  
  //alert('no match');
  
  
  }
  
  
}


}


}



function HighlighSubMenuItem(MainMenuItemToHighlight,TextColorOver){



var MainMenuIDTopNavID = "Top"+MainMenuItemToHighlight+"_select";

//highlight the main button if exists
if (document.getElementById(MainMenuIDTopNavID)){

//if careers button then just highlight it
if (MainMenuIDTopNavID == "TopNavItem7_select"){

//document.getElementById(MainMenuIDTopNavID).style.border = "2px solid #FFFFFF";

}else{
//document.getElementById(MainMenuIDTopNavID).style.border = "2px solid #FFFFFF";
//document.getElementById(MainMenuIDTopNavID).style.top = "-99px";
//document.getElementById(MainMenuIDTopNavID).style.left = "-8px";
//document.getElementById(MainMenuIDTopNavID).style.width = "106px";
//document.getElementById(MainMenuIDTopNavID).style.height = "106px";
//document.getElementById(MainMenuIDTopNavID).style.position = "relative";


var BoxColor;

if (isIE()==true){

BoxColor = document.getElementById("Top"+MainMenuItemToHighlight).currentStyle['backgroundColor'];
}else{

BoxColor = window.getComputedStyle(document.getElementById("Top"+MainMenuItemToHighlight),null).backgroundColor;

//BoxColor = document.getElementById("Top"+MainMenuItemToHighlight).getPropertyValue('background-color');

}

var OriginalBoxHeight;

OriginalBoxHeight = document.getElementById("Top"+MainMenuItemToHighlight).offsetHeight;

//alert(BoxColor);

document.getElementById("Top"+MainMenuItemToHighlight).style.backgroundColor = "#FFFFFF";
document.getElementById("Top"+MainMenuItemToHighlight).style.color = TextColorOver;
document.getElementById("Top"+MainMenuItemToHighlight).style.height = (OriginalBoxHeight-12)+"px";
document.getElementById("Top"+MainMenuItemToHighlight).style.border = "2px solid " + BoxColor;


	}
}

if (document.getElementById("breadcrumbFirstMenu")){


var BreadcrumbElemmentInnerText = "";
var BreadcrumbAelementHREF = "";

//loop through all a hrefs for the breadcrumb
var divToSearchIn = document.getElementById('breadcrumbFirstMenu'); 
var aLinksvar = divToSearchIn.getElementsByTagName("A"); 
for( var a = 0; a < aLinksvar.length; a++ ){  

//alert(aLinksvar.item(a).href)
//aNodeList.item(a).onclick = intercept;
BreadcrumbAelementHREF = "";
BreadcrumbAelementHREF = aLinksvar.item(a).href;
var aLinksItemArrayVar = BreadcrumbAelementHREF.split("/");
//split the url found for each item and get the last element address for the item found
for(var b = 0; b < aLinksItemArrayVar.length; b++ ){  

//alert(aLinksItemArrayVar.length);

//only get the last element to find
if (b==(aLinksItemArrayVar.length-1)){


HighlightMenuItem(aLinksItemArrayVar[b],'LeftSubMenu',BoxColor,"2px","1px","2px","2px");

}


}

} 



//var BreadcrumbString = "";

//if(document.all){
//     BreadcrumbString = document.getElementById('breadcrumbFirstMenu').innerText;
//} else{
//    BreadcrumbString = document.getElementById('breadcrumbFirstMenu').textContent;
//}

//var BreadcrumbString = document.getElementById("breadcrumbFirstMenu").innerText;
//var BreadcrumbArray = BreadcrumbString.split(">");

////i = 0;

//var BreadcrumbElemmentInnerText = "";

//for (var i = 0; i < BreadcrumbArray.length; i++) { 
//  //alert(i);
//  
//  BreadcrumbElemmentInnerText = "";
// 
//    BreadcrumbElemmentInnerText = BreadcrumbArray[i];
// 
//  //alert(BreadcrumbElemmentInnerText);
//  
//  HighlightMenuItem(BreadcrumbElemmentInnerText,'LeftSubMenu',"#003E7E","2px","1px","2px","2px");
//  
//  
//  
//}

}


}



