function assinarNewsLetter(){
    email = document.getElementById('newsletter');
    if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value))){
        alert("E-Mail Inválido! \nPor favor preencha o campo com um e-mail válido e tente novamente.");
        email.focus();
    }else{
          var httpi = getHTTPObject();
          httpi.open("GET", "index.php?nm="+email.value, true);
          httpi.onreadystatechange = function(){
               if (httpi.readyState == 4) {
                     if (httpi.responseText == "OK"){
                       alert("E-Mail cadastrado na newsletter com sucesso!")
                     }else{
                       alert("Não foi possível cadastrar o seu e-mail no newsletter");
                     }
                     email.value = "";
               }
          }
          httpi.send(null);
          email.value = "Enviando...";
    }
}

function sendForm(f) {
      var exibeResultado;
      var resultado = getFormValues(f);
      var httpx = getHTTPObject();

      httpx.open("POST", "iss.php", true);
      httpx.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
      httpx.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
      httpx.setRequestHeader("Pragma", "no-cache");

      httpx.onreadystatechange = function() {
         if (httpx.readyState == 4) {
            if (httpx.status == 200) {
               if(httpx.responseText=="OK"){
                    document.getElementById(f).innerHTML = "Seu formulário foi enviado com sucesso!<br />Aguarde retorno por e-mail ou por telefone!";
               }else{
                    document.getElementById(f).innerHTML = "Não foi possível enviar o formulário, tente mais tarde!"+"<br />ERRO:"+httpx.responseText;
               }
            }
         }
      }
      document.getElementById(f).innerHTML = "Enviando...";
      httpx.send(resultado);
}
function getFormValues(f) {
   form = document.getElementById(f);
   var str = "";
   for(var i=0; i<form.elements.length; i++) {
      str += i==0 ? '' : '&';
      str += form.elements[i].id+'='+form.elements[i].value;
   }
   return str;
}

function opup(imagem){
   impop = window.open("iss.php?impop="+imagem,'artestampop','height=360,width=480');
   impop.focus();
}
function opup_home(imagem){
   impop = window.open("iss.php?impop_h="+imagem,'artestampop','height=240,width=360');
   impop.focus();
}

function switchMop(id){
	if(document.getElementById("mopa"+id).style.display=="none"){
		document.getElementById("mopa"+id).style.display="block";
		document.getElementById("mop"+id).style.background="#FF6600";	
	}else{
		document.getElementById("mopa"+id).style.display="none";
		document.getElementById("mop"+id).style.background="#C20904";
	}
}