function checkPoll(){
	if (window.XMLHttpRequest){ xhttp=new XMLHttpRequest(); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
	xhttp.open("GET","http://nsfwshow.com/dynamic/txt/poll_active.xml",false);
	xhttp.send("");
	xmlDoc=xhttp.responseXML;
	
	pollStatus = xmlDoc.getElementsByTagName("active")[0].childNodes[0].nodeValue;
	if(pollStatus == 0){
		$("#poll-box").hide();
		setTimeout("checkPoll()", 5000);
	} else if(pollStatus == 1) {
		$("#poll-box").show();
		$("#poll").load("../../dynamic/php/poll/question.php");
		setTimeout("checkPoll()", 30000);
	} else if(pollStatus == 2) {
		$("#poll-box").show();
		$("#poll").load("../../dynamic/php/poll/results.php");
		setTimeout("checkPoll()", 10000);
	}
}

function submitVote(){
	var vote = $('#poll-question input:radio:checked').val();	
		$.ajax({
			type: "POST",
			url: "dynamic/php/poll/vote.php",
			data: "vote="+ vote +"",
			success: function() {
				$("#poll").load("../../dynamic/php/poll/results.php");
			}
		});
}
