
// browser detection
isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE6 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

// correctly handle PNG transparency in Win IE 5.5 or higher.
function fixPNG(myImage) { 
	if (isIE6) {
		var imgID = (myImage.id) ? "id='" + myImage.id + "' " : "";
		var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : "";
		var imgTitle = (myImage.title) ? "title='" + myImage.title + "' " : "title='" + myImage.alt + "' ";
		var imgStyle = "display:inline-block;" + myImage.style.cssText;
		var strNewHTML = "<span " + imgID + imgClass + imgTitle;
		strNewHTML += " style=\"" + "width:" + myImage.width + "px; height:" + myImage.height + "px;" + imgStyle + ";";
		strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader";
		strNewHTML += "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>";
		myImage.outerHTML = strNewHTML;
	}
}

//  show layer function

var menuTimer;
var menuTimeout;
var currentMenu;


function menuOn(menuName) {
	var theMenu;

	if (menuTimeout) { clearTimeout(menuTimeout); }	// clear the timeout

	if (currentMenu) {			// hide the current menu
		theMenu = document.getElementById(currentMenu);
		theMenu.style.visibility = "hidden";
	}
	currentMenu = menuName;
	theMenu = document.getElementById(currentMenu);
	theMenu.style.visibility = "visible";				// display menuName
}



// Hides the dropdown menus
// inputs: menuName - name of the menu DIV layer without the Div.  ie. vehicles
// outputs: none
function menuOff(menuName) {
	if (menuTimeout) clearTimeout(menuTimeout)	// clear the current timeout
	menuTimeout = setTimeout('document.getElementById("' + menuName + '").style.visibility = "hidden"', 500);		// set the new timeout
}

// page redirect function for onClicks

function goThere(url) {
	document.location = url;
}

// arrays for the drop-down menus.  the values need to obviously
// be in quotes. each array value contain 2 pieces of info separated 
// by a pipe "|". The first piece is the item label.  the second is 
// the url that the drop item links to.

var ourTeamSubArray = new Array("Howard Lederer|/howardLederer.php","Phil Ivey|/philIvey.php","Chris Ferguson|/chrisFerguson.php","John Juanda|/johnJuanda.php","Jennifer Harman|/jenniferHarman.php","Phil Gordon|/philGordon.php","Erick Lindgren|/erickLindgren.php","Erik Seidel|/erikSeidel.php","Clonie Gowen|/clonieGowen.php","Andy Bloch|/andyBloch.php","Commercials|/commercials.php","Tips From The Pros|/proLessons.php");
var howToPlaySubArray = new Array("Our Software|/lobby.php","Poker Games|/pokerGames.php","Tournaments|/tournaments.php","Hand Rankings|/handRankHigh.php","Site Rules|/siteRules.php","Glossary|/glossary.php","Tips From The Pros|/proLessons.php");
var realMoneySubArray = new Array("Full Tilt Points|/fullTiltPoints.php","Payment Processing|/payProcess.php","Security|/security.php","Rake|/rake.php","Money Transfers|/transfers.php");
var newsPromosSubArray = new Array("WSOP Updates|/online-poker-news/","Full Tilt Poker News|/news.php","Promotions|/promotions.php");

