function NewWindow(mypage,myname,w,h,scroll){

LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;

TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',unresizable'

win = window.open(mypage,myname,settings)

if(win.window.focus){win.window.focus();}

}

function valida_fale (form) {
	if ( form.nome.value == "" ) {
		alert("Por favor, digite o seu nome.");
		form.nome.focus();
		return false;
	}
	if ( form.email.value == "" ) {
		alert("Por favor, digite o seu e-mail.");
		form.email.focus();
		return false;
	}
	if ( !valida_mail(form.email.value) ) {
		alert("Por favor, digite um e-mail valido.");
		form.email.focus();
		return false;
	}
	if ( form.msg.value == "" ) {
		alert("Por favor, digite a mensagem.");
		form.msg.focus();
		return false;
	}
	return true;
}

function valida_solicitacao_representante (form) {
	if ( form.nome.value == "" ) {
		alert("Por favor, digite o seu nome.");
		form.nome.focus();
		return false;
	}
	if ( form.empresa.value == "" ) {
		alert("Por favor, digite o nome da sua empresa.");
		form.empresa.focus();
		return false;
	}
	if ( form.cidade.value == "" ) {
		alert("Por favor, digite a cidade.");
		form.cidade.focus();
		return false;
	}
	if ( form.estado.value == "" ) {
		alert("Por favor, informe o estado.");
		form.estado.focus();
		return false;
	}
	if ( form.email.value == "" ) {
		alert("Por favor, digite o seu e-mail.");
		form.email.focus();
		return false;
	}
	if ( !valida_mail(form.email.value) ) {
		alert("Por favor, digite um e-mail valido.");
		form.email.focus();
		return false;
	}
	if ( form.tipo.value == "" ) {
		alert("Por favor, informe o tipo.");
		form.tipo.focus();
		return false;
	}
	return true;
}

function valida_busca_representante (form) {
	if ( form.pais.value == "" ) {
		alert("Por favor, selecione um pais.");
		form.pais.focus();
		return false;
	}
	if ( form.estado.value == "" && form.pais.value == "1" ) {
		alert("Por favor, selecione um estado.");
		form.estado.focus();
		return false;
	}
	return true;
}

function habilita_estado (form) {
	if ( form.pais.value == "1" ) {
		form.estado.disabled = false;
		MM_showHideLayers('div_estado','show','show');
		MM_showHideLayers('div_botao','hide','hide');
	}
	else {
		form.estado.disabled = true;
		MM_showHideLayers('div_estado','hide','hide');
	}
}

function MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) 
		if ((obj=MM_findObj(args[i]))!=null) {
			v=args[i+2];
			p=args[i+1];
			if (obj.style) { 
				obj=obj.style; 
				v=(v=='show')?'visible':(v='hide')?'hidden':v; 
			}
			obj.visibility=v;
		}
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function formata_cep (campo, event)  {
	var posNumeros = "01234678";
	var posEspacos = "5";
	var strNumeros = '0123456789';

	if ((event.keyCode == 8) || (event.keyCode == 46))
		return false;

	for (i = 0; i < campo.value.length; i++)
		if ((posNumeros.indexOf(i) != -1) && (strNumeros.indexOf(campo.value.substr(i, 1)) == -1)) {
			campo.value = campo.value.substr(0, i);
			return false;
		} else if ((posEspacos.indexOf(i) != -1) && (campo.value.substr(i, 1) != '-')) {
			campo.value = campo.value.substr(0, i);
			return false;
	}

	if (campo.value.length > 9)
		campo.value = campo.value.substr(0, 9);

	if (campo.value.length == 5)
		campo.value = campo.value + "-";
}

