//*---------------------------------------------------
// shows the drop down menu 
// expected arg is active div
//--------------------------------------------------*/
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 
// expected arg is active div 
//--------------------------------------------------*/
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
// expected arg is active menu
//--------------------------------------------------*/
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
// expected arg is active menuitem
//--------------------------------------------------*/
function divOver(){
	args = divOver.arguments;
	if(br=="N"){}
	else if(br=="IE"){
		theObj=eval(args[0]);
		if(theObj.style.backgroundColor="#32345A"){
			theObj.style.backgroundColor="#5F6099";
		}
	}
	else{return}
}

//*---------------------------------------------------
// highlight off menuitem
// expected arg is active menuitem
//--------------------------------------------------*/
function divOut(){
	args = divOut.arguments;
	if(br=="N"){}
	else if(br=="IE"){
	theObj=eval(args[0]);
		if(theObj.style.backgroundColor="#5F6099"){
			theObj.style.backgroundColor="#32345A";
		}
	}
	else{return}
}

//*---------------------------------------------------
// highlight on menuitem in netscape
// expected arg is active menuitem
//--------------------------------------------------*/
function menuOver(){
	var args, theMenu;
	args = menuOver.arguments;
	theMenu = eval(args[0]);
	theMenu.bgColor="#5F6099"
}

//*---------------------------------------------------
// highlight off menuitem in netscape
// expected arg is active menuitem
//--------------------------------------------------*/
function menuOut(){
	var args, theMenu;
	args = menuOut.arguments;
	theMenu = eval(args[0]);
	theMenu.bgColor="#32345A"
}

//*---------------------------------------------------
// goes to specified url
// expected arg is url 
//--------------------------------------------------*/
function gotoUrl(){
	args = gotoUrl.arguments;
	// open url in the same window
	location.href=args[0]
	// open url in a new window ----	window.open (args[0]);
}