// dynamically build the glbal drop-downs
function buildDropDownItems(dropDownName) {
	var arrayName = eval(dropDownName + "Array");  // read the array
	var arrayLength = arrayName.length;  // determine it's length
	var cssClassName = "navItemRowDk"; // set default css class
	// start writing the HTML
	document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="152">');
	document.writeln('<tr>');
	document.writeln('<td width="152" height="15" bgcolor="#FFFFFF" colspan="7"></td>');
	document.writeln('</tr>');
	document.writeln('<tr>');
	document.writeln('<td width="152" height="8" colspan="7" bgcolor="#FFFFFF"><img src="/images/nav/navTop.gif" width="152" height="8" alt="" border="0" /></td>');
	document.writeln('</tr>');
	// loop throught the arrays to build the items in the drop down.
	for(i=0;i<arrayLength;i++) {
		var itemArray = arrayName[i].split("|");
		var itemName = itemArray[0];
		var itemUrl = itemArray[1];
		document.writeln('<tr>');
		document.writeln('<td width="1" height="19" bgcolor="#FFFFFF" rowspan="2"><img src="/images/common/spacer.gif" width="1" height="19" alt="" border="0" /></td>');
		document.writeln('<td width="4" height="19" bgcolor="#FFFFFF" rowspan="2"><img src="/images/common/spacer.gif" width="4" height="19" alt="" border="0" /></td>');
		document.writeln('<td width="1" height="19" bgcolor="#AEAFA9" rowspan="2"><img src="/images/common/spacer.gif" width="1" height="19" alt="" border="0" /></td>');
		document.writeln('<td align="left" valign="middle" width="140" height="19"><div class="' + cssClassName + '" onClick="goThere(\'' + itemUrl + '\')" onMouseOver="this.className=\'navItemRowRoll\'" onMouseOut="this.className=\'' + cssClassName + '\'"><div style="padding-top:3px;">' + itemName + '</div></div></td>');
		document.writeln('<td width="1" height="19" bgcolor="#AEAFA9" rowspan="2"><img src="/images/common/spacer.gif" width="1" height="19" alt="" border="0" /></td>');
		document.writeln('<td width="4" height="19" bgcolor="#FFFFFF" rowspan="2"><img src="/images/common/spacer.gif" width="4" height="19" alt="" border="0" /></td>');
		document.writeln('<td width="1" height="19" bgcolor="#FFFFFF" rowspan="2"><img src="/images/common/spacer.gif" width="1" height="19" alt="" border="0" /></td>');
		document.writeln('</tr>');
		document.writeln('<tr>');
		document.writeln('<td align="left" valign="middle" width="140" height="1" bgcolor="#AEAFA9"><img src="/images/common/spacer.gif" width="140" height="1" alt="" border="0" /></td>');
		document.writeln('</tr>');
		// we need to alternate background color so that's what these next 5 lines do
		if(cssClassName == "navItemRowDk") {
			cssClassName = "navItemRowLt";
		} else {
			cssClassName = "navItemRowDk";
		}
	}
	// depending on the last item row color, we need to cap the bottom of the
	// drop-down with either a light or dark bottom image.
	if(cssClassName == "navItemRowDk") {
		var bottomImg = "navDropBot";
	} else {
		var bottomImg = "navDropBotLt";
	}
	document.writeln('</table>');
	document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="152">');
	document.writeln('<tr>');
	document.writeln('<td width="152" height="15"><img src="/images/nav/' + bottomImg + '.png" width="152" height="21" alt="" border="0" onLoad="fixPNG(this)" /></td>');
	document.writeln('</tr>');
	document.writeln('</table>');
}


// This next section of JS is for the global nav buttons.  Because 
// of the various image sizes and PNG usage, we have to use layers 
// for the rollovers
var currentNavButton;

// button on
function rollNavButtonOn(navButton) {
	if (currentMenu) {			// hide the current menu
		document.getElementById(navButton).style.visibility = "hidden";
	}
	currentNavButton = navButton;
	document.getElementById(navButton).style.visibility = "visible";	
}

// Button off
function rollNavButtonOff(navButton) {
	document.getElementById(navButton).style.visibility = "hidden";
}



// basic show layer function
function show(layerName) {
	top.document.getElementById(layerName).style.visibility = "visible";
}

// basic hide layer function
function hide(layerName) {
	top.document.getElementById(layerName).style.visibility = "hidden";
}

// Basic image rollover function
function rollImage(imgObj, imgTarget) {
	document.getElementById(imgTarget).src = eval(imgObj + ".src");
}

// secondary nav rollover function
function rollSecondary(imgObj, imgId, rowId, rowColor, linkId, linkClass) {
	document.getElementById(imgId).src = eval(imgObj + ".src");
	document.getElementById(rowId).bgColor = rowColor;
	document.getElementById(linkId).className = linkClass;
}

// Tour Pop-up function
function popTour(url) {
	tourWindow = window.open(url,'tourWindow','width=800,height=600,location=no,directories=no,menubar=no,resizable=no,scrollbars=no,toolbar=no,status=no');
	tourWindow.focus();
}
