// JavaScript Document
function abreNoticia(idNoticia){
	document.location = "?area=noticia&idNoticia="+idNoticia;
}
function limpaIndique(){
	document.getElementById("txtNome").value = "";
	document.getElementById("txtEmail").value = "";
	document.getElementById("txtNomeAmigo").value = "";
	document.getElementById("txtEmailAmigo").value = "";
	document.getElementById("txtMensagem").value = "";
	document.getElementById("txtNome").focus();
}
function enviaIndique(){
	if (document.getElementById("txtNome").value == ""){
		alert("É necessário o preenchimento do SEU NOME!");
		document.getElementById("txtNome").focus();
		return false;
	}
	if (document.getElementById("txtEmail").value == ""){
		alert("É necessário o preenchimento do SEU EMAIL!");
		document.getElementById("txtEmail").focus();
		return false;
	}
	qtdArroba = document.getElementById("txtEmail").value.split('@');
	if (document.getElementById("txtEmail").value.search("@") == -1 || document.getElementById("txtEmail").value.search("[.]") == -1 || document.getElementById("txtEmail").value.search(" ") != -1 || qtdArroba.length !=2 || qtdArroba[0] == "" || qtdArroba[1] == "" || qtdArroba[1] == "."){ 
		alert("O preenchimento do campo SEU E-MAIL está incorreto!"); 
		document.getElementById("txtEmail").focus(); 
		return false; 
	}
	if (document.getElementById("txtNomeAmigo").value == ""){
		alert("É necessário o preenchimento do NOME DO SEU AMIGO!");
		document.getElementById("txtNomeAmigo").focus();
		return false;
	}
	if (document.getElementById("txtEmailAmigo").value == ""){
		alert("É necessário o preenchimento do EMAIL DO SEU AMIGO!");
		document.getElementById("txtEmailAmigo").focus();
		return false;
	}
	qtdArroba = document.getElementById("txtEmailAmigo").value.split('@');
	if (document.getElementById("txtEmailAmigo").value.search("@") == -1 || document.getElementById("txtEmailAmigo").value.search("[.]") == -1 || document.getElementById("txtEmailAmigo").value.search(" ") != -1 || qtdArroba.length !=2 || qtdArroba[0] == "" || qtdArroba[1] == "" || qtdArroba[1] == "."){ 
		alert("O preenchimento do campo E-MAIL DO SEU AMIGO está incorreto!"); 
		document.getElementById("txtEmailAmigo").focus(); 
		return false; 
	}
	document.getElementById("formIndique").submit();
}
function limpaFale(){
	document.getElementById("txtNome").value = "";
	document.getElementById("txtEmail").value = "";
	document.getElementById("txtTelefone").value = "";
	document.getElementById("txtAssunto").value = "";
	document.getElementById("txtMensagem").value = "";
	document.getElementById("first").selected=true;
	document.getElementById("txtNome").focus();
}
function enviaFale(){
	if (document.getElementById("txtNome").value == ""){
		alert("É necessário o preenchimento do SEU NOME!");
		document.getElementById("txtNome").focus();
		return false;
	}
	if (document.getElementById("txtEmail").value == ""){
		alert("É necessário o preenchimento do SEU EMAIL!");
		document.getElementById("txtEmail").focus();
		return false;
	}
	qtdArroba = document.getElementById("txtEmail").value.split('@');
	if (document.getElementById("txtEmail").value.search("@") == -1 || document.getElementById("txtEmail").value.search("[.]") == -1 || document.getElementById("txtEmail").value.search(" ") != -1 || qtdArroba.length !=2 || qtdArroba[0] == "" || qtdArroba[1] == "" || qtdArroba[1] == "."){ 
		alert("O preenchimento do campo SEU E-MAIL está incorreto!"); 
		document.getElementById("txtEmail").focus(); 
		return false; 
	}
	if (document.getElementById("txtTelefone").value == ""){
		alert("É necessário o preenchimento do TELEFONE!");
		document.getElementById("txtTelefone").focus();
		return false;
	}
	if (document.getElementById("txtAssunto").value == ""){
		alert("É necessário o preenchimento do ASSUNTO!");
		document.getElementById("txtAssunto").focus();
		return false;
	}
	if (document.getElementById("txtMensagem").value == ""){
		alert("É necessário o preenchimento da MENSAGEM!");
		document.getElementById("txtMensagem").focus();
		return false;
	}
	document.getElementById("formFale").submit();
}
function validarCodAcesso()
{
	codAcesso = document.getElementById("txtCodAcesso");
	if(codAcesso.value == ""){
		alert("Por favor, preencha o campo CÓDIGO corretamente");
		codAcesso.focus();
		return false;
	}
	var checkOK = "0123456789--";
	var checkStr = codAcesso.value;
	var allValid = true;
	var checkOKVerif = checkOK.length - 1;
	for (i = 0;  i < checkStr.length;  i++){
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++){
			if (ch == checkOK.charAt(j)){
				break;
			}
			if (j == checkOKVerif){
				allValid = false;
				break;
			}
		}
		if (!allValid){
			alert("Digite somente números no campo Código.");
			codAcesso.focus();
			return false;
		}
	}
	document.getElementById("formBercario").action="verificaAIH.asp";
	document.getElementById("formBercario").submit();
	return true;
}
function focusCodigo(){
	document.getElementById("txtCodAcesso").focus();
}
function validaRecado()
{
	if(document.getElementById("txtNome").value == ""){
		alert("Por favor, preecha o campo NOME corretamente!")
		document.getElementById("txtNome").focus();
		return false;
	}
	else if(document.getElementById("txtMensagem").value == "")
	{
		alert("Por favor, preencha o campo MENSAGEM corretamente!")
		document.getElementById("txtMensagem").focus();
		return false;
	}
	document.getElementById("formRecado").submit();
}
function limpaFormRecado()
{
	document.getElementById("txtNome").value = "";	
	document.getElementById("txtEmail").value = "";
	document.getElementById("txtMensagem").value = "";
	
	document.getElementById("txtNome").focus();
}
function ampliaFoto(ordem)
{
	var largura =500;
	var altura =363;
	var posicaoX = (screen.availWidth-largura)/2;
	var posicaoY = (screen.availHeight-altura)/2;		
		
	fotoAmpliada = window.open('/bercario/fotoAmpliada.asp?ordem='+ordem,'fotoBebe','status=no,resizable=no,scrollbars=no,menubar=no,width='+largura+',height='+altura+',left='+posicaoX+',top='+posicaoX);
	fotoAmpliada.focus();	
}
function detalheExame(seq)
{
	var largura = 740;
	var altura = 500;
	var posicaoX = (screen.availWidth-largura)/2;
	var posicaoY = (screen.availHeight-altura)/2;		
		
	windowDetalhe = window.open('detalhes.asp?seq='+seq,'DetalheExame','status=no,resizable=no,scrollbars=yes,menubar=no,width='+largura+',height='+altura+',left='+posicaoX+',top='+posicaoX);
	windowDetalhe.focus();
	
}
function abrePopUp(pagina,width,height){	
	popUp = window.open(pagina,'AbrePopUp','status=no,resizable=no,scrollbars=no,menubar=no,width='+width+',height='+height+',left=20,top=20');
	popUp.focus();
}

function abrePopUp2(pagina,width,height){	
	popUp = window.open(pagina,'AbrePopUp2','status=no,resizable=no,scrollbars=no,menubar=no,width='+width+',height='+height+',left=200,top=200');
	popUp.focus();
}