// JavaScript Document
function checkVote(){
	howto_id = document.getElementById('howto_id').value;
	var index = ajax.length;

	ajax[index] = new sack();
	ajax[index].setVar('howto_id',howto_id);
	ajax[index].method = "POST";
	ajax[index].requestFile = 'vote_script.php';
	ajax[index].onCompletion = function(){ 
	 if(ajax[index].response == "fail"){
		  alert("คุณสามารถทำการโหวตได้ทุก 2 ชั่วโมง รอก่อนนะคะ");
	 }else if(ajax[index].response == "invalid"){
		  alert("กรุณาล็ออินก่อนค่ะ");
	 }else{
		  alert("คุณได้ทำการโหวตเรียบร้อยแล้ว สามารถโหวตครั้งต่อไปในอีก 2 ชั่วโมงค่ะ"); 
		  document.getElementById('vote_result').innerHTML = ajax[index].response;
	 }
	}
	ajax[index].runAJAX();
	
}
