try{
var cur_symbol="&#163;";
	//alert("cur="+cur);



		document.getElementById("the_usernameright").innerHTML=username;


		document.getElementById("realbal").innerHTML=cur_symbol+bal;
		document.getElementById("bonbal").innerHTML=cur_symbol+bonus;
		document.getElementById("tollypoints").innerHTML=points;
		document.getElementById("loyalty").innerHTML=loyalty;
	
//-->
}
catch(e){}


function checkdeposit()
{
	if(levelId == 1)
	{
		location.href="/butlinsarcade/casino/registration/registration_step2.thtml";
	}
	else if((ctype == "NET"))
	{
		location.href="/butlinsarcade/casino/account/netellerdeposit.thtml";
	}
	else if(ctype=='MB')
	{
		location.href="/butlinsarcade/casino/account/moneybookers_deposit.thtml";
	}
	else if(ctype == "PSC")
	{
		location.href = "/butlinsarcade/casino/account/paysafe_deposit.thtml";
	}
	else if(ctype=='UKA')
	{
		location.href="/butlinsarcade/casino/account/ukashdeposit.thtml";
	}
	else
	{
        location.href="/butlinsarcade/casino/account/deposit.thtml";
    }
}
function checkwithdraw()
{
	
	if(levelId == 1)
	{
		location.href="/butlinsarcade/casino/registration/registration_step2.thtml";
	}
	else if((levelId == 2)&&(bal < 10))
	{
		alert("Insufficient funds to withdraw");
	}
	else
	{
		location.href="/commonsys/withdraw/WithdrawView.do";
	}
	
}
function allTransactions(transType)
{

if(levelId == 1)
{
	location.href="/butlinsarcade/casino/registration/registration_step1.thtml?hide=true";
}
else
{
document.getElementById(transType).href="../../../deposit/common_transactions.html?type="+transType;
NewWindow(document.getElementById(transType).href,'mywin','600','550','yes','center');
return false;
}
}

function createRequestObject() {
    var httprReqobj;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        try{
                        httprReqobj = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(recreate){
                httprReqobj = new XMLHttpRequest();
        }
    }else{
        httprReqobj = new XMLHttpRequest();
    }
    return httprReqobj;
}

var balhttp_request = createRequestObject();
function getBalance()
{
        //alert('in getBalance');
        balhttp_request.open("POST",context+"/account/balance_retriver.jsp",true);
        balhttp_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        balhttp_request.setRequestHeader("Content-length", 0);
        balhttp_request.setRequestHeader("Connection", "close");
        balhttp_request.send(null);
        balhttp_request.onreadystatechange = handleBalResponse;
}
function handleBalResponse() {
                if(balhttp_request.readyState == 4){
                response = balhttp_request.responseText;
                //alert(response)
                        if(balhttp_request.status == 200){
                         var account_res = response.split('&');
                         formatted_bal = account_res[0].split("=")[1];
                         formatted_bonus = account_res[1].split("=")[1];
                        //ChangeState("realbal",cur_symbol+parseFloat(formatted_bal).toFixed(2));
                        ChangeState("realbal",formatted_bal);
                try{
                        ChangeState("midbal",formatted_bal);
                }catch(e) {}

                        setTimeout("getBalance()", 5000);
                }
        }
}

//added by Ram
function checkredeem()
{
    if(loyalty <= 0 )
	{
        alert("You don't have sufficient loyalty points to redeem");
	}
	else
	{
		location.href="/butlinsarcade/casino/account/redeem.thtml";
  }
}


if(session_id != 'null')
{
setTimeout("getBalance()", 5000);
}


