var xmlhttp;


/* hotornot_randombox */

function ajax_hotornot_randombox_vote(star,vote) {
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		/*alert ("Browser does not support HTTP Request");*/
		return;
	}
	var url="ajax.php?key=saL7kNn3acl4v8Qo&ajaxaction=hotornot_randombox_vote&star="+star+"&vote="+vote+"&sid="+Math.random();
	xmlhttp.onreadystatechange=ajax_hotornot_randombox_stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function ajax_hotornot_randombox_stateChanged() {
	if (xmlhttp.readyState==4) {
		document.getElementById("hotornot_randombox").innerHTML=xmlhttp.responseText;
	}
}


/* hotornot_top3 */

function ajax_hotornot_top3_vote(star,vote) {
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		/*alert ("Browser does not support HTTP Request");*/
		return;
	}
	var url="ajax.php?key=saL7kNn3acl4v8Qo&ajaxaction=hotornot_top3_vote&star="+star+"&vote="+vote+"&sid="+Math.random();
	xmlhttp.onreadystatechange=ajax_hotornot_top3_stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function ajax_hotornot_top3_stateChanged() {
	if (xmlhttp.readyState==4) {
		document.getElementById("hotornot_top3").innerHTML=xmlhttp.responseText;
	}
}

/* poll */

function ajax_poll_vote(poll_id,answer_id) {
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		/*alert ("Browser does not support HTTP Request");*/
		return;
	}
	var url="ajax.php?key=saL7kNn3acl4v8Qo&ajaxaction=poll_vote&poll_id="+poll_id+"&answer_id="+answer_id+"&sid="+Math.random();
	xmlhttp.onreadystatechange=ajax_poll_stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function ajax_poll_stateChanged() {
	if (xmlhttp.readyState==4) {
		document.getElementById("poll").innerHTML=xmlhttp.responseText;
	}
}

/* poll_box */

function ajax_poll_box_vote(poll_id,answer_id) {
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		/*alert ("Browser does not support HTTP Request");*/
		return;
	}
	var url="ajax.php?key=saL7kNn3acl4v8Qo&ajaxaction=poll_box_vote&poll_id="+poll_id+"&answer_id="+answer_id+"&sid="+Math.random();
	xmlhttp.onreadystatechange=ajax_poll_box_stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function ajax_poll_box_stateChanged() {
	if (xmlhttp.readyState==4) {
		document.getElementById("poll_box").innerHTML=xmlhttp.responseText;
	}
}


/* - - - */

function GetXmlHttpObject() {
	var objXMLHttp=null;
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}
