/*********************************Browser Functions***************************************************/
var br;
if(navigator.appName == "Netscape" && navigator.appVersion.charAt(0)=="4"){br="N";}
else if(navigator.appName == "Microsoft Internet Explorer" && document.all != null){br="IE";}
else if(navigator.appName == "Netscape" && document.getElementById != null && navigator.appVersion.charAt(0)=="5"){br="N5";}
else{br=null}
/*********************************End of Browser Functions********************************************/

/*********************************OS Functions***************************************************/
var OSType="";
var ua = navigator.userAgent;
if (br == "IE")
{
	if (ua.indexOf("Mac")>=1)
	{
		OSType = "Mac";
	}
}
//alert("OSType = " + OSType);
/*********************************End of OS Functions********************************************/

/*********************************Drop Down Functions************************************************/
// define menu attributes here
menuColor="#EDEBEB";
menuColorOn="#cccccc";
fontColorOn="#003366";
fontColorOff="#0066cc";
lineColor = "99ccff";


separator="<img src=spacer.gif height=1 width=1>";

//to use for pop up menu links
function onClickDropDownMenuLink()
{
	var NewPage = window.open("http://www.EverestGroup.com/index.html", "NewPage");
}

// shows the drop down menu expected arg is active div
function showDDNav(){
	args = showDDNav.arguments;
	var divName = args[0];
	var divRef;	
	
	if(br=="N")
	{
		divRef=eval("document." + divName);
		if(divRef.visibility=='hide'){
			divRef.visibility = 'show';
			hideElement('selProduct')
		}
	} 
	else 
	{
		if (br=="NS6") {
			divRef=eval("document.getElementById('" + divName + "')");
		} 
		else 
		{
			divRef=eval("document.all." + divName);			
		}
		if(divRef.style.visibility=='hidden'){		  
			divRef.style.visibility = 'visible';
		}
	}
}

// hides the drop down menu 
// expected arg is active div 
function hideDDNav(){
	args = hideDDNav.arguments;
	var divName = args[0];
	var divRef;
	
	if(br=="N"){
		divRef=eval("document." + divName);
		if(divRef.visibility=='show'){
			divRef.visibility = 'hide';
		}
		
	} else {
		if (br=="NS6") {
			divRef=eval("document.getElementById('" + divName + "')");
		} else {
			divRef=eval("document.all." + divName);
		}
		if(divRef.style.visibility=='visible'){
			divRef.style.visibility = 'hidden';
		}
	}
}

// hides drop down menu when menu is active IE & NS6
// expected arg is active menu
function hideDiv(){
	args = hideDiv.arguments;
	var divName = args[0];
	var divRef;

	// fix menu flicker problem in IE
	if(br=="IE"){
		divRef=eval("document.all." + divName);
		// calculate active size of menu
		leftDiv=divRef.offsetLeft +2
		rightDiv=divRef.offsetLeft + divRef.clientWidth -2
		topDiv=divRef.offsetTop +2
		bottomDiv=divRef.offsetTop + divRef.clientHeight -2		
		if(window.event.clientY > bottomDiv || 
			window.event.clientY < topDiv || 
			window.event.clientX < leftDiv || 
			window.event.clientX > rightDiv){
				divRef.style.visibility = 'hidden';
		}
	// NS6
	} else {
		divRef=eval("document.getElementById('" + divName + "')");
		divRef.style.visibility = 'hidden';
	}
}

// highlight menuitem in IE & NS6
// expected arg is active menuitem
function divOver(){
	args = divOver.arguments;
	var divName = args[0];
	var divRef;
	
	if (br=="NS6" || br=="N") {
		divRef=eval("document.getElementById('" + divName + "')");
		divRef.style.cursor = "pointer";
	} else {
		divRef=eval("document.all." + divName);
	}
	divRef.style.backgroundColor=menuColorOn;
}

// highlight off menuitem in IE & NS6
// expected arg is active menuitem
function divOut(){
	args = divOut.arguments;
	var divName = args[0];
	var divRef;
	
	if (br=="NS6" || br=="N") {
		divRef=eval("document.getElementById('" + divName + "')");
	} else {
		divRef=eval("document.all." + divName);
	}
	divRef.style.backgroundColor=menuColor;
}

// highlight on menuitem in netscape 4.x expected arg is active menuitem
function menuOver(){
	var args, theMenu;
	args = menuOver.arguments;
	theMenu = eval(args[0]);
	theMenu.bgColor=menuColorOn 
}

// highlight off menuitem in netscape 4.x expected arg is active menuitem
function menuOut(){
	var args, theMenu;
	args = menuOut.arguments;
	theMenu = eval(args[0]);
	theMenu.bgColor=menuColor 
}

