function Tecla(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;
					//return false;
				else
					return true;
			}
}

function limpaCamposEmail(){
	document.getElementById('Passwd').value = "";
}

function chamaLimpaCamposEmail(){
	setTimeout("limpaCamposEmail()", 3000);
}

function ValidaEmail(txt)
{  
  if ((txt.length < 6) || (txt.indexOf("@") < 1) || (txt.indexOf('.') <= 4))
     return false;	
  else
  	 return true;
}

function gravaDadosNews(){
	var form = document.form_news;
	var nome = form.nome_news.value;
	var email = form.email_news.value;
	var iframe = document.getElementById('iframeDados');
	
	if(nome == '' || email == ''){
		alert("Preencha todos os campos!");
		return
	}
	
	if(!ValidaEmail(email)){
		alert("O email digitado não pode ser válido!");
		return
	}	
	iframe.src = "iframeGravacao.php?nome=" + nome + "&acao=news&email=" + email;
	
	form.nome_news.value = '';
	form.email_news.value = '';
	//alert(nome+email);	
}

function validaCamposContato(){
	var form = document.form_contato;
	
	if(form.nome.value == '' || form.email.value == '' || form.cidade.value == '' || form.uf.value == '' || form.mensagem.value == ''){
		alert("Preencha todos os campos obrigatorios");
		return;
	}
	
	if(!ValidaEmail(form.email.value)){
		alert("O email digitado não pode ser válido!");
		return;
	}
	
	form.submit();
	
	form.nome.value = '';
	form.email.value = '';
	form.cidade.value = '';
	form.uf.value = '';
	form.mensagem.value = '';
	form.telefone.value = '';
	
}

function divPopUp(pagina, w ,h){
	/*var div = document.getElementById('divPopUp');
	div.style.display = "block";
	var texto;
	
	texto = "<BR><BR><BR><table width='" + w + "' cellspacing='0' cellpadding='0'>" +
			"<tr><td align='right'><img src='img/bt_fechar.jpg' onclick='parent.abreFechaDiv(\"divPopUp\")' /></td></tr></table>" +
			"<iframe src='" + pagina + "' width='" + w + "' height='" + h + "' frameborder='0' scrolling='no' class='bordaFrame'>" + pagina + "</iframe>";
			
	div.innerHTML = texto;*/
	document.getElementById('PopupContainer').style.display = "block";
	document.getElementById("PopupFrame").src = pagina;
	//alert(1);
	//showPopWin(pagina, w, h, null, '', false);
}

function abreFechaDiv(div){
	if(document.getElementById(div).style.display == 'block')
		document.getElementById(div).style.display = 'none';
	else
		document.getElementById(div).style.display = 'block';
}

function abreDiv(div){
	document.getElementById(div).style.display = 'block';
}

function fechaDiv(div){
	document.getElementById(div).style.display = 'none';
}
