// shows the drop down menu 

function showDDNav(){
	args = showDDNav.arguments;
	if(br=="N"){
		var args, theObj;
		args = showDDNav.arguments;
		theObj = eval(args[1]);
  		if (theObj) if(theObj.visibility=='hide'){theObj.visibility = 'show';}
	}
	else if(br=="IE"){
		theObj=eval(args[0]);
		if (theObj) if(theObj.style.visibility=='hidden'){hideElement('SELECT');theObj.style.visibility = 'visible'}
		}
	else{return}
}


// hides the drop down menu 

function hideDDNav(){
	args = hideDDNav.arguments;
	if(br=="N"){
		var args, theObj;
		args = hideDDNav.arguments;
		theObj = eval(args[1]);
		if (theObj) if(theObj.visibility=='show'){theObj.visibility = 'hide';}
	}
	else if(br=="IE"){
		theObj=eval(args[0]);
		if (theObj) if(theObj.style.visibility=='visible'){showElement('SELECT');theObj.style.visibility = 'hidden'}
		}
	else{return}
}


// hides drop down menu when menu is active

function hideDiv(){
	args = hideDiv.arguments;
	if(br=="N"){}
	else if(br=="IE"){
		theObj=eval(args[0]);
		// calculate active size of menu
		leftDiv=theObj.offsetLeft +2
		rightDiv=theObj.offsetLeft + theObj.clientWidth -2
		topDiv=theObj.offsetTop +2
		bottomDiv=theObj.offsetTop + theObj.clientHeight -2
		if(window.event.clientY > bottomDiv || 
			window.event.clientY < topDiv || 
			window.event.clientX < leftDiv || 
			window.event.clientX > rightDiv)
			{theObj.style.visibility = 'hidden';showElement('SELECT');}				
		}
	else{return}
}


// highlight menuitem

function divOver(){
	args = divOver.arguments;
	if(br=="N"){}
	else if(br=="IE"){
		theObj=eval(args[0]);
		if(theObj.style.backgroundColor="#941000"){
			theObj.style.backgroundColor="#371450";
		}
	}
	else{return}
}

// highlight off menuitem

function divOut(){
	args = divOut.arguments;
	if(br=="N"){}
	else if(br=="IE"){
	theObj=eval(args[0]);
		if(theObj.style.backgroundColor="#004474"){
			theObj.style.backgroundColor="#2C45A2";
		}
	}
	else{return}
}


// highlight on menuitem in netscape

function menuOver(){
	var args, theMenu;
	args = menuOver.arguments;
	theMenu = eval(args[0]);
	theMenu.bgColor="#004474" 
}


// highlight off menuitem in netscape

function menuOut(){
	var args, theMenu;
	args = menuOut.arguments;
	theMenu = eval(args[0]);
	theMenu.bgColor="#2C45A2" 
}

// goes to specified url

function gotoUrl(){
	args = gotoUrl.arguments;
	location.href=args[0]
}


// hides specified tag