//*---------------------------------------------------
// hides specified tag
//--------------------------------------------------*/
function hideElement(HTMLtag)
{
	for (i = 1; 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
// expected args are 'div name','x in menudata aray',
// 'menu left coord','arrow alignment','top in pixels' 
//--------------------------------------------------*/
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:120px; z-index:50; background-color:#32345A; visibility:hidden; padding-left:0; margin-left:10; border-color: #000000; border-style: solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px\" onMouseover=\"showDDNav('document.all[\\'"+ divID +"\\']')\"  onMouseout=\"hideDiv('document.all[\\'" + divID + "\\']')\">"
	//objDiv += "<div id=\"arrow\" style=\"position:relative; background-color:#325696; width:120px;\"><img src=/culimages/arrow.gif width=19 height=16 align="+ arrowPos +"></div>"
	
	for (y = 0; y < 17; y++){
	    if(menuData[x][y][0]!=null){
		objDiv += "<div id=\"line\" style=\"position:relative; background-color:#32345A; width:120px;\"><img src=/culimages/nav_spacer.gif width=120 height=2></div>";
		objDiv += "<div id=\"x" + tdID + "\" style=\"position:relative; background-color:#32345A; width:120px;\" onMouseover=\"divOver('document.all[\\'x" + tdID + "\\']')\" onMouseout=\"divOut('document.all[\\'x" + tdID + "\\']')\"><span class=\"nav\" onClick=\"gotoUrl('"+menuData[x][y][1]+"')\"><font color=#FFFFFF>"+ menuData[x][y][0] +"&nbsp;</font></span></div>"
		tdID = tdID +1
		}
	}
	
	objDiv +="<div id=\"line\" style=\"position:relative; background-color:#32345A; width:120px; height:0px;\"><img src=/culimages/nav_bottom.gif width=120 height=1></div></div>"
	
	document.write(objDiv);
}

//*---------------------------------------------------
// build the layers for netscape
// expected args are 'div name','x in menudata aray',
// 'menu left coord','arrow alignment','top in pixels' 
//--------------------------------------------------*/
function doLayer(){
	args = doLayer.arguments;
	var nestLayerID=0
	var layerID = args[0];
	var x = args[1];
	var layerLeft = args[2];
	var arrowPos = args[3];
	var layerTop = args[4];

	if(navigator.platform.indexOf("Win") < 0){layerInc=16;layerStyle="netMenuMac";}
	else{layerInc=19;layerStyle="netMenu";}	
		
	objDiv = "<layer id=\""+ layerID +"\" Z-INDEX=1 BGCOLOR=\"#32345A\" WIDTH=120 LEFT="+ layerLeft +" TOP="+ layerTop +" VISIBILITY=HIDE onmouseover=\"showDDNav('','document.layers[\\'"+ layerID +"\\']')\" onmouseout=\"hideDDNav('','document.layers[\\'"+ layerID +"\\']')\">"
	//objDiv +="<layer id=\"arrow\" BGCOLOR=\"#325696\" WIDTH=120 HEIGHT=10 Z-INDEX=5 TOP=0><img src=/culimages/arrow.gif width=19 height=16 hspace=3 align="+ arrowPos +"></layer>"
	objDiv +="<layer id=\"line\" BGCOLOR=\"#32345A\" WIDTH=120 HEIGHT=2 Z-INDEX=7 TOP=19><center><img src=/nav_spacer.gif width=120 height=2></center></layer>"
	
	var nestTop=21
		for (y = 0; y < 17; y++){
		    if(menuData[x][y][0]!=null){
			
	objDiv += "<layer id=\"x"+nestLayerID+"\" CLIP=\"1,0,120,20\" class=\""+ layerStyle +"\" Z-INDEX=7 BGCOLOR=\"#32345A\" HEIGHT=21 WIDTH=120 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=\"#32345A\" WIDTH=120 HEIGHT=2 Z-INDEX=7 TOP="+ nestTop +"><center><img src=/culimages/nav_spacer.gif width=120 height=2></center></layer>"
	nestTop=nestTop+2
			}
		}
	objDiv +="<layer id=\"lineEnd\" BGCOLOR=\"#32345A\" WIDTH=120 HEIGHT=8 Z-INDEX=7 TOP="+ nestTop +"></layer></layer>"

	document.write(objDiv)
}

// Java script

function formHandler(form){
	var URL = document.form.site.options[document.form.site.selectedIndex].value;
	window.location.href = URL;
}

offMessage = "Move your mouse over the menu items for details."
function boxOn(which,message) {
	if (document.all||document.getElementById) {
	which.className = 'BorderOn';
	if (document.getElementById) {
	document.getElementById("Message").innerHTML = message
	}
	else {
	Message.innerHTML = message;
		  }
	   }
}

function boxOff(which) {
	if (document.all||document.getElementById) {
	which.className = 'BorderOff';
	if (document.getElementById) {
	document.getElementById("Message").innerHTML = offMessage
	}
	else {
	Message.innerHTML = offMessage;
		  }
	   }
}

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}

if(br=="N"){
	doLayer('TopMenu1',0,144,'left',38)
	doLayer('TopMenu2',1,239,'left',38)
	doLayer('TopMenu3',2,334,'left',38)
	doLayer('TopMenu4',3,429,'left',38)
	doLayer('TopMenu5',4,524,'left',38)
	doLayer('ChangeLang',5,132,'left',54)
}
else if(br=="IE"){
	doDiv('TopMenu1',0,144,'left',41)
	doDiv('TopMenu2',1,239,'left',41)
	doDiv('TopMenu3',2,334,'left',41)
	doDiv('TopMenu4',3,429,'left',41)
	doDiv('TopMenu5',4,524,'left',41)
	doDiv('ChangeLang',5,132,'left',57)
}
else{}

function NewWin(theURL,winName,features) {newWindow = window.open(theURL,winName,features);}

function trim ( s2 ) {
	return s2.replace(/^\s+/, "").replace(/\s+$/, "");
}

function validate() {
	var a = trim(document.form1.q.value);
	
	if (a == "") {
				 alert("Please enter a query");
				 return (false);
				  }
}

function validate2() {
	var b = trim(document.form2.q.value);
	if (b == "") {
				 alert("Please enter a query");
				 return (false);
				  }
}

function PopUp(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


// show copy right
function currentyear(){
var thisyear=new Date;
document.write('-'+thisyear.getFullYear());
}

// show pop up window
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
