function numeros(event) {
    if (!event) 
        var event = window.event;
   if(event.which)
      tecla = event.which;
   else if(event.keyCode) 
      tecla = event.keyCode;
    // Se for número (48 a 57) ou "/" (47) ou "backspace" (8)
    if ( (tecla >= 48 && tecla <= 57) || (tecla==8)) {
        return true;
    }
    else {
        return false;
    }
}




//-----------------------------------------------------------------------------------------------------------------------------------------
function apaganome(){
	document.newsletter.nome.value = "";
}
//------------------------------------------------------------------------------------------------------------------------------------------
function apagaemail(){
	document.newsletter.emailnews.value = "";
}
//------------------------------------------------------------------------------------------------------------------------------------------
function validaNewsletter(){
  if (document.newsletter.nome.value == "nome"){     
  alert("Preencha o campo nome.");
  document.newsletter.nome.focus();
  return false;
  }
  if (document.newsletter.emailnews.value.indexOf("@")==-1 || document.newsletter.emailnews.value.indexOf(".")==-1){     
  alert("Preencha o campo email com endereço válido.");
  document.newsletter.emailnews.focus();
  return false;
  }
  return true;
}
//------------------------------------------------------------------------------------------------------------------------------------------
function validaFaleconosco(){
  if (document.getElementById('nomefale').value == ""){     
  alert("Preencha o campo nome.");
  document.getElementById('nomefale').focus();
  return false;
  }
  if ((document.getElementById('emailfale').value.indexOf("@")==-1) || (document.getElementById('emailfale').value.indexOf(".")==-1)){     
  alert("Preencha o campo email com endereço válido.");
  document.getElementById('emailfale').focus();
  return false;
  }
  if (document.getElementById('telefone').value == ""){     
  alert("Preencha o campo telefone.");
  document.getElementById('telefone').focus();
  return false;
  }
  if (document.getElementById('assunto').value == "selecione"){     
  alert("Selecione um assunto.");
  document.getElementById('assunto').focus();
  return false;
  }
  if (document.getElementById('mensagem').value == ""){     
  alert("Escreva uma mensagem.");
  document.getElementById('mensagem').focus();
  return false;
  }
  return true;
}
//------------------------------------------------------------------------------------------------------------------------------------------
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//------------------------------------------------------------------------------------------------------------------------------------------
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_showHideLayers() { //v6.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];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//------------------------------------------------------------------------------------------------------------------------------------------
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//------------------------------------------------------------------------------------------------------------------------------------------
function popup(nome,w,h){
  window.open(nome,'popup','scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width='+w+',height='+h);
}
//------------------------------------------------------------------------------------------------------------------------------------------
function Pula_Cep_Proximo() {
  if(document.form1.cep1.value.length == 5)
    document.form1.cep2.focus()
}
//------------------------------------------------------------------------------------------------------------------------------------------
function Pula_Tel_Proximo() {
  if(document.form1.telefone1.value.length == 2)
    document.form1.telefone2.focus()
}
//------------------------------------------------------------------------------------------------------------------------------------------
function shc(divTo) {// Show Hide Changer
  if (document.getElementById(divTo).style.display == 'block') { 
    document.getElementById(divTo).style.display = 'none';
  }else{
    document.getElementById(divTo).style.display = 'block';
  }
}
//------------------------------------------------------------------------------------------------------------------------------------------
function validaClienteVip(){
  if (document.formcliente.nomevip.value == ""){     
  alert("Preencha o campo nome.");
  document.formcliente.nomevip.focus();
  return false;
  }
  if (document.formcliente.data.value == ""){     
  alert("Preencha o campo data.");
  document.formcliente.data.focus();
  return false;
  }
  if ((document.formcliente.emailvip.value.indexOf("@")==-1) || (document.formcliente.emailvip.value.indexOf(".")==-1)){     
  alert("Preencha o campo email com endereço válido.");
  document.formcliente.emailvip.focus();
  return false;
  }
  if (document.formcliente.cpf.value == ""){     
  alert("Preencha o campo CPF.");
  document.formcliente.cpf.focus();
  return false;
  } 
  if (document.formcliente.p1.value == ""){     
  alert("Preencha a pergunta 1.");
  document.formcliente.p1.focus();
  return false;
  }
  if (document.formcliente.p2.value == ""){     
  alert("Preencha a pergunta 2.");
  document.formcliente.p2.focus();
  return false;
  }
  if (document.formcliente.p3.value == ""){     
  alert("Preencha a pergunta 3.");
  document.formcliente.p3.focus();
  return false;
  }
  if (document.formcliente.p4.value == ""){     
  alert("Preencha a pergunta 4.");
  document.formcliente.p4.focus();
  return false;
  }
  if (document.formcliente.p5.value == ""){     
  alert("Preencha a pergunta 5.");
  document.formcliente.p5.focus();
  return false;
  }
  /*if (document.formcliente.p6.value == ""){     
  alert("Preencha a pergunta 6.");
  document.formcliente.p6.focus();
  return false;
  }*/
  if (document.formcliente.p7.value == ""){     
  alert("Preencha  a pergunta 7.");
  document.formcliente.p7.focus();
  return false;
  }
  if (document.formcliente.p8.value == ""){     
  alert("Preencha a pergunta 8.");
  document.formcliente.p8.focus();
  return false;
  }
  if (document.formcliente.p9.value == ""){     
  alert("Preencha a pergunta 9.");
  document.formcliente.p9.focus();
  return false;
  }
  if (document.formcliente.p10.value == ""){     
  alert("Preencha a pergunta 10.");
  document.formcliente.p10.focus();
  return false;
  }
  return true;
 }
 //------------------------------------------------------------------------------------------------------------------------------------------
 function validaClienteVip2(){  
  if (document.formcliente.p11.value == ""){     
  alert("Preencha a pergunta 11.");
  document.formcliente.p11.focus();
  return false;
  }
  if (document.formcliente.p12.value == ""){     
  alert("Preencha a pergunta 12.");
  document.formcliente.p12.focus();
  return false;
  }
  if (document.formcliente.p13.value == ""){     
  alert("Preencha a pergunta 13.");
  document.formcliente.p13.focus();
  return false;
  }
  if (document.formcliente.p14.value == ""){     
  alert("Preencha a pergunta 14.");
  document.formcliente.p14.focus();
  return false;
  }
  if (document.formcliente.p15.value == ""){     
  alert("Preencha a pergunta 15.");
  document.formcliente.p15.focus();
  return false;
  }
  if (document.formcliente.p16.value == ""){     
  alert("Preencha a pergunta 16.");
  document.formcliente.p16.focus();
  return false;
  }
  if (document.formcliente.p17.value == ""){     
  alert("Preencha a pergunta 17.");
  document.formcliente.p17.focus();
  return false;
  }
  if (document.formcliente.p18.value == ""){     
  alert("Preencha a pergunta 18.");
  document.formcliente.p18.focus();
  return false;
  }
  if (document.formcliente.p19.value == ""){     
  alert("Preencha a pergunta 19.");
  document.formcliente.p19.focus();
  return false;
  }
  if (document.formcliente.p20.value == ""){     
  alert("Preencha a pergunta 20.");
  document.formcliente.p20.focus();
  return false;
  }
  return true;
}
//------------------------------------------------------------------------------------------------------------------------------------------
function validaClienteVip3(){
  if (document.formcliente.p21.value == ""){     
  alert("Preencha a pergunta 21.");
  document.formcliente.p21.focus();
  return false;
  }
  if (document.formcliente.p22.value == ""){     
  alert("Preencha a pergunta 22.");
  document.formcliente.p22.focus();
  return false;
  }
  if (document.formcliente.p23.value == ""){     
  alert("Preencha a pergunta 23.");
  document.formcliente.p23.focus();
  return false;
  }
  if (document.formcliente.p24.value == ""){     
  alert("Preencha a pergunta 24.");
  document.formcliente.p24.focus();
  return false;
  }
  if (document.formcliente.p25.value == ""){     
  alert("Preencha a pergunta 25.");
  document.formcliente.p25.focus();
  return false;
  }
  if (document.formcliente.p26.value == ""){     
  alert("Preencha a pergunta 26.");
  document.formcliente.p26.focus();
  return false;
  }
  if (document.formcliente.p27.value == ""){     
  alert("Preencha a pergunta 27.");
  document.formcliente.p27.focus();
  return false;
  }
  if (document.formcliente.p28.value == ""){     
  alert("Preencha a pergunta 28.");
  document.formcliente.p28.focus();
  return false;
  }
  if (document.formcliente.p29.value == ""){     
  alert("Preencha a pergunta 29.");
  document.formcliente.p29.focus();
  return false;
  }
  if (document.formcliente.p30.value == ""){     
  alert("Preencha a pergunta 30.");
  document.formcliente.p30.focus();
  return false;
  }
  return true;
}
//------------------------------------------------------------------------------------------------------------------------------------------
function validaClienteVip4(){
  if (document.formcliente.p31.value == ""){     
  alert("Preencha a pergunta 31.");
  document.formcliente.p31.focus();
  return false;
  }
  if (document.formcliente.p32.value == ""){     
  alert("Preencha a pergunta 32.");
  document.formcliente.p32.focus();
  return false;
  }
  if (document.formcliente.p33.value == ""){     
  alert("Preencha a pergunta 33.");
  document.formcliente.p33.focus();
  return false;
  }
  if (document.formcliente.p34.value == ""){     
  alert("Preencha a pergunta 34.");
  document.formcliente.p34.focus();
  return false;
  }
  if (document.formcliente.p35.value == ""){     
  alert("Preencha a pergunta 35.");
  document.formcliente.p35.focus();
  return false;
  }
  if (document.formcliente.p36.value == ""){     
  alert("Preencha a pergunta 36.");
  document.formcliente.p36.focus();
  return false;
  }
  if (document.formcliente.p37.value == ""){     
  alert("Preencha a pergunta 37.");
  document.formcliente.p37.focus();
  return false;
  }
  if (document.formcliente.p38.value == ""){     
  alert("Preencha a pergunta 38.");
  document.formcliente.p38.focus();
  return false;
  }
  if (document.formcliente.p39.value == ""){     
  alert("Preencha a pergunta 39.");
  document.formcliente.p39.focus();
  return false;
  }
  if (document.formcliente.p40.value == ""){     
  alert("Preencha a pergunta 40.");
  document.formcliente.p40.focus();
  return false;
  }
  return true;
}
//------------------------------------------------------------------------------------------------------------------------------------------
var cont = new Array (40);
for(u=0; u <= 40; u++){
  cont[u] = 0;
}
function contador(unid,id,i,idp){
  //alert(unid+" "+id+" "+i);
  if(unid)
    cont[idp] = cont[idp] + 1;
  else
    cont[idp] = cont[idp] - 1; 
  if(cont[idp] >= i){
    document.getElementById(id).checked = false;
    cont[idp] = cont[idp] - 1;
    if(i==3)
      alert("Marcar até 2 respostas!");
    else
      alert("Marcar até 3 respostas!");
  }
}
//------------------------------------------------------------------------------------------------------------------------------------------
function validaEvento(){
  if (document.formevento.nomeevento.value == ""){     
  alert("Preencha o campo nome.");
  document.formevento.nomeevento.focus();
  return false;
  }
  if (document.formevento.tel.value == ""){     
  alert("Preencha o campo telefone.");
  document.formevento.tel.focus();
  return false;
  }
  if ((document.formevento.email.value.indexOf("@")==-1) || (document.formevento.email.value.indexOf(".")==-1)){     
  alert("Preencha o campo email com endereço válido.");
  document.formevento.email.focus();
  return false;
  }
  if (document.formevento.data.value == ""){     
  alert("Preencha o campo data.");
  document.formevento.data.focus();
  return false;
  }  
}
//------------------------------------------------------------------------------------------------------------------------------------------
function validaNupcias(){
  if (document.formnupcias.nomenupcias.value == ""){     
  alert("Preencha o campo nome.");
  document.formnupcias.nomenupcias.focus();
  return false;
  }
  if (document.formnupcias.tel.value == ""){     
  alert("Preencha o campo telefone.");
  document.formnupcias.tel.focus();
  return false;
  }
  if ((document.formnupcias.email.value.indexOf("@")==-1) || (document.formnupcias.email.value.indexOf(".")==-1)){     
  alert("Preencha o campo email com endereço válido.");
  document.formnupcias.email.focus();
  return false;
  }
  if (document.formnupcias.data.value == ""){     
  alert("Preencha o campo data.");
  document.formnupcias.data.focus();
  return false;
  }  
}
//-- Adobe Flash ------------------------------------------------------------------------------------------------------------
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
//-- Adobe Flash ------------------------------------------------------------------------------------------------------------
function validacpf(){ 
 var i; 
 s = document.formcliente.cpf.value; 
 var c = s.substr(0,9); 
 var dv = s.substr(9,2); 
 var d1 = 0; 
 for (i = 0; i < 9; i++) 
 { 
   d1 += c.charAt(i)*(10-i); 
 } 
 if (d1 == 0){ 
   alert("CPF Inválido") 
   return false; 
 } 
 d1 = 11 - (d1 % 11); 
 if (d1 > 9) d1 = 0; 
   if (dv.charAt(0) != d1){ 
     alert("CPF Inválido") 
     return false; 
   } 
   d1 *= 2; 
   for (i = 0; i < 9; i++){ 
     d1 += c.charAt(i)*(11-i); 
   } 
   d1 = 11 - (d1 % 11); 
   if (d1 > 9) d1 = 0; 
     if (dv.charAt(1) != d1){ 
       alert("CPF Inválido") 
       return false; 
     } 
   return true; 
 }
 //------------------------------------------------------------------------------------------------------------------------------------------
 function mascara_data(data){ 
   var mydata = ''; 
   mydata = mydata + data; 
   if (mydata.length == 2){ 
       mydata = mydata + '/'; 
       document.formcliente.data.value = mydata; 
   } 
   if (mydata.length == 5){ 
       mydata = mydata + '/'; 
       document.formcliente.data.value = mydata; 
   } 
}
//----------------------------------------------------------------------------------------------------------------------------------------
function camadas_div(divTo) {// Show Hide Changer

  if (document.getElementById(divTo).style.display == 'block') { 
  	document.getElementById(divTo).style.display = 'none';
  }else{
  	document.getElementById(divTo).style.display = 'block';
  }

}

function verifica_form_cartao() {
  if (document.formcartao.rem_nome.value == ""){     
  alert("Preencha o campo nome do remetente.");
  document.formcartao.rem_nome.focus();
  return false;
  }
  if (document.formcartao.rem_email.value == ""){     
  alert("Preencha o email do remetente.");
  document.formcartao.rem_email.focus();
  return false;
  }
  if (document.formcartao.dest_nome.value == ""){     
  alert("Preencha o campo nome do destinatário.");
  document.formcartao.dest_nome.focus();
  return false;
  }
  if (document.formcartao.dest_email.value == ""){     
  alert("Preencha o campo email do destinatário.");
  document.formcartao.dest_email.focus();
  return false;
  }
  return true;
}