// Login Box
function loginBox(){
//document.write('<form action="http://www.betroyalsportsbook.com/login/BETROYAL" method="post" name="form1" id="form1" title="Login" dir="ltr" lang="en" >\n'
document.write('<form action="https://gaming.betroyal.com/login/BETROYAL?module=Register" method="post" name="form1" id="form1" title="Login" dir="ltr" lang="en" >\n'
			   +'<input type="hidden" name="action" value="LoginAction"  />\n'
			   +'<input name="user-name" type="text" class="loginbox" tabindex="1" title="User name" lang="en" value="BR" size="20" maxlength="20"  alt="User name"  />\n'
			   +'<input name="password" type="password" class="loginbox" tabindex="2" title="Password" lang="en" size="20"  maxlength="20"  alt="Password"  />\n'
			   +'<input name="btn" type="image" class="boton" id="btn" tabindex="3" title="login" lang="en" value="submit" src="/images/login_button.gif"  alt="login" border="0" />\n'
			   +'</form>\n');
}


function GetCookie (name) {
	var result = null;
  	var myCookie = " " + document.cookie + ";";
  	var searchName = " " + name + "=";
  	var startOfCookie = myCookie.indexOf(searchName)
  	var endOfCookie;
  	if (startOfCookie != -1) {
    		startOfCookie += searchName.length; // skip past cookie name
    		endOfCookie = myCookie.indexOf(";", startOfCookie);
    		result = unescape(myCookie.substring(startOfCookie, endOfCookie));
  	}
 	return result;

}

// Open Account Link
function openAccount(){
	//window.location = '/login/BETROYAL?module=Register';
	//window.location = 'https://gaming.betroyal.com/login/BETROYAL?module=Register';
	var agentId = GetCookie("agentId");
	var agentMC = GetCookie("myCookie");
	var keyword = GetCookie("Keyword");
	var domain = "gaming.betroyal.com";
	var skin = "BETROYAL";
	var keywordParameter = "";

	if (agentMC != null){
		var agent = agentMC;

	} else { 
		if (agentId != null){
    			var line1 = agentId;
    			var line2;
    			var agent;
    			line2 = line1.replace('"', '');
    			agent = line2.replace('"', '');
        	}
    	}
	
     	//if(geoip_country_code() != "US"){
		//domain = "secure.sbgeuro.com";
		//skin = "SBGEURO";
     	//} 
	
	if(keyword != null){
		keywordParameter = "&keyword="+keyword;
	}

     	var url = "https://"+domain+"/login/"+skin+"?module=Register";
	if(agent == null){
		window.location = (url);
	} else {
		window.location = (url+"&agentId="+agent+keywordParameter);
	}
}

//browser
<!--
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}
//-->

// Bookmark Script
function makeLink(){
var url = "http://www.betroyal.com";
var title = "Bet Royal Sportsbook & Casino";
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

//Marquee
$(document).ready(function(){

try{


    $jScroller.add("#marqueeContainer", "#marqueeContent", "left", 3, true);
    $jScroller.start();

}catch(e){}


});


//Live betting Odds
$(document).ready(function(){

try{

	$("#oddsTree").treeview();
    $("#oddsTree").prepend($('.collapsable'));

}catch(e){}

});

//Live Person ID
$(document).ready(function(){
	$("a[target='chat2274524']").attr('id','_lpChatBtn');
});

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external nofollow") anchor.target = "_blank";
 }
}
window.onload = externalLinks;