// goes to specified url expected arg is url 
function gotoUrl(){
	args = gotoUrl.arguments;
	var CM_RefferingURL, CM_Location, CM_Exists, CM_Javascript;
	CM_ReferringURL = window.location.href;
	CM_ReferringURL = CM_ReferringURL.split("&referringurl=");
	CM_ReferringURL = CM_ReferringURL[0].split("?referringurl=");
	CM_Exists = args[0].indexOf('?');
	CM_Javascript = args[0].indexOf('javascript');
	/*
	if (CM_Exists == -1) {
		CM_Location = args[0] + '?referringurl=' + escape(CM_ReferringURL[0])
	}
	else {
		CM_Location = args[0] + '&referringurl=' + escape(CM_ReferringURL[0])
	}
	if (CM_Javascript != -1) {CM_Location = args[0]}
	location.href = (CM_Location)
	*/
	location.href = args[0]
}

// hides specified tag
function hideElement(HTMLtag)
{
	/*
	for (i = 0; i < document.all.tags(HTMLtag).length; i++)
	{
		obj = document.all.tags(HTMLtag)[i];
		obj.style.visibility = "hidden";
	}
	*/
}

// shows specified tag
function showElement(HTMLtag)
{
/*
	for (i = 1; i < document.all.tags(HTMLtag).length; i++)
	{
		obj = document.all.tags(HTMLtag)[i];
		obj.style.visibility = "visible";
	}
	*/
}

// build the divs for IE & Netscape 6
// expected args are 'div name','x in menudata aray','menu left coord','top in pixels' 
var tdID = 0
function doDiv(){
	args = doDiv.arguments;
	var divID = args[0];
	var x = args[1];
	var divLeft = args[2];
	var divTop = args[3];
	var divWidth = args[4];

	objDiv = "<div id=\"" + divID + "\" style=\"position:absolute; border-style:solid; border-width:1; border-color:" + fontColorOff + "; width:" + divWidth + "px; z-index:2; top:"+ divTop +"px; left: " + divLeft + "; background-color:" + menuColor + "; visibility: hidden;\" onMouseover=\"showDDNav('"+ divID +"');MenuToggle('"+ divID +"');\" onMouseout=\"hideDiv('"+ divID +"');MenuToggle('"+ divID +"');\">"
	objDiv += "<div id=\"spacer\" style=\"position:relative; height:6px; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; font-size:1;\"></div>"
	
	for (y = 0; y < 17; y++){
	    if(menuData[x][y][0]!=null){
		
		   if(menuData[x][y][0]=="bar"){
		   
		   objDiv += "<div id=\"spacer\" style=\"position:relative; height:3px; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; font-size:1;\"></div>"
		   objDiv += "<div id=\"bar\" style=\"position:relative; height:1; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; background-color:" + menuColor + "\">" + separator + "</div>"
           objDiv += "<div id=\"spacer\" style=\"position:relative; height:3px; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; font-size:1;\"></div>"
		
		   } else {
		   
		   objDiv += "<div id=\"x" + tdID + "\" style=\"position:relative; background-color:"+ menuColor +"; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5;\" onMouseover=\"divOver('x" + tdID + "')\" onMouseout=\"divOut('x" + tdID + "')\" class=\"dhtmlNav\" onClick=\"gotoUrl('"+menuData[x][y][1]+"')\">&nbsp;"+ menuData[x][y][0] +"&nbsp;</div>"
		   
		   }
		
		tdID = tdID +1
		}
	}
	objDiv += "<div id=\"bar\" style=\"position:relative; height:1; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; background-color:" + menuColor + ";\">" + separator + "</div>"
	objDiv += "<div id=\"spacer\" style=\"position:relative; height:6px; width:" + eval(divWidth - 10) + "px; z-index:3; left: 5; font-size:1;\"></div></div>"
	
	document.write(objDiv);
}

// build the layers for netscape4 expected args are 'div name','x in menudata aray','menu left coord','top in pixels' 

