// JavaScript Document
function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getquerystring());
}

function getquerystring() {
    var form     = document.forms['f1'];
    var em = form.subemail.value;
    qstr = 'em=' + escape(em);  // NOTE: no '?' before querystring
    return qstr;
}

function updatepage(str){
	if (document.getElementById("SubSubscribe")) {
		document.getElementById("SubSubscribe").innerHTML = str;
	}
}

function doformsub() {
	xmlhttpPost("/email_subscribe_sub.php")
}
function doformsubu() {
	xmlhttpPost("/email_subscribe_subu.php")
}

//prevent form from submitting by hitting enter
function disableEnterKey(e)
{
     var key;
     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox
     if(key == 13)
          return false;
     else
          return true;
}

