//Modal
var Campo;

function Alert(Titulo, Icone, Mensagem) {
	if (Icone == "") {
		Icone = "alerta.png";
	}
	document.getElementById("icone").src = "Img/" + Icone;
	document.getElementById("tituloModal").innerHTML = Titulo;
	document.getElementById("mensagem").innerHTML = Mensagem;
	ExibeModal();
}

function ExibeModal() {
	document.getElementById("modal").style.display = 'block';
}

function OcultaModal() {
	document.getElementById("modal").style.display = 'none';
	if (typeof (Campo) != 'undefined') {
		Campo.focus();
	}
}


//verifica F5
function Verificar() {
	var tecla = window.event.keyCode;
	if (tecla == 116) {
		//alert("ERROR!");
		window.parent.frames['ifConteudo'].window.location.reload(); 
		event.keyCode = 0;
		event.returnValue = false;
	}
}


 //Validacao do formulario
function validar() {
	if (document.FormContato.Nome.value == "") {

		Alert("Contato", "", "Por favor, digite seu nome!");
		Campo = document.FormContato.Nome;
		return false;
	}

	if (document.FormContato.Email.value == "") {
		Alert("Contato", "", "Por favor, digite seu e-mail!");
		Campo = document.FormContato.Email;
		return false;
	}

	if (document.FormContato.Telefone.value == "") {
		Alert("Contato", "", "Por favor, digite seu telefone!")
		Campo = document.FormContato.Telefone;
		return false;
	}

	if (document.FormContato.Assunto.value == "") {
		Alert("Contato", "", "Por favor, digite o assunto do contato!")
		Campo = document.FormContato.Assunto;
		return false;
	}

	if (document.FormContato.Mensagem.value == "") {
		Alert("Contato", "", "Por favor, digite sua mensagem!")
		Campo = document.FormContato.Mensagem;
		return false;
	}

	document.FormContato.submit();
}


function Confirmacao() {
	Alert("Contato", "aprovacao.png", "Sua mensagem foi enviada com sucesso.\nEm breve entraremos em contato.\nObrigado!");
	Campo = null;
}

//Carrega Iframe
function loadIframe(iframeName, url) {
	if (window.parent.document.getElementById(iframeName)) {
		window.parent.document.getElementById(iframeName).src = url;
		return false;
	}
	else
		return true;
}
