
/*
Check poll voting status for the current session..
*/

$(document).ready(function() {

	// don't do anything if there are two results blocks for.. just to be sure
	if($("form#poll-form").length > 0 && $("div.section.software > div.col-2 > div.poll.results").length < 2) {

		contentObjectID = $("form#poll-form > input[name='ContentObjectID']").val();
	
		if(contentObjectID) {
	
			$.ajax({			  type: "GET",			  url: ez_site_url+"/pollhelper/status/"+contentObjectID,
			  dataType: "text",			  success: function(result){
		
					if(jQuery.trim(result) == "1") {
						$("div.section.software > div.col-2 > div.poll.options").css('display', 'none');
						$("div.section.software > div.col-2 > div.poll.results > div.box-content > div.answers > a.add-comment.add-vote").css('display', 'none');
						$("div.section.software > div.col-2 > div.poll.results").css('display', 'block');
					} 
		
			  },
			  error: function() {
					// Oops.
			  }	  			});
		
		}
	
	}
	
});


function showPollResults() {

	$("div.section.software > div.col-2 > div.poll.options").toggle();
	$("div.section.software > div.col-2 > div.poll.results").toggle();

	return false;
	
}