function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function valida_fale(form){
	if (form.nome.value==""){
		alert("Por favor, digite seu nome.");
		form.nome.focus();
		return false;
	}

	if (form.email.value==""){
		alert("Por favor, digite seu email.");
		form.email.focus();
		return false;
	}
	if (!valida_mail(form.email.value)){
		alert("Por favor, digite um email válido.");
		form.email.focus();
		return false;
	}
	if (form.telefone.value==""){
		alert("Por favor, digite o telefone.");
		form.telefone.focus();
		return false;
	}
	if (form.contato.value==""){
		alert("Por favor, escolha qual empresa você deseja entrar em contato.");
		form.contato.focus();
		return false;
	}

	if (form.msg.value==""){
		alert("Por favor, digite sua mensagem.");
		form.msg.focus();
		return false;
	}

	return true;
}

	function popup(URL,w,h,nome) {
	largura = w;
	altura = h;
//	X = (screen.availWidth - largura) / 2;
	X = "0";
//	Y = (screen.availHeight - altura) / 2;
	Y = "0";
		window.open(URL,nome,'width=' + largura + ',height=' + altura + ',top=' + Y + ',left=' + X + ',screenX=' + X + ',screenY=' + Y );
	}

function valida_news(form){
	if (form.nome.value == ""){
		alert("Por favor, digite seu nome.");
		form.nome.focus();
		return false;
	}

	if (form.email.value == ""){
		alert("Por favor, digite seu email.");
		form.email.focus();
		return false;
	}
	if (!valida_mail(form.email.value)){
		alert("Por favor, digite um email valido.");
		form.email.focus();
		return false;
	}
	if (form.empresa.value==""){
		alert("Por favor, informe qual empresa do grupo você deseja receber informações.");
		form.empresa.focus();
		return false;
	}
	if (form.receber[0].checked == false && form.receber[1].checked == false ){
		alert("Por favor, escolha uma opção.");
		form.receber[0].focus();
		return false;
	}

	if (form.receber[0].checked == true ){
		receber = form.receber[0].value
	}else if (form.receber[1].checked == true ){
		receber = form.receber[1].value
	}

popup('news.asp?nome='+form.nome.value+'&email='+form.email.value+'&receber='+receber+'',360,200);

return false;

}


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;
		
}

function valida_num( numero ) {
	for ( var i = 0; i < numero.length ; i++ )
		if ( numero.substring(i, i+1) < '0' || numero.substring(i, i+1) > '9'  ) 
			return true;
	return false;
}

