// JavaScript Document


function xmlhttpPost(voteko, sexko) {
	canName = voteko;
	canSex = sexko;
	
    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 strURL2 = "http://www.norsu-pageant.com/saveip.php";
    self.xmlHttpReq.open('POST', strURL2, 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;
	
    qstr2 = 'voteEmail=' + escape(voteEmail) + '&canName=' + escape(canName) + '&canSex=' + escape(canSex); 

	return qstr2;

}

function updatepage(str2){
	
    	document.getElementById("result").innerHTML = str2;
		document.getElementById("voteEmail").value = "";
	

}