function doLayer(){
	//alert("in doLayer");
	args = doLayer.arguments;
	var nestLayerID=0
	var layerID = args[0];
	var x = args[1];
	var layerLeft = args[2];
	var layerTop = args[3];
	var layerWidth = args[4];

	if(navigator.platform.indexOf("Win") < 0){layerInc=16;layerStyle="netMenuMac";}
	else{layerInc=15;layerStyle="netMenu";}	
		
	objDiv = "<layer id=\""+ layerID +"\" Z-INDEX=1 BGCOLOR=\""+ menuColor +"\" WIDTH=" + layerWidth + " LEFT="+ layerLeft +" TOP="+ layerTop +" VISIBILITY=HIDE onmouseover=\"MenuToggle('"+ layerID +"');showDDNav('"+ layerID +"')\" onmouseout=\"MenuToggle('"+ layerID +"');hideDDNav('"+ layerID +"')\">"
	
	var nestTop=10
		for (y = 0; y < 17; y++){
				
		    if(menuData[x][y][0]!=null){

				if(menuData[x][y][0]=="bar"){
		   
			    objDiv += "<layer id=\"spacer\" BGCOLOR=\""+ menuColor +"\" WIDTH=" + eval(layerWidth - 10) + " HEIGHT=3 Z-INDEX=8 LEFT=5 TOP="+ nestTop +">"+ separator +"</layer>"
				nestLayerID=nestLayerID+1
				nestTop=nestTop+5			    
				
				objDiv += "<layer id=\"line2\" BGCOLOR="+ menuColor +" WIDTH=" + eval(layerWidth - 10) + " HEIGHT=1 Z-INDEX=11 LEFT=5 TOP="+ nestTop +">"+ separator +"</layer>"
				nestLayerID=nestLayerID+1
				nestTop=nestTop+1
				
				objDiv += "<layer id=\"spacer2\" BGCOLOR=\""+ menuColor +"\" WIDTH=" + eval(layerWidth - 10) + " HEIGHT=3 Z-INDEX=8 LEFT=5 TOP="+ nestTop +">"+ separator +"</layer>"				
				nestLayerID=nestLayerID+1
				nestTop=nestTop+5
				
				} else {
		   			    
				objDiv += "<layer id=\"x"+nestLayerID+"\" class=\""+ layerStyle +"\" Z-INDEX=7 BGCOLOR=\""+ menuColor +"\" WIDTH=" + eval(layerWidth - 10) + " LEFT=5 TOP="+ nestTop +" onmouseover=\"menuOver('document.layers[\\'"+ layerID +"\\'].document.layers[\\'x"+nestLayerID+"\\']')\" onmouseout=\"menuOut('document.layers[\\'"+ layerID +"\\'].document.layers[\\'x"+nestLayerID+"\\']')\"><a id=navstyle  href=javascript:gotoUrl('"+menuData[x][y][1]+"')><font color=" + fontColorOff + ">"+ menuData[x][y][0]
				objDiv +="</font></a></layer>"		
				nestLayerID=nestLayerID+1
				nestTop=nestTop+layerInc+1
							
				}
			
			}
		}
		//objDiv += "<layer id=\"line2\" BGCOLOR=\""+ lineColor +"\" WIDTH=" + eval(layerWidth - 10) + " LEFT=5 HEIGHT=1 Z-INDEX=8 TOP="+ nestTop +">"+ separator +"</layer>"
		objDiv +="<layer id=\"lineEnd\" BGCOLOR=\""+ menuColor +"\" WIDTH=" + layerWidth + " HEIGHT=8 Z-INDEX=7 TOP="+ nestTop +"></layer></layer>"

	document.write(objDiv)
}

// Netscape Resize Function for Layers

//function reDo(){window.location.reload()}
//function setResize(){setTimeout("window.onresize=reDo",500);}
//	if(br=="N"){
//	window.onload = setResize;
//}
/************************************************End of Drop Down Functions********************************************/

/************************************************EB Style Sheets Functions********************************************/

browser = navigator.appName;
  version = navigator.appVersion;
  os = navigator.platform;
  ie = "Microsoft Internet Explorer";
  nn = "Netscape";


// reload the window upon resize to fix a bug in Netscape 4.x
var br
if(navigator.appName == 'Netscape') {
	if(document.layers) {br="N"}
	else if(document.getElementById) {br="NS6"}
} else{br="IE";}
//alert("br = " + br);
function reDo(){window.location.reload()}
function setResize(){setTimeout("window.onresize=reDo",500);}
	if(br=="N"){
	window.onload = setResize;
}

//Mac fix
if(OSType == "Mac"){
	//document.body.topMargin = 10;
	window.onload = setResize;
}

/************************************************End of Style Sheets Functions********************************************/

/************************************************EB Data Holds the menu content********************************************/
menuData = new Array()
for (i=0; i < 10; i++) {
	menuData[i] = new Array(40)
	for (j=0; j < 20; j++) {
		menuData[i][j] = new Array(2)}}

