// Used for Touch Clarity links on the homepage boxes
function goTCLink(boxID, boxLink, sportID) {
	if (boxLink) {
		if (boxLink=="sweepstake") {
			openBrWindow('sweepstake.html','sweepstake','scrollbars=yes,toolbar=yes,width=784,height=520');
		} else if (boxLink=='radio') {
			openBrWindow('http://vchandler.teamtalk.com/Victor_Chandler/Audio_Centre/Index','VC','Height=465,Width=450,statusbar=no,left=25,top=25');
		} else {
			location.href=boxLink;
		}
	}
}

function goTCCashBack(sUrl) {
	if (sUrl=='uk vr'){
		openBrWindow('/chandler_park_pop.jsp','ChandlerPark','scrollbars=yes,width=784,height=520');
	} else if(sUrl=='radio'){
		openBrWindow('http://vchandler.teamtalk.com/Victor_Chandler/Audio_Centre/Index','VC','Height=465,Width=450,statusbar=no,left=25,top=25');
	} else if(sUrl=='vcchess'){
		openBrWindow('http://victorchandler.mediaondemand.net/chess','chess','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=684,height=432');
	}else {
		location.href=sUrl;
	}
}	


function goBetSlip() {
	b = getCookie('betslip');
	if (b != null) {
		location.href='/betslip.jsp';
	} else {
		showDialog(document.getElementById('bsmsg1').innerHTML);
	}
}

function handleGames(gID, sID) {
	var game;
	var gameWidth = 800;
	var gameHeight = 600;
	var needsScrollBars;
	var scrollbarWidth = 0;
	var transferTextHeight = 0;
	var headerHeight = 100;
	if(screen.height)if(screen.height<=gameHeight+headerHeight)needsScrollBars="yes"; else needsScrollBars="no";

	if (bsSTATUS=='login') {
		if (gID == 6100) {
		//roulette
			game = "/games_popup.jsp?gameid=" + gID + "&playmode=real&height=" + gameHeight  + "&width=" + gameWidth + "&orbisgamename=Roulette&orbisgameclass=Roulette&flashurl=/vcgames/roulette.swf";
		} else if (gID == 10100) {
		//blackjack
			game = "/games_popup.jsp?gameid=" + gID + "&playmode=real&height=" + gameHeight  + "&width=" + gameWidth + "&orbisgamename=BJStd3Hand&orbisgameclass=BJStd3Hand&flashurl=/vcgames/preloader.swf";
		}

		if ((sID == 200)||(screen.width<gameWidth+20)||(screen.height<gameHeight+140)){
			scrollbarWidth = 20;
			needsScrollBars = "yes";
			transferTextHeight = 30;
		}
		
		var popupWidth = parseFloat(gameWidth) + parseFloat(scrollbarWidth);
		var popupHeight = parseFloat(gameHeight) + parseFloat(headerHeight) + parseFloat(transferTextHeight);
		var features = 'resizable, status=1, scrollbars=' + needsScrollBars + ',width=' + popupWidth + ',height=' + popupHeight + ',top=' + centerHeight(popupHeight) + ',left=' + centerWidth(popupWidth);
		openBrWindow(game, 'GAMEWINDOW' + gID, features);
	} else {
		showDialog(getElText('loginerror'));
	}
}

function centerHeight(sch) {
	h = ((screen.height - sch)/2)-30;
	return h;
}

function centerWidth(scw) {
	w = (screen.width - scw)/2;
	return w;
}

function selectIRTab(tab) {
	for (var i=1; i<6; i++){
		if (i==tab){
			document.getElementById("irTeaserEvent"+i).style.display="block";
			document.getElementById("irTab"+i).className="irTabOn";
			document.getElementById("irTab"+i+"Left").className="irTabOnLeft";
			document.getElementById("irTab"+i+"Right").className="irTabOnRight";
		} else if (document.getElementById("irTeaserEvent"+i)) {
			document.getElementById("irTeaserEvent"+i).style.display="none";
			document.getElementById("irTab"+i).className="irTab";
			document.getElementById("irTab"+i+"Left").className="irTabLeft";
			document.getElementById("irTab"+i+"Right").className="irTabRight";
		}		
	}
}

//used by the inrunning teaser	
function goIrEvent(eventId){
	window.top.location="inrunning_live.jsp?eid=" + eventId;
	return true;
}