// Shows Hides div layer
function showCalendar(showMonth) {
	var mArr = new Array("january","february","march","april","may");
	for (var i=0;i<mArr.length;i++)
	{
		var thisMonth = mArr[i];
		if(showMonth == thisMonth)
		{
			if(document.layers)
			{	
				document.layers[thisMonth].visibility = "show";
				document.layers[thisMonth].display = "";
			}
			else if(document.getElementById) 
			{
				document.getElementById(thisMonth).style.visibility = "visible";
				document.getElementById(thisMonth).style.display = "";
			}
			else 
			{
				document.all(thisMonth).style.visibility = "visible";
				document.all(thisMonth).style.display = "";
			}
		}
		else
		{
			if(document.layers)
			{	
				document.layers[thisMonth].visibility = "hide";
    	        document.layers[thisMonth].display ="none";		
			}
			else if(document.getElementById) 
			{
				document.getElementById(thisMonth).style.visibility = "hidden";
				document.getElementById(thisMonth).style.display = "none";
			}
			else 
			{
				document.all(thisMonth).style.visibility = "hidden";
				document.all(thisMonth).style.display = "none";
			}
		}
	}
}

ContactUsPhoneUpdate = function(f, d) 
{
    var p_num = new Array();

    p_num[0] = "";//This space is for the default number, i.e Dialing from the U.K. = 0800...
	p_num[1] = "1800 553399";//Australia
	p_num[2] = "00 44 1481 825000";//Belgium
	p_num[3] = "1877 6209013";//Canada
	p_num[4] = "00 44 1481 825000";//Denmark
	p_num[5] = "+44 (0)20 7553 4162";//Finland 
	p_num[6] = "+44 (0)20 7553 4162";//France
    p_num[7] = "0800 028 0348";//Germany
	p_num[8] = "00 44 1481 825000";//Holland
    p_num[9] = "800 908102"; //Hong Kong
	p_num[10] = "00 44 1481 825000";//Italy
    p_num[11] = "1800 803316";//Malaysia
	p_num[12] = "+44 (0)20 7553 4162";//Norway
	p_num[13] = "+44 (0)20 7553 4162";//South Africa
    p_num[14] = "+44 (0)20 7553 4162";//Singapore
	p_num[15] = "+44 (0)20 7553 4162";//Spain
	p_num[16] = "+44 (0)20 7553 4162";//Sweden 
    p_num[17] = "00800 142 030 463";//Turkey
    p_num[18] = "0800 0280348";//UK
	p_num[19] = "1877 469 2040";//USA
	p_num[20] = "001 800 1562 030463";//Thailand
	p_num[21] = "800 1011230";//Singapore
	p_num[22] = "+44 (0)20 7553 4162";//Japan

	p_num[0] = d;
	f.code.value = p_num[f.country.selectedIndex]
}

function gotoCasinoDownload()
{
	gotoDefaultCasinoDownload();
}

// Used to start instant play casino, and then redirect to the beginner's room, instant play casino.
function gotoInstant()
{
	LaunchIgamesSVC();
}

// Followng 4 functions are moved from \s\js\sc.js

function OpenWindow(linkAddress)
{
	window.open(linkAddress, "Betting", "width=600,height=470,resizable,scrollbars");
}

function pop(theURL,winName,features)
{
	window.open(theURL,winName,features);
}

function gotoContact(){
	//alert("Display Contact Info:");
	window.opener.location.href ="/t/forms/contactUs.aspx";
	window.close();
}	

function gotoWinnings(currentPPID)
{
	window.opener.location = window.opener.location.toString().replace(/\?.*/, "")+"?useraction=withdraw&currentPPID="+currentPPID;
	window.close();
}

