function NewWindow(mypage, w, h, scroll) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',noresize'
  win = window.open(mypage, 'pop', winprops)
  if (parseInt(navigator.appVersion) >= 4) 
    { win.window.focus(); }
}

function change(what, alternative){
	var alvo = document.getElementById("muda");
	alvo.src = "imagens/parceiros_logo_"+what+".jpg";
	alvo.alt = alternative;
}

function checkdataContato() {
	with(document.contato) {	
		if (nome.value == "") {
			alert("Nome é um campo obrigatório.");
			nome.focus();
			return false;
		}
		
		if (telefone.value == "") {
			alert("Telefone é um campo obrigatório.");
			telefone.focus();
			return false;
		}
	
		if ((email.value == "") || (!valida_mail(email.value))){
			alert("Por favor, digite um email válido.");
			email.focus();
			return false;
		}

		if (mensagem.value == "") {
			alert("Mensagem é um campo obrigatório.");
			mensagem.focus();
			return false;
		}

	  submit();
	}
}

function checkdataNewsletter() {
	with(document.newsletter) {	
		if (news_nome.value == "") {
			alert("Nome é um campo obrigatório.");
			news_nome.focus();
			return false;
		}
		
		if ((news_email.value == "") || (!valida_mail(news_email.value))){
			alert("Por favor, digite um email válido.");
			news_email.focus();
			return false;
		}

	  submit();
	}
}

function valida_mail(valor) {
	prim = valor.indexOf("@")
	if(prim < 2) return false;
	if(valor.indexOf("@",prim + 1) != -1) return false
	if(valor.indexOf(".") < 1) return false;
	if(valor.indexOf("zipmeil.com") > 0) return false;
	if(valor.indexOf("hotmeil.com") > 0) return false;
	if(valor.indexOf(".@") > 0) return false;
	if(valor.indexOf("@.") > 0) return false;
	if(valor.indexOf(".com.br.") > 0) return false;
	if(valor.indexOf("/") > 0) return false;
	if(valor.indexOf("[") > 0) return false;
	if(valor.indexOf("]") > 0) return false;
	if(valor.indexOf("(") > 0) return false;
	if(valor.indexOf(")") > 0) return false;
	if(valor.indexOf("..") > 0) return false;
	if(valor.indexOf(",") > 0) return false;
	return true;
}
