//Resize Iframe
function resizeIframe(nome){
	frm = parent.document.getElementById(nome);
	div = document.getElementById("divVM");
	frm.height = div.scrollHeight + 2;
}

//Popup Padrão
function abrePopup(pagina,largura,altura,rolagem){
  var posX
  var posY
  posX = (window.screen.width - largura) / 2;
  posY = (window.screen.height - altura) / 2;
  window.open(pagina,"_blank","width="+largura+",height="+altura+",top="+posY+",left="+posX+",scrollbars="+rolagem+",toolbar=no,location=no,directories=no,menubar=no");
}


//Manipula Div
function divAbre(id) {
var div = document.getElementById(id);
	if (div.style.display == "none") {
		div.style.display = "block";
	} else {
		div.style.display = "none";
	}
}

//ABRE CARTAO
function abreWebcard(idcartao,id,imp){
  var posX;
  var posY;
  posX = (window.screen.width - 470) / 2;
  posY = (window.screen.height - 340) / 2;
  window.open("clube/cartoesvirtuais/cartao.asp?idcartao="+idcartao+"&idchama="+id+"&imprimir="+imp,"_blank","width=470,height=340,top="+posY+",left="+posX+",scrollbars=no,toolbar=no,location=no,directories=no,menubar=no");
}

//Valida Curriculo
function validaCurriculo(){
	with(document.contato){
		if (txtNome.value == ""){
			alert("Preencha seu nome.");
			txtNome.focus();
			return false;
		}
		if (txtEmail.value.indexOf("@",0) < 0 || txtEmail.value.indexOf(".")<0){
			alert("Preencha seu e-mail.");
			txtEmail.focus();
			return false;
		}
		if (txtArquivo.value == ""){
			alert("Selecione o currículo.");
			return false;
		}
		if (txtComentario.value == ""){
			alert("Preencha a mensagem.");
			txtComentario.focus();
			return false;
		}
		submit();
	}
}


//Contato Institucional
function validaContatoInst(){
	with(document.contato){
		if (txtNome.value == ""){
			alert("Preencha seu nome.");
			txtNome.focus();
			return false;
		}
		if (txtEmail.value.indexOf("@",0) < 0 || txtEmail.value.indexOf(".")<0){
			alert("Preencha seu e-mail.");
			txtEmail.focus();
			return false;
		}
		if (txtPara.value == "Selecione um destino"){
			alert("Selecione o destino.");
			txtPara.focus();
			return false;
		}
		if (txtComentario.value == ""){
			alert("Preencha a mensagem.");
			txtComentario.focus();
			return false;
		}
		submit();
	}
}



//Valida Indique News
function validaIndique(){
	with(document.indique){
		if (txtSeuNome.value == ""){
			alert("Preencha seu nome.");
			txtSeuNome.focus();
			return false;
		}
		if (txtSeuEmail.value.indexOf("@",0) < 0 || txtSeuEmail.value.indexOf(".")<0){
			alert("Preencha seu e-mail.");
			txtSeuEmail.focus();
			return false;
		}
		if (txtNomeAmigo.value == ""){
			alert("Preencha o nome de seu amigo(a).");
			txtNomeAmigo.focus();
			return false;
		}
		if (txtEmailAmigo.value.indexOf("@",0) < 0 || txtEmailAmigo.value.indexOf(".")<0){
			alert("Preencha o e-mail de seu amigo(a).");
			txtEmailAmigo.focus();
			return false;
		}
		if (txtMensagem.value == ""){
			alert("Preencha a mensagem.");
			txtMensagem.focus();
			return false;
		}
		submit();
	}
}
