var Poll = { showResults: function(step) { var url = '/aspx/poll_small.aspx'; $.ajax({ type: "GET", url: url, data: "pollID=" + document.aspnetForm.PollID.value, success: function(result){ if (result != "") { if (document.getElementById("PollOkButton") != null) document.getElementById("PollOkButton").style.display = "none"; $("#PollQuestionDiv").append("
Uitslag:"); document.getElementById("PollOptionsStartDiv").innerHTML = result; } } }); }, postResults: function(step) { var url = '/aspx/poll_small.aspx'; if (Poll.getSelectedPollValue() == null) return; $.ajax({ type: "GET", url: url, data: "optionID=" + Poll.getSelectedPollValue(), success: function(result){ if (result != "") { $("#PollQuestionDiv").append("
Uitslag:"); document.getElementById("PollOptionsStartDiv").innerHTML = result; document.getElementById("PollOkButton").style.display = "none"; $.cookie('RULiveResponseToPollID', document.aspnetForm.PollID.value, { expires: 365 }); } } }); }, getSelectedPollValue: function() { var a = null; var e = document.aspnetForm.PollOptionRadioButton; for (var i = 0; i < e.length; i++) { if (e[i].checked) { a = e[i].value; break; } } return a; } } $(document).ready(function() { if (document.aspnetForm.PollID == null) return; if($.cookie('RULiveResponseToPollID') == document.aspnetForm.PollID.value) { Poll.showResults(); } else { var pollButton = $("#PollOkButton"); if (pollButton != null) { pollButton.click(function() { if(Poll.getSelectedPollValue() == null) return; $(this).get(0).style.display = "none"; Poll.postResults(); return false; }); } } });