var gecko = (navigator.product == ('Gecko'))
var activeID, activeMenu, activeLink;
var ie = (document.all)? true:false;

var ssVisible = false;
var noHide = false;
function swapImage(imgName,swapSrc, drop) {
	eval("document." + imgName + ".src = \"" + swapSrc + ".gif\"");
}
// onBlur set default value of search input
function setSearchText(ref) {
	if(ref.value == "") {
		ref.value = "Search";
	}
}

function setStateSelect() {
	sss = document.getElementById('state_list');
	if(!ssVisible) {
		sss.style.display = "block";
		ssVisible = true;
	} else if(!noHide) {		
		sss.style.display = "none";
		ssVisible = false;
	}
}


var popWin;
rightOffset = [412, 360, 293, 212, 146, 139];

function showMenu(theLink, menuName, num) {
	var menuObj = document.getElementById(menuName);
	if (activeID) {
		clearTimeout(activeID);
		hideMenu(activeMenu);
	}
	activeLink = theLink;
	activeLink.className = "hover";
	var winW = (gecko)? window.innerWidth-16 : document.body.offsetWidth-20;
	menuObj.style.top = '75px';
	if(gecko) {
		if((winW-theLink.offsetLeft) < 100) {
			menuObj.style.left = (theLink.offsetLeft - 78) + 'px';
		} else {
			menuObj.style.left = (theLink.offsetLeft + 1) + 'px';
		}
	} else {
		menuObj.style.left = (winW-rightOffset[num]) + 'px';
	}
		menuObj.style.display = "block";
}

function startHide(menuName) {
	activeMenu = menuName
	
	activeID = setTimeout("hideMenu('" + menuName + "')", 360);
	
}

function hideMenu(menuName) {
	var menuImg = menuName.substr(4, menuName.length);
                     if (menuImg) {
  	    var swapSource = menuImg.toLowerCase();
                     }
	/*
	if(swapSource != jssection) {
		swapImage(swapSource, swapSource+'_off');
	}*/
	var menuObj = document.getElementById(menuName);
                      if (activeLink) {
	    activeLink.className = "";
                      }
                      if (menuObj) {
	    menuObj.style.display = "none";
                      }
}


function launchBrandedPlayer(which) {
var nwin = window.open(which, "player", "width=540, height=370, toolbars=0, scrollbars=0, resize=0");
}

function launchFlashPlayer(which) {
var nwin = window.open(which, "player", "width=640, height=480, toolbars=0, scrollbars=0, resize=0");
}

function launchFlashPlayer2(which) {
var nwin = window.open(which, "player", "width=666, height=480, toolbars=0, scrollbars=0, resize=0");
}


function launchFlashPlayer3(which) {
var nwin = window.open(which, "player", "width=426, height=320, toolbars=0, scrollbars=0, resize=0");
}

function launchPlayer(which) {
	var nwin = window.open(which, "player", "width=340, height=260, toolbars=0, scrollbars=0, resize=0");
}