menuData[1][0][0]="Clients";
menuData[1][0][1]="http://www.EverestGroup.com/index.html";
menuData[1][1][0]="News";
menuData[1][1][1]="http://www.EverestGroup.com/index.html";
menuData[1][2][0]="Partners";
menuData[1][2][1]="http://www.EverestGroup.com/index.html";
menuData[1][3][0]="Careers";
menuData[1][3][1]="http://www.EverestGroup.com/index.html";
menuData[1][4][0]="Events";
menuData[1][4][1]="http://www.EverestGroup.com/index.html";
menuData[1][5][0]="Investors";
menuData[1][5][1]="http://www.EverestGroup.com/index.html";

menuData[2][0][0]="Anti-Spam Filter";
menuData[2][0][1]="http://www.EverestGroup.com/spam.html";
menuData[2][1][0]="ARIBA Ready";
menuData[2][1][1]="http://www.EverestGroup.com/index.html";
menuData[2][2][0]="Opensource";
menuData[2][2][1]="http://www.EverestGroup.com/index.html";
menuData[2][3][0]="SAP";
menuData[2][3][1]="http://www.EverestGroup.com/index.html";
menuData[2][4][0]="MS Great Plains";
menuData[2][4][1]="http://www.EverestGroup.com/index.html";
menuData[2][5][0]="Marble from India";
menuData[2][5][1]="http://www.EverestGroup.com/marble.html";

menuData[3][0][0]="Software Development";
menuData[3][0][1]="http://www.EverestGroup.com/index.html";
menuData[3][1][0]="eGlobal";
menuData[3][1][1]="http://www.EverestGroup.com/multilingual.html";
menuData[3][2][0]="ERP Implementation";
menuData[3][2][1]="http://www.EverestGroup.com/index.html";
menuData[3][3][0]="Education";
menuData[3][3][1]="http://www.EverestGroup.com/index.html";
menuData[3][4][0]="Corporate Training";
menuData[3][4][1]="http://www.EverestGroup.com/index.html";
menuData[3][5][0]="DBA";
menuData[3][5][1]="http://www.EverestGroup.com/dba.html";

menuData[4][0][0]="Buying/Selling Homes";
menuData[4][0][1]="http://www.EverestGroup.com/index.html";
menuData[4][1][0]="Listing Homes";
menuData[4][1][1]="http://www.EverestGroup.com/index.html";
menuData[4][2][0]="Residential";
menuData[4][2][1]="http://www.EverestGroup.com/index.html";
menuData[4][3][0]="Commercial";
menuData[4][3][1]="http://www.EverestGroup.com/index.html";
menuData[4][4][0]="Leasing/Renting";
menuData[4][4][1]="http://www.EverestGroup.com/index.html";
menuData[4][5][0]="Relocation";
menuData[4][5][1]="http://www.EverestGroup.com/index.html";
menuData[4][6][0]="Foreclosures";
menuData[4][6][1]="http://www.EverestGroup.com/index.html";
menuData[4][7][0]="New Construction";
menuData[4][7][1]="http://www.EverestGroup.com/index.html";
menuData[4][8][0]="Online Selling";
menuData[4][8][1]="http://www.EverestGroup.com/index.html";


menuData[5][0][0]="Onsite Consulting";
menuData[5][0][1]="http://www.EverestGroup.com/index.html";
menuData[5][1][0]="Consultants Available";
menuData[5][1][1]="http://www.EverestGroup.com/index.html";
menuData[5][2][0]="Skills Required";
menuData[5][2][1]="http://www.EverestGroup.com/index.html";
menuData[5][3][0]="Referrals";
menuData[5][3][1]="http://www.EverestGroup.com/index.html";
menuData[5][4][0]="Offshore";
menuData[5][4][1]="http://www.EverestGroup.com/index.html";
menuData[5][5][0]="Support";
menuData[5][5][1]="http://www.EverestGroup.com/index.html";
menuData[5][6][0]="Fulltime hire";
menuData[5][6][1]="http://www.EverestGroup.com/index.html";
menuData[5][7][0]="PartnerLink";
menuData[5][7][1]="http://www.EverestGroup.com/index.html";

menuData[6][0][0]="Partners";
menuData[6][0][1]="http://www.EverestGroup.com/index.html";
menuData[6][1][0]="Cost Savings";
menuData[6][1][1]="http://www.EverestGroup.com/index.html";
menuData[6][2][0]="India Center";
menuData[6][2][1]="http://www.EverestGroup.com/index.html";
menuData[6][3][0]="Process Consulting";
menuData[6][3][1]="http://www.EverestGroup.com/index.html";
menuData[6][4][0]="BPO";
menuData[6][4][1]="http://www.EverestGroup.com/index.html";
menuData[6][5][0]="Software";
menuData[6][5][1]="http://www.EverestGroup.com/index.html";
menuData[6][6][0]="Medical Transcription";
menuData[6][6][1]="http://www.EverestGroup.com/index.html";
menuData[6][7][0]="Call Centers";
menuData[6][7][1]="http://www.EverestGroup.com/index.html";