function valida_mail(valor) {
	prim = valor.indexOf("@")
	if(prim < 1) 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 FormataFloat(campo, event) {
	var strNumeros = '0123456789';
	var flgVirgula = false;

	for (i = 0; i < campo.value.length; i++)
		if ((strNumeros.indexOf(campo.value.substr(i, 1)) == -1) && !((i == 0) && (campo.value.substr(i, 1) == '-'))) {
			if ((i > 0) && (campo.value.substr(i, 1) == ',') && !flgVirgula)
				flgVirgula = true;
			else if ((i > 0) && (campo.value.substr(i, 1) == '.') && !flgVirgula) {
				flgVirgula = true;
				campo.value = campo.value.replace('.', ',');
			} else {
				campo.value = campo.value.substr(0, i);
				return false;
			}
		}
}

function FormataInteiroPositivo(campo, event) {
	var strNumeros = '0123456789';

	for (i = 0; i < campo.value.length; i++)
		if ((strNumeros.indexOf(campo.value.substr(i, 1)) == -1)) {
			campo.value = campo.value.substr(0, i);
			return false;
		}
}

function ValidaInteiro(valor) {
	var strNumeros = '0123456789';

	for (i = 0; i < valor.length; i++)
		if ((strNumeros.indexOf(valor.substr(i, 1)) == -1) && !((i == 0) && (valor.substr(i, 1) == '-')))
				return false;
	return true;
}

function ValidaInteiroPositivo(valor) {
	var strNumeros = '0123456789';

	for (i = 0; i < valor.length; i++)
		if ((strNumeros.indexOf(valor.substr(i, 1)) == -1) )
				return false;
	return true;
}

function FormataData(campo, event) {
	var posNumeros = "01346789";
	var posEspacos = "25";
	var strNumeros = '0123456789';

	if ((event.keyCode == 8) || (event.keyCode == 46))
		return false;

	for (i = 0; i < campo.value.length; i++)
		if ((posNumeros.indexOf(i) != -1) && (strNumeros.indexOf(campo.value.substr(i, 1)) == -1)) {
			campo.value = campo.value.substr(0, i);
			return false;
		} else if ((posEspacos.indexOf(i) != -1) && (campo.value.substr(i, 1) != '/')) {
			campo.value = campo.value.substr(0, i);
			return false;
	}

	if (campo.value.length > 10)
		campo.value = campo.value.substr(0, 10);

	if ((campo.value.length == 2) || (campo.value.length == 5))
		campo.value = campo.value + "/";
}

function ValidaData(valor) {
	if (valor.length == 0)
		return true;
	else if (valor.length != 10)
		return false;

	var dia = valor.substr(0, 2);
	var mes = valor.substr(3, 2);
	var ano = valor.substr(6, 4);

	if (!ValidaInteiro(dia)) return false;
	if (!ValidaInteiro(mes)) return false;
	if (!ValidaInteiro(ano)) return false;

	if (mes > 12 || mes < 1) return false;
	if (dia < 1) return false;
	if (ano < 1) return false;
	if ((mes == 1 || mes == 3 || mes == 5 || mes == 7 || mes == 8 || mes == 10 || mes == 12) && dia > 31) return false;
	if ((mes == 4 || mes == 6 || mes == 9 || mes == 11) && dia > 30) return false;
	if (mes == 2 && ano % 4 && dia > 29) return false;
	if (mes == 2 && !(ano % 4) != 0 && dia > 28) return false;
	return true;
}




<!--


  // this function is need to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   

 function stripe(id) {

   
    var even = false;
  
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
  
    var table = document.getElementById(id);
    if (! table) { return; }
   
    var tbodies = table.getElementsByTagName("tbody");

    for (var h = 0; h < tbodies.length; h++) {
    
      var trs = tbodies[h].getElementsByTagName("tr");
      
      for (var i = 0; i < trs.length; i++) {

	   
	    if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) {
 

          var tds = trs[i].getElementsByTagName("td");
        
         
          for (var j = 0; j < tds.length; j++) {
        
            var mytd = tds[j];


	        if (! hasClass(mytd) && ! mytd.style.backgroundColor) {
        
		      mytd.style.backgroundColor = even ? evenColor : oddColor;
              
            }
          }
        }

        even =  ! even;
      }
    }
  }
// -->
