// JavaScript Document
function OpenWin(file, name, width, height, scrollbars) {
	// Certifica-se de que uma dimensão de tela existe
	screen_width = 800;
	screen_height = 600;

	if (scrollbars) if (scrollbars !== '') scrollbars = ',' + scrollbars;

	// Dimensões da tela do usuário
	if (screen) if (screen.width) screen_width = screen.width;
	if (screen) if (screen.height) screen_height = screen.height;

	// Calcula a posição da janela no centro
	window_left = (screen_width / 2) - (width / 2);
	window_top = (screen_height / 2) - (height / 2);

	// Abre janela
	if (window) {
	   if (window.open) {
	      w = window.open(file,name,'width='+width+',height='+height+',left='+window_left+',top='+ window_top+',screenX='+window_left+',screenY='+ window_top+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollbars+',resizable=no,menubar=no');
	      if (w.moveTo)
	         w.moveTo(window_left, window_top);
	         if (w.focus)
	            w.focus();
				return w;
	   }
	}
}

function valida_form(){
	
	var erro ="";
	var cont = 0;
	
	nome = document.form.nome.value =="" ? erro += "\nPreencha seu NOME" : nome;
	email = document.form.email.value =="" || document.form.email.value.indexOf('@')==-1 || document.form.email.value.indexOf('.')==-1 ? erro += "\nPreencha seu E-MAIL" : email;
	cidade = document.form.cidade.value =="" ? erro += "\nPreencha sua CIDADE" : cidade;
	mensagem = document.form.mensagem.value.length == 0  ? erro += "\nEscreva sua MENSAGEM" : mensagem;
	
	if (erro == ""){
	document.form.submit();
	} else { alert("Os seguintes erros foram encontrados:\n"+ erro ); cont = 0; }
}

