
/**Funções das fotos dos eventos. */
	function fotos(obj, tipo) {
		var el = document.getElementById(obj);
		if ( el.style.display != "none" ) {
			el.style.display = 'none';
		} else {
			el.style.display = '';
		}
	}
	function album(obj, tipo) {
		var el = document.getElementById(obj);
		if ( el.style.display != "none" ) {
			if (tipo == '1'){id = 101}
			if (tipo == '2'){id = 201}
			el.style.display = 'none';
			document.getElementById(id).style.display = '';
		}
		else {
			if (tipo == '1'){id = 101}
			if (tipo == '2'){id = 201}
			cont = id;
			id = id + 4;
			while (cont<id) {
				document.getElementById(cont).style.display = 'none';
				cont++;
			}

			el.style.display = '';
		}
	}


/**Funções de navegação. */
	function toggle(obj) {
		var el = document.getElementById(obj);
		if ( el.style.display != "none" ) {
			el.style.display = 'none';
			document.getElementById(1).style.display = '';
		}
		else {
			cont=1;
			while (cont<22) {
				document.getElementById(cont).style.display = 'none';
				cont++;
			}

			el.style.display = '';
		}
	}
	
	function validaForm(){
		//validar nome
		d = document.cadastro;
		if (d.nome.value == ""){
			alert("O campo " + d.nome.name + " deve ser preenchido!");
			d.nome.focus();
			return false;
		}
		if (d.email.value == ""){
			alert("O campo " + d.email.name + " deve ser preenchido!");
			d.email.focus();
			return false;
		}
		//validar email(verificao de endereco eletronico)
		parte1 = d.email.value.indexOf("@");
		parte2 = d.email.value.indexOf(".");
		parte3 = d.email.value.length;
		if (!(parte1 >= 3 && parte2 >= 6 && parte3 >= 9)) {
			alert("O campo " + d.email.name + " deve ser conter um endereco eletronico!");
			d.email.focus();
			return false;
		}		
		if (d.ddd.value == ""){
			alert("O campo " + d.ddd.name + " deve ser preenchido!");
			d.ddd.focus();
			return false;
		}
		if (isNaN(d.ddd.value)){
			alert("O campo " + d.ddd.name + " deve conter apenas numeros!");
			d.ddd.focus();
			return false;
		}
		if (d.telefone.value == ""){
			alert("O campo " + d.telefone.name + " deve ser preenchido!");
			d.telefone.focus();
			return false;
		}
		if (isNaN(d.telefone.value)){
			alert("O campo " + d.telefone.name + " deve conter apenas numeros!");
			d.telefone.focus();
			return false;
		}
		
		if (d.comentario.value == ""){
			alert("O campo " + d.comentario.name + " deve ser preenchido!");
			d.comentario.focus();
			return false;
		}
		alert('E-mail enviado com sucesso.');
		return true;
	}	
	

	function openCentered(theURL,winName,winWidth,winHeight,features) {
  		var w = (screen.width - winWidth)/2;
  		var h = (screen.height - winHeight)/2 - 60;
  		features = features+',width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
  		window.open(theURL,winName,features);
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
<!--
function DataHoje() {
	var now = new Date();
	var mName = now.getMonth() + 1;
	var dName = now.getDay() + 1;
	var dayNr = now.getDate();
	var yearNr=now.getYear();
	
	if(mName==1) Mes = "janeiro";
	if(mName==2) Mes = "fevereiro";
	if(mName==3) Mes = "março";
	if(mName==4) Mes = "abril";
	if(mName==5) Mes = "maio";
	if(mName==6) Mes = "junho";
	if(mName==7) Mes = "julho";
	if(mName==8) Mes = "agosto";
	if(mName==9) Mes = "setembro";
	if(mName==10) Mes = "outubro";
	if(mName==11) Mes = "novembro";
	if(mName==12) Mes = "dezembro";
	
	if(dName==1) Day = "Domingo";
	if(dName==2) Day = "Segunda";
	if(dName==3) Day = "Ter&ccedil;a";
	if(dName==4) Day = "Quarta";
	if(dName==5) Day = "Quinta";
	if(dName==6) Day = "Sexta";
	if(dName==7) Day = "S&aacute;bado";
	if(yearNr < 2000) Year = 1900 + yearNr;
	else Year = yearNr;

	return DataHoje =(" " + Day + ", " + dayNr + " de " + Mes + " de " + Year);
}	
// -->
<!--
function SaltaCampo (campo,prox,tammax,teclapres){
  var tecla = teclapres.keyCode;
  var vr = document.frmSenha[campo].value;
  var tam = vr.length;
  
  if( tecla == 13 || tecla == 6 || tam == tammax)
  {
     document.frmSenha[prox].focus();
  }
}
// -->
<!--
function RetornaNumeros(caracter) {

 if(document.all) { // Internet Explorer
  var tecla = event.keyCode;
 }
 else {
  var tecla = caracter.which;
 }

 if(tecla > 47 && tecla < 58) { // numeros de 0 a 9
  return true;
 }
 else {
  if ((tecla != 0) && (tecla != 8) && (tecla != 46) && (tecla != 37) && (tecla != 39)) { // backspace e Del
   return false;
  }
  else {
   return true;
  }
 }
}
//-->
function ChecaCpf(cpf) {
 vr = cpf;
 vr = vr.replace( "/", "" );
 vr = vr.replace( "/", "" );
 vr = vr.replace( ",", "" );
 vr = vr.replace( ".", "" );
 vr = vr.replace( ".", "" );
 vr = vr.replace( ".", "" );
 vr = vr.replace( ".", "" );
 vr = vr.replace( "-", "" );
 vr = vr.replace( "-", "" );
 vr = vr.replace( "-", "" );
 vr = vr.replace( "-", "" );
 vr = vr.replace( "-", "" );
 tam = vr.length;

 if (ValidaCpf(vr)) {
   return true;
 }  
 else {
   alert("Valor invalido de CPF");
   document.forms[0].txtNumCpf.focus();
   return false;
 }  
}

function ValidaCpf(pcpf)
 {

 if (pcpf.length != 11) {sim=false}
 else {sim=true}

  if (sim )  // valida o primeiro digito
  {
  for (i=0;((i<=(pcpf.length-1))&& sim); i++)
  {
   val = pcpf.charAt(i)
   if

 ((val!="9")&&(val!="0")&&(val!="1")&&(val!="2")&&(val!="3")&&(val!="4")

 &&    (val!="5")&&(val!="6")&&(val!="7")&&(val!="8")) {sim=false}
   }

   if (sim)  {
    soma = 0
    for (i=0;i<=8;i++)
    {
     val = eval(pcpf.charAt(i))
     soma = soma + (val*(i+1))
    }

    resto = soma % 11
    if (resto>9) dig = resto -10
    else  dig = resto
    if (dig != eval(pcpf.charAt(9))) { sim=false }
   else   // valida o segundo digito
    {

     soma = 0
    for (i=0;i<=7;i++)
     {
     val = eval(pcpf.charAt(i+1))
      soma = soma + (val*(i+1))
    }

     soma = soma + (dig * 9)
    resto = soma % 11
     if (resto>9) dig = resto -10
     else  dig = resto
   if (dig != eval(pcpf.charAt(10))) { sim = false }
    else sim = true
   }
   }
  }

  if (sim) {
   return true;
  }
  else{
   return false;
  }
 }


function VeSeSub (){
	var tecla = event.keyCode;
    if (tecla == 13 ){
		ChecaForm();
	}	
}


function ChecaNovaSenha(NovaSenha) {
 if(ValidaNovaSenha(NovaSenha)) {
  return true;
 }
 else {
  document.forms[0].txtNovaSenha.focus();
  alert("A Nova Senha contém caracteres inválidos.\n Por favor, não entre com caracteres especiais.");
  return false;
  }
}
function ValidaNovaSenha(NovaSenha) {
  var objRegExp  = /^[A-Za-z0-9]/ ;
  return objRegExp.test(NovaSenha);
}

function ChecaForm () {
   var errorMsg = "";
   
   	if (document.frmSenha.txtNumCpf.value==""){
		errorMsg += "\n\t- Cpf";
	}

   	if (document.frmSenha.txtSenha.value==""){
		errorMsg += "\n\t- Senha";
	}
	
	if (document.frmSenha.txtNovaSenha.value!=""){
		if (document.frmSenha.txtConfirmaNovaSenha.value==""){
				errorMsg += "\n\t- Confirma Nova Senha";
		}
	}
	
	if (errorMsg != ""){
		msg = "Preencha os seguintes campos: \n";
		
		errorMsg += alert(msg + errorMsg);
		return false;
	}
	
	if (!(ChecaCpf(document.frmSenha.txtNumCpf.value))){
      return false;
	}	

   	if (document.frmSenha.txtNovaSenha.value!=""){
		if (document.frmSenha.txtNovaSenha.value!=document.frmSenha.txtConfirmaNovaSenha.value){
		   alert("A 'Nova Senha' está diferente de 'Confirma Nova Senha'.")
      		return false;
   		}
   	
		if (!(ChecaNovaSenha(document.frmSenha.txtNovaSenha.value))){
      		return false;
		}	
	}
	
	return true;	
}