function hideElement(HTMLtag)
{
	for (i = 20; 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

var tdID = 0
function doDiv(){
	args = doDiv.arguments;
	var divID = args[0];
	var x = args[1];
	var divLeft = args[2];
	var arrowPos = args[3];
	var divTop = args[4];
	
	objDiv = "<div id=\"" + divID + "\" style=\"position:absolute; left:"+ divLeft +"px; top:"+ divTop +"px; width:160px; z-index:300; background-color:#183482; visibility:hidden; padding-left:2;\" onMouseover=\"showDDNav('document.all[\\'"+ divID +"\\']')\"  onMouseout=\"hideDiv('document.all[\\'" + divID + "\\']')\">"
	objDiv += "<div id=\"arrow\" style=\"position:relative; background-color:#183482; width:160px;\"><img src=images/navspace.gif width=1 height=1 align="+ arrowPos +"></div>"
	
	for (y = 0; y < 10; y++){
	    if(menuData[x][y][0]!=null){
		objDiv += "<div id=\"line\" style=\"position:relative; background-color:#021A2A; width:6px;\"><img src=images/navbar.gif width=160 height=2></div>";
		objDiv += "<div id=\"x" + tdID + "\" style=\"position:relative; background-color:#2C45A2; width:160px;\" onMouseover=\"divOver('document.all[\\'x" + tdID + "\\']')\" onMouseout=\"divOut('document.all[\\'x" + tdID + "\\']')\"><span class=\"nav\" onClick=\"gotoUrl('"+menuData[x][y][1]+"')\">"+ menuData[x][y][0] +"&nbsp;</span></div>"
		tdID = tdID +1
		}
	}
	
	objDiv +="<div id=\"line\" style=\"position:relative; background-color:#183482; width:160px; height:5px;\"><img src=images/navbar.gif width=162 height=2></div></div>"
	
	document.write(objDiv);
}


// build the layers for netscape

function doLayer(){
	args = doLayer.arguments;
	var nestLayerID=0
	var layerID = args[0];
	var x = args[1];
	var layerLeft = args[2];
	var layerTop = args[4];

	if(navigator.platform.indexOf("Win") < 0){layerInc=15;layerStyle="navMenu";}
	else{layerInc=22;layerStyle="navMenu";}	
		
	objDiv = "<layer id=\""+ layerID +"\" Z-INDEX=100 BGCOLOR=\"#183482\" width=160 LEFT="+ layerLeft +" TOP="+ layerTop +" VISIBILITY=HIDE onmouseover=\"showDDNav('','document.layers[\\'"+ layerID +"\\']')\" onmouseout=\"hideDDNav('','document.layers[\\'"+ layerID +"\\']')\">"
	objDiv +="<layer id=\"line\" BGCOLOR=\"#183482\" width=160 HEIGHT=4 Z-INDEX=700><center><img src=images/navbar.gif width=162 height=2></center></layer>"
	
	var nestTop=3
		for (y = 0; y < 10; y++){
		    if(menuData[x][y][0]!=null){
			
	objDiv += "<layer id=\"x"+nestLayerID+"\" CLIP=\"2,0,147,22\" class=\""+ layerStyle +"\" Z-INDEX=700 BGCOLOR=\"#2C45A2\" HEIGHT=21 width=160 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=#FFFFFF>"+ menuData[x][y][0]
	objDiv +="</font></a></layer>"		

	nestLayerID=nestLayerID+1
	nestTop=nestTop+layerInc
	objDiv +="<layer id=\"line2\" BGCOLOR=\"#183482\" width=160 HEIGHT=5 Z-INDEX=700 TOP="+ nestTop +"><center><img src=images/navbar.gif width=162 height=2></center></layer>"
	nestTop=nestTop+2
			}
		}
	objDiv +="<layer id=\"lineEnd\" BGCOLOR=\"#183482\" width=160 HEIGHT=4 Z-INDEX=700 TOP="+ nestTop +"></layer></layer>"

	document.write(objDiv)
}


// Modified by Manish 04/13/07 START
// SET BROWSERS
//var br
//if(navigator.appName == 'Netscape' && document.layers != null){br="N";}
//else if(navigator.appName == 'Microsoft Internet Explorer' && document.all != null){br="IE";}
//else{br=null}

var br
if(((navigator.userAgent.indexOf("Netscape") != -1) || (navigator.userAgent.indexOf("Firefox") != -1) || (navigator.userAgent.indexOf("Gecko") != -1)) && document.layers != null){br="N";}
else if(navigator.appName == 'Microsoft Internet Explorer' && document.all != null){br="IE";}
else{br=null}
// Modified by Manish 04/13/07 END

// DECLARE ARRAYS
menuData = new Array()
for (i=0; i < 9; i++) {
	menuData[i] = new Array(40)
	for (j=0; j < 20; j++) {menuData[i][j] = new Array(2)}}

// SECTION01 - HOME
menuData[0][0][0]="&nbsp;Home";
menuData[0][0][1]="index.htm";
menuData[0][1][0]="&nbsp;Site Map";
menuData[0][1][1]="sitemap.htm";

// SECTION02 - THE CHAMBER
menuData[1][0][0]="&nbsp;Mission";
menuData[1][0][1]="chamber_mission.htm";
menuData[1][1][0]="&nbsp;History";
menuData[1][1][1]="chamber_history.htm";
menuData[1][2][0]="&nbsp;Corporate Partners";
menuData[1][2][1]="chamber_partners.htm";
menuData[1][3][0]="&nbsp;Corporate Sponsors";
menuData[1][3][1]="chamber_sponsors.htm";
menuData[1][4][0]="&nbsp;Advertisers";
menuData[1][4][1]="chamber_advertise.htm";;
menuData[1][5][0]="&nbsp;Committees";
menuData[1][5][1]="chamber_committees.htm";

// SECTION03 - PERSONNEL
menuData[2][0][0]="&nbsp;Board of Directors";
menuData[2][0][1]="personnel_bod.php";
menuData[2][1][0]="&nbsp;Committee Chairs";
menuData[2][1][1]="personnel_cc.php";
menuData[2][2][0]="&nbsp;Office Staff";
menuData[2][2][1]="personnel_sta.php";

// SECTION04 - JOIN US
menuData[3][0][0]="&nbsp;Benefits";
menuData[3][0][1]="join_benefits.htm";
menuData[3][1][0]="&nbsp;Application";
menuData[3][1][1]="join_application.htm";
menuData[3][2][0]="&nbsp;Fee Schedule";
menuData[3][2][1]="join_fees.htm";
menuData[3][3][0]="&nbsp;Referral Program";
menuData[3][3][1]="join_referral.htm";

// SECTION05 - DIRECTORY
//menuData[4][0][0]="&nbsp;Membership Directory";
//menuData[4][0][1]="directory.htm";
//menuData[4][1][0]="&nbsp;Member LOGIN";
//menuData[4][1][1]="membersonly.php";

// SECTION06 - CALENDAR/NEWS
menuData[5][0][0]="&nbsp;Calendar";
menuData[5][0][1]="calendar.php";
menuData[5][1][0]="&nbsp;Newsletter";
menuData[5][1][1]="newsletter.php";

// SECTION07 - CONTACT

// SECTION08 - LINKS

// SET DROPDOWN POSITION FOR BROWSERS
if(br=="N"){
	doLayer('section01',0,0,'left',82)
	doLayer('section02',1,60,'left',82)
	doLayer('section03',2,170,'left',82)
	doLayer('section04',3,266,'left',82)
	doLayer('section05',4,346,'left',82)
	doLayer('section06',5,446,'right',82)
	doLayer('section07',6,492,'right',82)
	doLayer('section08',7,554,'right',82)
}
else if(br=="IE"){
	doDiv('section01',0,0,'left',82)
	doDiv('section02',1,62,'left',82)
	doDiv('section03',2,172,'left',82)
	doDiv('section04',3,268,'left',82)
	doDiv('section05',4,348,'left',82)
	doDiv('section06',5,448,'left',82)
	doDiv('section07',6,494,'left',82)
	doDiv('section08',7,556,'left',82)
}
else{}