$(document).ready(function() {
	// Functionality for Collapsing definitions lists - RREPKA
	if($(".collapsing-definition-list").length>0) {
		$(".collapsing-definition-list").each(
			function(i) {
				$(this).find("dl > dd").hide();
				if(!$(this).find(".collapsing-definition-list-show").length>0) $(this).prepend('<div class="collapsing-definition-list-show">Show</div>');
				if(!$(this).find(".collapsing-definition-list-hide").length>0) $(this).prepend('<div class="collapsing-definition-list-hide">Hide</div>');
				$(this).find(".collapsing-definition-list-show").hide();
				$(this).find(".collapsing-definition-list-hide").hide();
				$(this).find("dl dd").append('<a class="close">'+$(this).find(".collapsing-definition-list-hide").text()+'</a>');
				$(this).find("dl dd > a.close").attr("href", "#").click( function() {
					$(this).parent("dd").slideToggle("fast");
					$(this).parent("dd").prev("dt").children("a").attr("title", ($(this).parent("dd").prev("dt").children("a").attr("title")==$(this).parents(".collapsing-definition-list").find(".collapsing-definition-list-show").text())?$(this).parents(".collapsing-definition-list").find(".collapsing-definition-list-hide").text():$(this).parents(".collapsing-definition-list").find(".collapsing-definition-list-show").text());
					return false;
				})
				$(this).find("dl dt a").attr("href", "#").attr("title", $(this).find(".collapsing-definition-list-show").text()).click( function() {
					$(this).parent("dt").next("dd").slideToggle("fast");
					$(this).attr("title", ($(this).attr("title")==$(this).parents(".collapsing-definition-list").find(".collapsing-definition-list-show").text())?$(this).parents(".collapsing-definition-list").find(".collapsing-definition-list-hide").text():$(this).parents(".collapsing-definition-list").find(".collapsing-definition-list-show").text());
					return false;
				});
			}
		);
	}
	// End Functionality for Collapsing definitions lists
});

//FormBoletoBR
function validaFormBoletoBR(form){
	var t = form.vl_Value;
	var m = document.getElementById('msgErroBoletoBR');
	var f = document.getElementById('div_formBoletoBR');
	var s = document.getElementById('formBoletoBR_msgSucesso');
	//var f = document.getElementById('FormBoletoBR');
	
	if(t.value == ""){
		t.focus();
		m.innerHTML = "<font color=red><strong>Por favor, digite um valor.</strong></font>";
		//alert("Erro");
		return false;
	}
	
	if(t.value < 50){
		t.focus();
		m.innerHTML = "<font color=red><strong>O valor deve ser maior que 50.</strong></font>";
		return false;
	}
	
	if(t.value > 9000){
		t.focus();
		m.innerHTML = "<font color=red><strong>O valor deve ser menor ou igual a 9000.</strong></font>";
		return false;
	}
	
	if(!validarInteiro(t.value)){
		t.focus();
		m.innerHTML = "<font color=red><strong>Caractere inv&aacute;lido.</strong></font>";
		return false;
	}
	
	if (isNaN(t.value)){
		t.focus();
		m.innerHTML = "<font color=red><strong>Caractere inv&aacute;lido.</strong></font>";
		return false;
	}
		
		f.style.display = 'none';
		s.innerHTML = "O Boleto foi aberto em uma nova janela.<br /><br /><font style='font-size:11px;'>Caso a janela n&atilde;o abra, desabilite o bloqueador de pop-ups de seu navegador, ou entre em contato com a Central de Atendimento.</font>";
		
		window.open('about:blank','popup','scrollbars=no,width=720,height=600');
		form.target = 'popup';
		form.submit();
		//return true;
	
}

function validarInteiro(valor){
	
	var valor = parseInt(valor);
	
	if (isNaN(valor)) {
		return false;
	}else{
		return true;
	}
}

function SoNumero(e){
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
	if (tecla > 47 && tecla < 58) // numeros de 0 a 9
		return true;
	else
	{
		if (tecla != 8) // backspace
			event.keyCode = 0;
		else
			return true;
	}
}

//Fim
