// JavaScript Document.

// a funcao abaixo funciona em qualquer
 // browser ou versão.  
 function createXMLHTTP() 
 {
  var ajax;
  try 
  {
   ajax = new ActiveXObject("Microsoft.XMLHTTP");
  } 
  catch(e) 
  {
   try 
   {
    ajax = new ActiveXObject("Msxml2.XMLHTTP");
    alert(ajax);
   }
   catch(ex) 
   {
    try 
    {
     ajax = new XMLHttpRequest();
    }
    catch(exc) 
    {
      alert("Esse browser não tem recursos para uso do Ajax");
      ajax = null;
    }
   }
   return ajax;
  }
 
 
     var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
           "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
           "Microsoft.XMLHTTP"];
     for (var i=0; i < arrSignatures.length; i++) 
     {
    try 
    {
     var oRequest = new ActiveXObject(arrSignatures[i]);
     return oRequest;
    } 
    catch (oError) 
    {
       }
     }
  
      throw new Error("MSXML is not installed on your system.");
 }


function Cadastro(){
  document.getElementById('maismenos').innerHTML = '<table border="0" width="235" cellspacing="3" cellpadding="0"><tr><td width="104"><span class="link">E-mail:</span></td><td width="96"><input type="text" name="Email" id="Email" style="font-size:10px; font-family:Arial;height:10px;width=150px"></td><td width="32" align="bottom"><div align="center"><input type="image" src="images/IconeOk.gif" height="17" width="19" onClick="CadEmail()"/>a</div></td></tr></table>';    
}

function CadastroInicio(){

  document.getElementById('maismenos').innerHTML = '<a href="#" onclick="Cadastro()" class="link">Para receber informa&ccedil;&otilde;es sobre estr&eacute;ias, promo&ccedil;&otilde;es e muito mais.</a>';

}

function CadEmail(){
var Ajax 
	try {Ajax = new XMLHttpRequest();
	}catch(ee) { 
	try {Ajax = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e) { 
	try {Ajax = new ActiveXObject("Microsoft.XMLHTTP");
	}catch(e) {Ajax = false; 
	}
	}
	}
var url ="EnviaEmailPromocao.php";
// pegando os campos do formulário
var VEmail = document.getElementById('Email').value;
var VPromocao = document.getElementById('Promocao').value;

//parâmetros a serem enviados
var params = "Email="+VEmail+"&Promocao="+VPromocao; 
//envia para a página que fará o select do que foi digitado e responderá com o status da ação
Ajax.open("post", url, true);
Ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
Ajax.onreadystatechange=function(){
}

Ajax.send(params);

var time = setInterval("CadastroInicio()",4000);
document.getElementById('maismenos').innerHTML = '<table border="0" height="24" cellspacing="3" cellpadding="2"><tr><td width="184">Cadastrado com sucesso!<BR></td></tr></table>';
  
}

function banner_horizontal(){

var body = "";



        if (window.XMLHttpRequest) {

                xmlhttp = new XMLHttpRequest();

        } else if (window.ActiveXObject) {

                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

        } else {

            alert("Seu navegador não suporta XMLHttpRequest.");

                return;

        }



    xmlhttp.open("POST", "banner_horizontal.php?banner=1", true);

    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");

    xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");

    xmlhttp.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");

    xmlhttp.setRequestHeader("Pragma", "no-cache");



    xmlhttp.onreadystatechange = processReqChange;

    xmlhttp.send(null);



}



function processReqChange() {

    if (xmlhttp.readyState == 4) {

            if (xmlhttp.status == 200) {

                document.getElementById('banner_horizontal').innerHTML = xmlhttp.responseText;

                //document.getElementById('mensagem').value = document.getElementById('mensagem').value;

                } else {

                    alert("Problemas ao carregar o arquivo.");

                }

    }

}



function banner_horizontal2(){

var body = "";



        if (window.XMLHttpRequest) {

                xmlhttp3 = new XMLHttpRequest();

        } else if (window.ActiveXObject) {

                xmlhttp3 = new ActiveXObject("Microsoft.XMLHTTP");

        } else {

            alert("Seu navegador não suporta XMLHttpRequest.");

                return;

        }



    xmlhttp3.open("POST", "banner_horizontal2.php?banner=1", true);

    xmlhttp3.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");

    xmlhttp3.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");

    xmlhttp3.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");

    xmlhttp3.setRequestHeader("Pragma", "no-cache");



    xmlhttp3.onreadystatechange = processReqChange3;

    xmlhttp3.send(null);



}



function processReqChange3() {

    if (xmlhttp3.readyState == 4) {

            if (xmlhttp3.status == 200) {

                document.getElementById('banner_horizontal2').innerHTML = xmlhttp3.responseText;

                //document.getElementById('mensagem').value = document.getElementById('mensagem').value;

                } else {

                    alert("Problemas ao carregar o arquivo.");

                }

    }

}


function banner_vertical(){

        if (window.XMLHttpRequest) {

                xmlhttp1 = new XMLHttpRequest();

        } else if (window.ActiveXObject) {

                xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");

        } else {

            alert("Seu navegador não suporta XMLHttpRequest.");

                return;

        }



    xmlhttp1.open("POST", "banner_vertical.php", true);

    xmlhttp1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");

    xmlhttp1.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");

    xmlhttp1.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");

    xmlhttp1.setRequestHeader("Pragma", "no-cache");



    xmlhttp1.onreadystatechange = processReqChange1;

    xmlhttp1.send(null);



}



function processReqChange1() {

    if (xmlhttp1.readyState == 4) {

            if (xmlhttp1.status == 200) {

                document.getElementById('banner_vertical').innerHTML = xmlhttp1.responseText;

                //document.getElementById('mensagem').value = document.getElementById('mensagem').value;

                } else {

                    alert("Problemas ao carregar o arquivo.");

                }

    }

}




function banner_vertical2(){

        if (window.XMLHttpRequest) {

                xmlhttp2 = new XMLHttpRequest();

        } else if (window.ActiveXObject) {

                xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");

        } else {

            alert("Seu navegador não suporta XMLHttpRequest.");

                return;

        }



    xmlhttp2.open("POST", "banner_vertical2.php", true);

    xmlhttp2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");

    xmlhttp2.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");

    xmlhttp2.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");

    xmlhttp2.setRequestHeader("Pragma", "no-cache");



    xmlhttp2.onreadystatechange = processReqChange2;

    xmlhttp2.send(null);



}



function processReqChange2() {

    if (xmlhttp2.readyState == 4) {

            if (xmlhttp2.status == 200) {

                document.getElementById('banner_vertical2').innerHTML = xmlhttp2.responseText;

                //document.getElementById('mensagem').value = document.getElementById('mensagem').value;

                } else {

                    alert("Problemas ao carregar o arquivo.");

                }

    }

}