
	function abreJanela(local,alvo,largura,altura)	{
		window.open (local,alvo,'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + largura + ',height=' + altura + ',top=0,left=0');
	}
	

	function veResultadosVotacao(catID, anoSel, vrtSel)	{
		abreJanela ('aces_resultados.asp?y=' + anoSel + '&v=' + vrtSel + '#c' + catID,'aces',450,300)
	}

	function mostraTorneio(id)	{
		if (opener)	{
				opener.top.location= 'eventos_torneios.asp?id=' + id; 
			}	else	{
				top.location = 'eventos_torneios.asp?id=' + id;
		}
	}

	function mostraVideo (media)	{
		abreJanela ('mostraMedia.asp?v=' + media,400,300)
	}

	function mostraFoto (media)	{
		abreJanela ('mostraMedia.asp?f=' + media,500,600)
	}

	function meses(mesInt)	{
		if (mesInt==1) return 'Janeiro';
		if (mesInt==2) return 'Fevereiro';
		if (mesInt==3) return 'Março';
		if (mesInt==4) return 'Abril';
		if (mesInt==5) return 'Maio';
		if (mesInt==6) return 'Junho';
		if (mesInt==7) return 'Julho';
		if (mesInt==8) return 'Agosto';
		if (mesInt==9) return 'Setembro';
		if (mesInt==10) return 'Outubro';
		if (mesInt==11) return 'Novembro';
		if (mesInt==12) return 'Dezembro';
	}

	function fadeOut() {
		if (fotoPrincipal)	{
			fotoPrincipal.style.filter="blendTrans(duration=2)";
			// Make sure the filter is not playing.
			if (fotoPrincipal.filters.blendTrans.status != 2) {
				fotoPrincipal.filters.blendTrans.apply();
				fotoPrincipal.style.visibility="hidden";
				fotoPrincipal.filters.blendTrans.play();
			}
		}
	}
	function fadeIn() {
		if (fotoPrincipal)	{
			fotoPrincipal.style.filter="blendTrans(duration=2)";
			// Make sure the filter is not playing.
			if (fotoPrincipal.filters.blendTrans.status != 2) {
				fotoPrincipal.filters.blendTrans.apply();
				fotoPrincipal.style.visibility="visible";
				fotoPrincipal.filters.blendTrans.play();
			}
		}
	}

	function enviaMail()	{
		if (formMsg.texto.value.length==0)	{
			alert("Preencha o texto antes de enviar a mensagem.");
			formMsg.texto.focus();
		}	else	{
			formMsg.submit();
		}
	}
		
    function highlight(elemnt,mensagem) {
        document.getElementById(elemnt).select();
        document.getElementById(elemnt).focus();
        if (document.all) {
            textRange = document.getElementById(elemnt).createTextRange();
            textRange.execCommand("RemoveFormat");
            textRange.execCommand("Copy");
            alert(mensagem);
        }
    }


	
	function int2date(integerStr)  {
	    return String(integerStr).substring(0,4) + "-" + String(integerStr).substring(4,6) +  "-" + String(integerStr).substring(6,8) 
	}

	function fotoAventura(strFotoBD) {
		var mTmpFoto = strFotoBD.split("|")
		this.ficheiro			    =mTmpFoto[0];
		this.descritivo		    =mTmpFoto[1];
		this.tipo			        =parseInt(mTmpFoto[2]);
		this.categoria		    =mTmpFoto[3];
		this.modalidade		=mTmpFoto[4];
		this.data                =mTmpFoto[5];
	}

	function siteNode(strSiteNode) {
		var mTmpNode = strSiteNode.split("|")
		this.parent			        =parseInt(mTmpNode[0]);
		this.nome		        =mTmpNode[1];
		this.link			        =parseInt(mTmpNode[2]);
		this.descricao		    =mTmpNode[3];
		this.modalidade		=mTmpNode[4];
		this.data                =mTmpNode[5];
	}

  function ConvDataInteger(anoInput,mesInput,diaInput)      {
        var tmpDataInteger="";
        tmpDataInteger+= anoInput;
       
        if (mesInput.length==1) { tmpDataInteger+= "0"};
        tmpDataInteger+= mesInput;
       
        if (diaInput.length==1) { tmpDataInteger+= "0"};
        tmpDataInteger+= diaInput;
        
       return parseInt(tmpDataInteger);
  }

function IsNumeric(sText)

{
   var ValidChars = "0123456789,.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }
   
 function IsValidDate(Day,Mn,Yr){
    var DateVal = Yr + "/" + Mn + "/" + Day;
    var dt = new Date(DateVal);

    if(dt.getDate()!=Day){
        return(false);
        }
    else if(dt.getMonth()!=Mn-1){
        return(false);
        }
    else if(dt.getFullYear()!=Yr){
        return(false);
        }
    return(true);
 }

    function preload_images() {
        for (var i = 0; i < arguments.length; i++){
            preloaded[i] = document.createElement('img');
            preloaded[i].setAttribute('src',arguments[i]);
            //document.write ("<img src='" + preloaded[i].src + "'>")
        };
    };
 