<script type="text/javascript">

   var http_request = false;

   function makePOSTRequest(url, parameters) {

      http_request = false;

      if (window.XMLHttpRequest) { // Mozilla, Safari,...

         http_request = new XMLHttpRequest();

         if (http_request.overrideMimeType) {

            http_request.overrideMimeType('text/html');

         }

      } else if (window.ActiveXObject) { // IE

         try {

            http_request = new ActiveXObject("Msxml2.XMLHTTP");

         } catch (e) {

            try {

               http_request = new ActiveXObject("Microsoft.XMLHTTP");

            } catch (e) {}

         }

      }

      if (!http_request) {

         alert('Cannot create XMLHTTP instance');

         return false;

      }

      

      http_request.open('POST', url, true);

      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

      http_request.setRequestHeader("Content-length", parameters.length);

      http_request.setRequestHeader("Connection", "close");

      http_request.send(parameters);

   }







function Add(){

document.getElementById('lista').style.display='none';

document.getElementById('add').style.display = '';

}

function Cancelar(){

document.getElementById('add').style.display = 'none';

document.getElementById('lista').style.display='';

}

function Salvar(){

var nome = document.getElementById('nomec').value;

var email = document.getElementById('emailc').value;

if(nome=='' && email==''){

alert('Digite o nome e o email!');

}else{

var dados = "v1=" + encodeURI( document.getElementById("nomec").value ) +

"&v2=" + encodeURI( document.getElementById("emailc").value );

makePOSTRequest('../addons/newsletter/post.php', dados);

document.getElementById('acoes').innerHTML = '&nbsp;&nbsp;&nbsp;<b>Novo assinante salvo com sucesso...</b>';

document.getElementById('add').innerHTML = '';

//document.location.reload();

}

}

function Enviar(id){

if(confirm('Enviar Newsletter ao Contato Selecionado?')){

document.location.href ='index.php?ToDo=runAddon&addon=addon_newsletter&func=criar2&id='+id;

}

}

function abrir(URL) {



  var width = 4;

  var height = 100;



  var left = 199;

  var top = 199;



  window.open(URL,'janela', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');



}



function Deletar(id){

if(confirm('Excluir o Contato Selecionado?')){

document.location.href ='index.php?ToDo=runAddon&addon=addon_newsletter&func=deletar&id='+id;

}

}

</script>



