var path = "https://www1.interpoker.tv/";
var exe = "/InterPokerFunInstall.exe";

window.onload = function() {
	if (getCookie('src_cd')) {
		if (document.getElementsByTagName) {
			var hrefs = document.getElementsByTagName('a');
		} else if(document.all) {
			var hrefs = document.all.tags('a');
		}
		for (i=0;i<hrefs.length;i++)
		{
			if(hrefs[i].href.indexOf(path) != -1)
			{
				hrefs[i].href = path+unescape(getCookie('src_cd'))+exe;
			}
		}
	}
	// Supplimentary onload functions
	doMenu();
}

//depending upon the page, highlight the correct sub menu item
//each page has a hiMenuID which matches the sub menu id.
function doMenu()
{
	var Menu = document.getElementById ? document.getElementById(MenuID) : document.all ? document.all[MenuID] : null;
	if(Menu) Menu.className = 'currentnav';
	
	var subMenu = document.getElementById ? document.getElementById(subMenuID) : document.all ? document.all[subMenuID] : null;
	if(subMenu) subMenu.className = 'currentsubnav';
}

function timer(url) {
	setTimeout("location.href = '" + url + "';", 5000);
}
function write_me(html) {
	document.write(html);	
}

function write_me_check_flash(html,alternate) {
	if (flash.version >= "6") {
			document.write(html);
	} else {
			document.write(alternate);
	}
}

/* FLASH DETECTION */
var versions = 10;

var flash = new Object();
flash.installed=false;
flash.version='0.0';



// FOR IE
if (window.ActiveXObject) {
	for (i = 2; i <= versions; i++) {
		try {
			oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + i + "');");
			if(oFlash) {
				flash.installed = true;
				flash.version = i + '.0';
			}
		}
		catch(e) {}
	}
}

//FOR NETSCAPE
else if (navigator.plugins && navigator.plugins.length) {
	for (i=0; i < navigator.plugins.length; i++) {
		if (navigator.plugins[i].name.indexOf('Shockwave Flash') != -1) {
			flash.version = navigator.plugins[i].description.split('Shockwave Flash ')[1];
			flash.installed = true;
			break;
		}
	}
}




/*function pass_link_tabs(site, page_type, site_name, promo){
	//Get cookie
	var cookie_src = getCookie("src_cd");
	
	// If cookie is NULL, fill it woth nothing so we don't get "/index.shtml?undefined", else add a "?"
	var cookie_src=(cookie_src)? cookie_src : "";
	
	if (cookie_src) {
		// We need to make sure we are only passing in affiliates
		// If pipe is found, we need to split to get src_cd
		if (cookie_src.indexOf("|")!= -1) {
			all_cookie = cookie_src.split("|");
			//If length of src cd is < 6, make src code null
			cookie_src = (all_cookie[0].length < 6) ? "" : cookie_src;
		}
		// No pipe - just test length of src_cd
		else if (cookie_src.length < 6){
			cookie_src="";
		}
		// Add "?" if redirecting with source code 
		cookie_src = (cookie_src != "") ? "?" + cookie_src : cookie_src;
	}
	//And then redirect =
	window.location.href = "http://" + site + "/index." + page_type + cookie_src;

}*/

function getCookie(Name) {   	

	var search = Name + "="   

	if (document.cookie.length > 0) { 
	
	// if there are any cookies      
	offset = document.cookie.indexOf(search)       

	if (offset != -1) { 
		// if cookie exists          
		offset += search.length          
		// set index of beginning of value         
		end = document.cookie.indexOf(";", offset)          
		// set index of end of cookie value         
		if (end == -1)             
			end = document.cookie.length         
			return unescape(document.cookie.substring(offset, end))      
		}    
	}
}

