var cultureId = 0;
var oddStyle = GetCookie("ostyle");
var timeZone = GetCookie("tzone");
var refreshInterval = GetCookie("refresh");
if(oddStyle==null) { oddStyle=1; } else { oddStyle = parseInt(oddStyle);}
if(timeZone==null) { timeZone=0; } else { timeZone = parseInt(timeZone);}
if(refreshInterval==null) { refreshInterval=30; } else { refreshInterval = parseInt(refreshInterval);}
refreshInterval = refreshInterval * 1000;

function GetCookie (name) {
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
	var j = i + alen;    
	if (document.cookie.substring(i, j) == arg)      
		return GetCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;
	}	
	return null;
}

function GetCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function Bookmark(doctitle) {
	if(doctitle=='' || doctitle==undefined) { doctitle = document.title; }
	window.external.AddFavorite(location.href, doctitle);
}

function Recommend() {
	window.open("recommend.asp","recommend","toolbar=no,location=no,status=no,menubar=no,scrollbars=no,width=530,height=410,resizable=no");
}

function CancelBet(eventId, optionId, betId, classId) {
	if(confirm('ARE YOU SURE YOU WANT TO CANCEL THE SELECTED BET?'))
		window.location.href='account_bets.asp?cancel=1&redir=1&oid='+optionId+'&eid=' + eventId + '&bid=' + betId + '&clsid=' + classId;
}

function Round(number,X) {
	X = (!X ? 0 : X);
	if(X==0)
		return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
	else
		return Xtend(Math.round(number*Math.pow(10,X))/Math.pow(10,X), X);
}

function RoundNoEx(number,X){
	return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
}

function Xtend(Q,X) { 
	var P;
    Q = String(Q);
    while ((P=Q.indexOf('.'))<0) 
		Q+='.';
    while (Q.length <= P+X) 
		Q+='0';
    return Q; 
}

function SetTime(id, adjst, wt) {
	var v = new Date();
	v.setHours(v.getUTCHours()+adjst);
	var h = v.getHours();
	var n = v.getMinutes();
	var s = v.getSeconds();
	var tmp = SRepeat('0', 2-h.toString().length) + h + ':' + SRepeat('0', 2-n.toString().length) + n
	if(wt==1) { tmp = tmp + ':' + SRepeat('0', 2-s.toString().length) + s; }
	id.innerHTML = tmp;
}

function sts(v)
{
	window.status = v;
}

function MDate(dtm, wtime, nullval)
{
	if(dtm==null || dtm=='') {
		return nullval;
	} else {
		var v = new Date(dtm);
		v.setHours(v.getHours()+timeZone);
		var m = v.getMonth()+1;
		var d = v.getDate();
		var h = v.getHours();
		var n = v.getMinutes();
		var y = v.getYear();
		y = y.toString();
		var s = SRepeat('0', 2-m.toString().length) + m + '.' + SRepeat('0', 2-d.toString().length) + d + '.' + y;
		if(wtime) { s+=' ' + SRepeat('0', 2-h.toString().length) + h + ':' + SRepeat('0', 2-n.toString().length) + n; }
		return s;
	}
}

function SRepeat(str, rcount)
{
	var tmp = '';
	for(var i=0;i<rcount;i++) {
		tmp = tmp + str;
	}
	return tmp;
}

function AMNavig(v)
{
	if(v!=0) {
		if(v=='logout.asp')
		{
			if(confirm('ARE YOU SURE YOU WANT TO LOG OUT OF YOUR ACCOUNT?')) { Goto(v); } else { return false; }
		} else {
			Goto(v);
		}
	}
}

function GetElement(id)
{
	return document.getElementById(id);
}

function Goto(url)
{
	window.location.href = url;
}

function SelectBankingMethod(v)
{
	var bankData = GetElement("bankData");
	if(v==6)
	{
		bankData.style.display = 'block';
		bankData.style.visibility = 'visible';
	}
	else
	{
		bankData.style.display = 'none';
		bankData.style.visibility = 'hidden';
	}
}