// Vovici v5 Client Side Poll API // Copyright 1997-2009 Vovici Corporation. All rights reserved. // Version: 5.0.0 function VoviciPoll(pollId) { this.PollId = pollId; } VoviciPoll.prototype.RenderPoll = function(isPreview) { if (!isPreview && this.GetCookie()) { document.getElementById('ResultsDiv_' + this.PollId).style.display = 'block'; } else { document.getElementById('PollDiv_' + this.PollId).style.display = 'block'; } } VoviciPoll.prototype.SubmitVote = function() { var results = ''; var index = 1; for (;;) { var element = document.getElementById(this.PollId + '_Q1_' + index); if (!element) break; results += (element.checked) ? '1|' : '0|'; index++; } if (results.indexOf('1') != -1) { this.SetCookie(); var url = document.getElementById('PollAction_' + this.PollId).value; var headID = document.getElementsByTagName('head')[0]; var newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.src = url + '?p=' + this.PollId + '&v=' + results; headID.appendChild(newScript); } else { alert('Please select an option before voting.'); } }; VoviciPoll.prototype.DisplayResult = function(contents) { var poll = document.getElementById('ResultsDiv_' + this.PollId); poll.innerHTML = contents; document.getElementById('PollDiv_' + this.PollId).style.display = 'none'; document.getElementById('ResultsDiv_' + this.PollId).style.display = 'block'; } VoviciPoll.prototype.ViewResults = function() { document.getElementById('PollDiv_' + this.PollId).style.display = 'none'; document.getElementById('ResultsDiv_' + this.PollId).style.display = 'block'; } VoviciPoll.prototype.SetCookie = function() { var expires = new Date(); expires.setTime(expires.getTime() + (90*24*60*60*1000)); var cookieString = 'PollStatus_' + this.PollId + '='; cookieString += '; expires=' + expires.toGMTString(); document.cookie = cookieString } VoviciPoll.prototype.GetCookie = function() { var cookieString = document.cookie; var cookies = cookieString.split('; '); for (var i = 0; i < cookies.length; i++){ var nameValuePair = cookies[i].split('='); if (nameValuePair[0] == 'PollStatus_' + this.PollId) return true; } return false; } var poll705E3ED446E529BD = new VoviciPoll('705E3ED446E529BD');document.write('');document.write('
');poll705E3ED446E529BD.RenderPoll(false);