userAgent = navigator.userAgent.toLowerCase();
n4 = document.layers;
ieWin = (document.all && userAgent.indexOf("mac")<0);
ieMac = (document.all && !ieWin &&
  userAgent.indexOf("icab")<0);
w3c = document.documentElement;
aol = (userAgent.indexOf("aol")>-1);
lastImgNumber = 0;
navFrameId = 'navframe';
isInNavArea = false;

function highlightNav(navImgId) {
	isInNavArea = true;
	var imgNumber = parseInt(navImgId.charAt(3));	
	moveVerticallyTo(navFrameId,imgNumber);	
	show(navFrameId);
}

function deactivateNav() {
	isInNavArea = false;
	setTimeout('restoreOrHideNav()',300);
	//restoreOrHideNav();
}

function restoreOrHideNav() {
	/*if (lastImgNumber > 0) {
		if (isInNavArea == false) {
			moveVerticallyTo(navFrameId,lastImgNumber);
			isInNavArea = false;
		}
	} else {*/
		if (isInNavArea == false) {
			hide(navFrameId);
		}
	//}
	
}

function show(id) {		
   	if (n4)
    	document.layers[id].visibility = "show";
   	else if (ieWin || ieMac)
    	document.all[id].style.visibility = "visible";
	else if (w3c) {
    	document.getElementById(id).style.setProperty("visibility", "visible");	
	}
}

function hide(id) {
   	if (n4)
    	document.layers[id].visibility = "hide";
   	else if (ieWin || ieMac)
    	document.all[id].style.visibility = "hidden";
	else if (w3c)
    	document.getElementById(id).style.visibility = "hidden";	
}

function moveVerticallyTo(id, imgNumber) {
	var pos = 166 + (imgNumber*24);
	if (n4) {
    	document.layers[id].top = pos;
   	}
	else if (ieWin || ieMac) {
		document.all[id].style.top = pos;
	}
	else if (w3c) {
		document.geElementById(id).style.setProperty("top", pos);
	}
}

function openRouteDesc(url) {
	routeWin = window.open(url, "routeWin", "top=200, left=200, width=511, height=354, menubar=no, resizeable=no, toolbar=no, status=no, location=no, scrollbars=no");
	routeWin.moveTo((screen.width/2)-255,(screen.height/2)-177);
	routeWin.focus();
}
function printCoupon() {
	imagePath = window.location.search.substring(window.location.search.indexOf('=') + 1, window.location.search.length);
	var couponImage = new Image();	
	couponImage.src = imagePath;
	if (ieWin || ieMac) {	
		document.images['couponImage'].src = couponImage.src;
	} else {
		document.getElementById('couponImage').src = couponImage.src;
	}
	this.setTimeout('window.print()', 1000);
}
function openCouponWindow(url) {
	couponWindow = window.open(url, 'coupon_print_window', 'width=334,height=144');
	couponWindow.focus();
}