// JavaScript Document

function xmlhttpPost(voteko) {
    canName = voteko;

    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");
    }


    var strURL = "http://www.missbayawan.com/saveip.php";
    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());
	
}

//   The following function obtains two variables from your form (email and message) 
//   and builds a string that gets sent to your PHP script.  Change this function to
//   obtain whatever fields you want from your form.

function getquerystring() {

    var form = document.forms['form2'];
    var voteEmail = form.voteEmail.value;
    qstr = 'voteEmail=' + escape(voteEmail) + '&canName=' + escape(canName); 

    return qstr; 

}

function updatepage(str){

    	document.getElementById("result").innerHTML = str;
	document.getElementById("voteEmail").value = "";

}