//script data
function data () {
var oneDate = new Date();
var theDate = oneDate.getDate();
var theMonth = oneDate.getMonth() +1;
var theYear = oneDate.getYear();
if (theDate < 10) {theDate = "0" + theDate}
if (theMonth < 10) {theMonth = "0" + theMonth}
//var msg = theDate + "." + theMonth + "." + theYear;
var msg = theDate + "-" + theMonth;
document.write(msg);
}
//fim script data


function mudaIframe(obj,ficheiro){
	obj = document.getElementById(obj);
	obj.src = ficheiro;
}
function mudaClasse(obj,srv){ 
	obj.className = srv; 
} 


function MM_displayStatusMsg(msgStr) //v1.0
{
  status=msgStr;
  document.MM_returnValue = true;
}


function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}


function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' dever ser um endereço de email válido.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' deve ser um Número.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' deve ser um Número entre '+min+' e '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' é de preenchimento obrigatório.\n'; }
  } if (errors) alert('Ocorreram os seguintes erros:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function displayWindow(theURL,winName,width,height,features) { //v3.1
// Made by Eddie Traversa modified from Macromedia Code
// http://nirvana.media3.net/
    var window_width = width;
    var window_height = height;
    var newfeatures= features;
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
    newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',features=' + newfeatures + '');
    newWindow.focus();
}



function verificaApostador(){
	if (document.form1.idApostador.selectedIndex == 0){
		alert('Seleccione um Apostador!');
		return false;
	}else{
		document.form1.submit();
	}
}

function confirma(registo,url){

	if(confirm('Tem a certeza que deseja remover o registo "' + registo + '" ? '))
	{
		self.location = url;
	}
}


function confirma2(frase,url){

	if(confirm(frase))
	{
		self.location = url;
	}
}


function colocaND()
{
	obj = document.getElementsByName("golosEquipaA");
	i = 0
	while (i <= obj.length-1)
	{
		objActual = document.getElementsByName("golosEquipaA")(i);
		objActual.options.selectedIndex = 1
		i = i + 1
	}
	obj = document.getElementsByName("golosEquipaB");
	i = 0
	while (i <= obj.length-1)
	{
		objActual = document.getElementsByName("golosEquipaB")(i);
		objActual.options.selectedIndex = 1
		i = i + 1
	}
	
	
}



function mudaClasse(obj,srv){ 
	obj.className = srv; 
} 


function mostraDiv(camada){
	if (camada.style.display == 'none')
		{camada.style.display = ''}
}


function escondeDiv(camada){
	if (camada.style.display == '')
		{camada.style.display = 'none'}
}


function trocaDiv(camada){
	if (camada.style.display == 'none')
		{camada.style.display = ''}
	else
		{camada.style.display = 'none'}
}


function troca(camada)
{
	if (camada.style.visibility == "hidden")
		{camada.style.visibility = "visible"}
	else
		{camada.style.visibility = "hidden"}
}


function mostra(camada)
{
	if (camada.style.visibility == "hidden")
		{camada.style.visibility = "visible"}
	else
		{return false}
}


function esconde(camada)
{
	if (camada.style.visibility == "visible")
		{camada.style.visibility = "hidden"}
	else
		{return false}
}



function mudaTamanho(id,tam)
{
	id.style.fontSize = tam + "px";
}




function load(formName) {
  var list = document[formName].list;
  var str = list.options[list.selectedIndex].value;
  if (str != "") location.href = str;
}



function setImage(imagem)
{
	document.form.imagem.value = imagem;
}



function Validacao()
{
	var i=0
	var jogo=1
	while (jogo<=9)
		{
		if (document.form.elements[i].selectedIndex==0)
			{
			alert ("Não apostaste no RESULTADO do Jogo: " + jogo +" ");
			return false
			}
		i=i+2
		jogo++
		}
		
	var j=1
	var jogo=1
	while (jogo<=9)
		{
		if (document.form.elements[j].selectedIndex==0)
			{
			alert ("Não apostaste nos GOLOS do Jogo: " + jogo +" ");
			return false
			}
		j=j+2
		jogo++
		}
	return true
	}



function Maiusculas()
{
 	var cidade=document.form.CIDADE.value;
 	cid=cidade.toUpperCase();
 	document.form.CIDADE.value=cid;
}


function validaPagamento(){
	if (document.pagamento.pagamento[0].checked == '' && document.pagamento.pagamento[1].checked == ''){
		alert('Por favor, preencha a modalidade pretendida!');
		return false;
	}else{
		return true;
	}
}

		function validaConfirma(){
			if (document.confirma.titular.value == ''){
				alert('Por favor, informe o Titular da Conta de origem!');
				document.confirma.titular.focus();
				return false;
			}
			if (document.confirma.banco.value == ''){
				alert('Por favor, informe o seu Banco!');
				document.confirma.banco.focus();
				return false;
			}
			if (document.confirma.datadia.options[document.confirma.datadia.selectedIndex].value == ''){
				alert('Por favor, indique a data da Transferência!');
				document.confirma.datadia.focus();
				return false;
			}
			if (document.confirma.datames.options[document.confirma.datames.selectedIndex].value == ''){
				alert('Por favor, indique a data da Transferência!');
				document.confirma.datames.focus();
				return false;
			}
			if (document.confirma.dataano.options[document.confirma.dataano.selectedIndex].value == ''){
				alert('Por favor, indique a data da Transferência!');
				document.confirma.dataano.focus();
				return false;
			}
			if (document.confirma.nibConta.value == '' && document.confirma.numConta.value == ''){
				alert('Por favor, informe o NIB ou o Número da Conta de origem!');
				document.confirma.nibConta.focus();
				return false;
			}
			if (document.confirma.modalidade.options[document.confirma.modalidade.selectedIndex].value == ''){
				alert('Por favor, indique o pagamento escolhido!');
				document.confirma.modalidade.focus();
				return false;
			}
			if (document.confirma.montante.options[document.confirma.montante.selectedIndex].value == ''){
				alert('Por favor, indique o Montante transferido!');
				document.confirma.montante.focus();
				return false;
			}
			//alert('OK');
			return true;
		}