/************************************************End of EB Data ************************************************************/

/************************************************EB Layers(NetScape)/Div(IE) ************************************************************/
if ("products"=="Home")
{
	if(br=="N")
	{
		doLayer('services',3,250,234,145)
		doLayer('realestate',4,367,234,145)
		doLayer('staffing',5,507,234,170)
		doLayer('offshore',6,667,234,135)
	}
	else 
	{

		if (OSType == "Mac")
		{
			doDiv('services',3,242,135,145)
			doDiv('realestate',4,359,135,145)
			doDiv('staffing',5,502,135,185)
			doDiv('offshore',6,648,135,135)
		}
		else
		{
			doDiv('services',3,250,226,145)
			doDiv('realestate',4,367,226,145)
			doDiv('staffing',5,510,226,185)
			doDiv('offshore',6,656,226,135)
		}
	}
}
else
{
	if(br=="N")
	{
		doLayer('services',3,250,173,145)
		doLayer('realestate',4,367,173,145)
		doLayer('staffing',5,512,173,170)
		doLayer('offshore',6,667,173,135)
	}
	else 
	{
		if (OSType == "Mac")
		{
			doDiv('services',3,242,155,145)
			doDiv('realestate',4,359,155,145)
			doDiv('staffing',5,502,155,185)
			doDiv('offshore',6,648,155,135)
		}
		else
		{

			doDiv('clients',1,10,83,135)
			doDiv('products',2,115,83,135)
			doDiv('services',3,220,83,145)
			doDiv('realestate',4,327,83,145)
			doDiv('staffing',5,432,83,185)
			doDiv('offshore',6,538,83,135)
		}
	}
}

var homeonsrc = "HomeOn.GIF";
var homeoffsrc = "HomeOff.GIF";
var servicesonsrc = "ServicesOn.GIF";
var servicesoffsrc = "ServicesOff.GIF";
var staffonsrc = "StaffOn.GIF";
var staffoffsrc = "StaffOff.GIF";
var realestateonsrc = "RealEstateOn.GIF";
var realestateoffsrc = "RealEstateOff.GIF";
var offshoreonsrc = "OffshoreOn.GIF";
var offshoreoffsrc = "OffshoreOff.GIF";
var productsonsrc = "ProductsOn.GIF";
var productsoffsrc = "ProductsOff.GIF";


function MenuToggle(MenuItem)
{
	//Home EverestGroup.com
	if(MenuItem == "home")
	{
		if (window.document.homeimg.src.indexOf("HomeOn.GIF") > -1)
		{
			window.document.homeimg.src = homeoffsrc;
		 }
		 else
		 {
			window.document.homeimg.src = homeonsrc;
		 }
	}
	
	//about EverestGroup.com
	if(MenuItem == "services")
	{
		if (window.document.servicesimg.src.indexOf("ServicesOn.GIF") > -1)
		{
			window.document.servicesimg.src = servicesoffsrc;
		 }
		 else
		 {
			window.document.servicesimg.src = servicesonsrc;
		 }
	}
	//staffing
	if(MenuItem == "staffing")
	{
		if (window.document.staffingimg.src.indexOf("StaffOn.GIF") > -1)
		{
			window.document.staffingimg.src = staffoffsrc;
		 }
		 else
		 {
			window.document.staffingimg.src = staffonsrc;
		 }
	}
	//Business Products
	if(MenuItem == "realestate")
	{
		if (window.document.realestateimg.src.indexOf("RealEstateOn.GIF") > -1)
		{
			window.document.realestateimg.src = realestateoffsrc;
		 }
		 else
		 {
			window.document.realestateimg.src = realestateonsrc;
		 }
	}
	//offshore
	if(MenuItem == "offshore")
	{
		if (window.document.offshoreimg.src.indexOf("OffshoreOn.GIF") > -1)
		{
			window.document.offshoreimg.src = offshoreoffsrc;
		 }
		 else
		 {
			window.document.offshoreimg.src = offshoreonsrc;
		 }
	}
	//products EverestGroup.com
	if(MenuItem == "products")
	{
		if (window.document.productsimg.src.indexOf("ProductsOn.GIF") > -1)
		{
			window.document.productsimg.src = productsoffsrc;
		 }
		 else
		 {
			window.document.productsimg.src = productsonsrc;
		 }
	}
}
/********************************************End of EB Layers(NetScape)/Div(IE)**************************************************/
