// JavaScript Document

// Hide Flash Ad
var browserType;

if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
   browserType= "gecko"
}

function closeAd(div) {
  if (browserType == "gecko" )
     document.poppedLayer = 
         eval('document.getElementById(div)');
  else if (browserType == "ie")
     document.poppedLayer = 
        eval('document.getElementById(div)');
  else
     document.poppedLayer =   
        eval('document.layers[div]');
  document.poppedLayer.style.visibility = "hidden";
}

// Centered Popup
var win = null;
function NewWindow(mypage,myname,w,h){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height=' + h + ',width=' + w + ',top=' + TopPosition + ',left=' + LeftPosition + ',status=no, menubar=no, resizable=no, scrollbars=no, toolbar=no, location=no, directories=no';
	win = window.open(mypage,myname,settings)
}

// Merch
l=1;
z=1; 
function merchSwap(id){
	imgID = id + "_img";
	if(l==1){ 
		imgsrc = id + "_back.png";
		l=2;
		z=1;
	}else{
		imgsrc = id + "_front.png";
		l=1;
		z=1;
	}
	document[imgID].src = "images/merch/" + imgsrc;
}

function zoom(id){
	imgID = id + "_img";
	if(l==1){ // If front image is visible
		if(z == 1){ // If image is not zoom view
			imgsrc = id + "_front-zoom.png";
			z=2;
		}else{ // If image is in zoom view
			imgsrc = id + "_front.png";
			z=1
		}
		
	}else{ // If back image is visible
		if(z == 1){ // If image is not zoom view
			imgsrc = id + "_back-zoom.png";
			z=2;
		}else{ // If image is in zoom view
			imgsrc = id + "_back.png";
			z=1
		};
	}
	document[imgID].src = "images/merch/" + imgsrc;
}

// Control page height
function changeHt(){
	if(document.getElementById){
		var mainh = document.getElementById('main').offsetHeight;
		if(mainh >= 670){
			document.getElementById('container').style.height = mainh + 200 + "px";
			document.getElementById('left').style.height = mainh + "px";
		}else {
			document.getElementById('container').style.height = "886px";
			document.getElementById('left').style.height = "557px";
			document.getElementById('main').style.height = "685px";
		}
	}
}

// Control map height
function mapHt(){
	if(document.getElementById){
		var mapnav_ht = document.getElementById('map_nav').offsetHeight;
		document.getElementById('map').style.height = mapnav_ht + "px";
	}
}

function toggleDiv(id){
	if(document.getElementById){
		var div = document.getElementById(id).style.display;
		if(div=="none"){
			 document.getElementById(id).style.display = "block";
		}else{
			document.getElementById(id).style.display = "none";
		}
	}
}