// JavaScript Document
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;

}



function openPopup(url,w,h){
    infoWin=window.open(url,"popup","directories=no,hotkeys=no,Width="+w+",Height="+h+",location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=yes"); 
    infoWin.focus();
    return; 
}

function openPopupNew(url,w,h,sl){
    infoWin=window.open(url,"popup","directories=no,hotkeys=no,Width="+w+",Height="+h+",location=no,menubar=no,resizable=yes,scrollbars="+sl+",status=no,titlebar=yes"); 
    infoWin.focus();
    return; 
}

//Open Account Link
//function openaccount(){
		//window.location = 'http://wager.sbgglobal.com:8086/login/SBGGLOBAL?module=Register';
	//var agent = GetCookie("agentId");
	//if(agent == null){
	//window.location = 'http://wager.sbgglobal.com:8086/login/SBGGLOBAL?module=Register';
	//} else {
	//window.location = "http://wager.sbgglobal.com:8086/login/SBGGLOBAL?module=Register&agentId="+agent;
	//}
	//}
<!-- 08-20-2006 9:21 am by Tito -->

//function openaccount(){
//	var agent = GetCookie("agentId");
//	var url = "http://wager.sbgglobal.com:8086/login/SBGGLOBAL?module=Register&agentId=";
//	if(agent == null){
//	window.location = 'http://wager.sbgglobal.com:8086/login/SBGGLOBAL?module=Register';
//	} else {
//	window.location = (url+agent);
//	}
//}

<!-- 08-20-2006 9:21 am by Tito end -->

function openaccount(){
	var agentId = GetCookie("agentId");
	var agentMC = GetCookie("myCookie");

    //if (agentMC == null){
    //var line1 = agentId;
    //var line2;
    //var agent;
    
    //line2 = line1.replace('"', '');
   // agent = line2.replace('"', '');

    //var agent = agentId; 
    
    //} else { 
    //var agent = agentMC;
    //}
    if (agentMC != null){
    var agent = agentMC;

    } else { 
        if (agentId != null){
    	var line1 = agentId;
    	var line2;
    	var agent;
    	line2 = line1.replace('"', '');
    	agent = line2.replace('"', '');
        }
    }
    var url = "http://wager2.sbgglobal.com/login/SBGEURO?module=Register&agentId=";
	if(agent == null){
	//window.location = 'http://wager2.sbgglobal.com/login/SBGEURO?module=Register';
	window.location = (url+10700);
	} else {
	window.location = (url+agent);
	}
}
	
//Open Affiliate Account Link
function openaffiliate(){
		window.location = 'http://wager2.sbgglobal.com/affiliate/SBGEURO?action=SIGNUP';
	}
	
//Play 4 Fun Link
function p4f(){
		window.location = 'http://wager2.sbgglobal.com/login/SBG?action=LoginAction&user-name=GUEST&password=GUEST';
	}
	
//login Link
function login(){
		window.location = 'http://wager2.sbgglobal.com/login/SBGEURO';
	}
	
//Open Affiliate Account Link
function openaffiliateaccount(){
		window.location = 'http://wager2.sbgglobal.com/affiliate/SBGEURO?action=SIGNUP';
	}

//Download Poker Link
function downloadpoker(){
    	window.location = 'https://members.pokerhost.com/login/family/338.html';
	}

//CS Link
function csLink(){
		window.location = 'mailto:customerservice@betsbg.com?subject=Customer Service Inquiry';
}

//SBG Poker Support Live Help
function SBGPokerSupporLH(){
		var link="http://www.sbgglobal.com/poker/sbgpokersupportlivehelp";
		openPopup(link,470,320); return;
}

//SBG Poker Promotions Flash Link
function SBGPokerPromo(){
		window.location = 'http://www.sbgglobal.com/poker/promotions';
}

//--- Links Top Bar Start---//
//SBG Global
function sbgHome(){
		window.location = 'http://www.sbgglobal.com/aboutus/';
	}
//Take a quick tour
function takeaqt(){
		window.location = 'http://www.sbgglobal.com/tour/';
	}
//Sportsbook Section
function Sportsbook(){
		window.location = 'http://www.sbgglobal.com/sportsbook/';
	}
//Casino Section
function Casino(){
		window.location = 'http://www.sbgglobal.com/casino/';
	}
//Poker Section
function Poker(){
		window.location = 'http://www.sbgglobal.com/poker/';
	}
//Horse Racing Section
function Horseracing(){
		window.location = 'http://www.sbgglobal.com/horseracing/';
	}
//Banking Section
function Banking(){
		window.location = 'http://www.sbgglobal.com/banking/';
	}
//--- Links Top Bar End---//
//Scrip del Drop down.
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->


//--- Popup Macromedia scrip ---//
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->

function closeLayer(){
  document.getElementById("theLayer").style.visibility="hidden";
}

function decimalCalculator(action){

	if(action == "open"){
		document.getElementById("calculator").style.visibility="visible";
	} else {
		if(action == "close"){
			document.getElementById("calculator").style.visibility="hidden";
		}
	}
}

		function showConvertedOdds(){
			var odds = document.getElementById("odds").value;
			document.getElementById("oddsResult").innerHTML = convertOdds(parseInt(odds));
		}
		function convertOdds(odds){
			var oddsConverted = 0;
			if (odds > 0){
				oddsConverted = (odds / 100) + 1;
			}
			else{
				oddsConverted = (100 / Math.abs(odds)) + 1;
			}
			return Math.round(oddsConverted * 100) / 100;
		}

function copyrightYear(){
var curdate = new Date();
var year = curdate.getFullYear();
document.write(year);
}