function xmlHttpInit() {

  var xmlhttp = null;

  /*@cc_on
	@if (@_jscript_version >= 5)
	  try {	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");	}
	  catch (e){
		try {	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
		catch (e2){}
	  }
    @end
  @*/

  if (!xmlhttp && typeof xmlhttp != "undefined") xmlhttp = new XMLHttpRequest();

  return xmlhttp;
}

function getCupom (c) {

  var connection = xmlHttpInit();

  if (connection != null) {
    connection.onreadystatechange = function () {
	  if (connection.readyState == 4) {
	    if (connection.status == 200) {
          assine.cupom.processValidate(connection.responseXML);
	    }
	    else alert("Erro: " + connection.statusText);
	  }
    };

    var time = new Date();
    var url = "http://www.dialhost.com.br/assine/validateCupom.php?cupom="+c+"&date="+time.getSeconds()+time.getMilliseconds();
    connection.open("GET",url,true);
	connection.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	connection.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
	connection.setRequestHeader("Pragma", "no-cache");
	connection.send(null);
  }

  delete connection;
}