	
function mainNav(url){
	if( (url != null) && (url != "") ){
		window.location = url;
	}
}

function GenericPopup(sURL, nWidth, nHeight){
	var nLeft = parseInt(window.screenLeft);
			
	// Set height and width
	var NewWinWidth=parseInt(nWidth);
	var NewWinHeight=parseInt(nHeight);
			
	var nWinleft = 0;
	var nWintop = ( (screen.availHeight/2)-(parseInt(NewWinHeight/2)) ) ;
			
	var screenWidth;
			
	switch(screen.height){
		case 600:
			screenWidth = 800;	
		break;
				
		case 768:
			screenWidth = 1024;	
		break;
				
		case 1024:
			screenWidth = 1280;	
		break;
				
		default:
			screenWidth = 0;
		break;	
	}
			
	if(nLeft >= screenWidth){
		nWinleft = screenWidth;
		nWinleft += nWinleft/2;
		nWinleft -= (parseInt(NewWinWidth/2));
	}else{
		nWinleft = (screenWidth/2);
		nWinleft -= (parseInt(NewWinWidth/2));
	}
			
			
	var d = new Date();
	window.open(sURL,d.getSeconds(),"fullscreen=no, resizeable=yes, scrollbars=yes, Width=" + NewWinWidth + ",Height=" + NewWinHeight + ",Left=" + nWinleft + ",Top=" + nWintop );

}

function dlPDF(pdf){
	
	if( navigator.platform == "Win32" ){
		dlframe.location= ('script/download.handler.asp?pdf=' + pdf);
	}
	else
	{
		path = "pdf/" + pdf;		
		GenericPopup(path, 700, 550);
	}
			
}

	var buttonUp = "images/button_left_0.jpg";
	var buttonOver = "images/button_left_1.jpg";
	var gaPageImages = new Array();

function changePage(url){
	document.forms["cForm"].sPage.value = url;
	document.forms["cForm"].submit();
}	

function DisplayTime(){
	var d = new Date();
	var hour = d.getHours();
	var mode;
	
	if( hour > 12 ){
		hour-=12;
		mode = "PM";
	}else if( hour == 12 ){
		mode = "PM";
	}else if( hour == 0 ){
		hour = 12;
		mode = "AM";
	}else{
		mode = "AM";
	}
	
	var minute = d.getMinutes();
		minute=((minute < 10) ? "0" : "") + minute;
	
	var clock = hour + ":" + minute + " " + mode;
	
	document.getElementById("pageTime").innerHTML = clock;
	pageClock = setTimeout("DisplayTime()",60000);
	
}

function navigate(who){
	try{
		img = who.attributes["img"].value;
		page = who.attributes["page"].value;
	}catch(e){
		page = who.page;
		img = who.img;
	}
	
	if( (img!=null) && (page!=null) ){
		document.getElementById("pageTitleImage").src = img;
		document.getElementById("contentDisplay").src = page;
	}
}

function buttonAction(who, action){
			
	switch(action){
		case "over":
			button = who.childNodes[0].childNodes[0];
			if(!button)
				button = who.childNodes[1].childNodes[0];
			button.src = buttonOver;
		break;
		
		case "out":
			button = who.childNodes[0].childNodes[0];
			if(!button)
				button = who.childNodes[1].childNodes[0];
			button.src = buttonUp;
		break;
		
		case "down":
			image = who.childNodes[0].src;
			image = image.substr(0, image.length-5) + "1.jpg";
			who.childNodes[0].src = image;
			who.childNodes[0].down = true;
		break;
		
		case "up":
			image = who.childNodes[0].src;
			image = image.substr(0, image.length-5) + "0.jpg";
			who.childNodes[0].src = image;
			who.childNodes[0].down = false;
		break;
	}
}

 function textAction(who, action){
	switch(who.className){
		case "bottommenu":
			switch(action){
				case "over":
					who.style.color = '#888888';
				break;
		
				case "out":
					who.style.color = '#BBBBBB';
				break;
		
				case "down":
					if( who.page != null ){
						document.getElementById('contentDisplay').src= who.page;
					}
				break;
			}
		break;
		
		case "topmenu":
			switch(action){
				case "over":
					who.style.color = '#336633';
				break;
		
				case "out":
					who.style.color = '#888888';
				break;
		
				case "down":
					if( who.page != null ){
						document.getElementById('contentDisplay').src= who.page;
					}
				break;
			}
		break;
	}
 
 }
 
 function goSearch(who){
	//contentDisplay.location = "_search.asp";
	return false;
 }
 
function preloadImages(){
	var aImageArray = new Array("images/button_0_0.jpg",
								"images/button_0_1.jpg",
								"images/button_1_0.jpg",
								"images/button_1_1.jpg",
								"images/button_2_0.jpg",
								"images/button_2_1.jpg",
								"images/button_3_0.jpg",
								"images/button_3_1.jpg",
								"images/button_4_0.jpg",
								"images/button_4_1.jpg",
								"images/button_5_0.jpg",
								"images/button_5_1.jpg",
								"images/button_left_0.jpg",
								"images/button_left_1.jpg",
								"images/title_contact.jpg",
								"images/title_corporate.JPG",
								"images/title_gallery.jpg",
								"images/title_guides.jpg",
								"images/title_help.jpg",
								"images/title_home.jpg",
								"images/title_legal.jpg",
								"images/title_upload.jpg",
								"images/title_news.jpg");
	for(i in aImageArray ){
		gaPageImages[i] = new Image();
		gaPageImages[i].src = aImageArray[i];
	}
 }

