var serverSideFile="/pooler-cast.html",voteLeftImage="http://static.orbcube.lt/img/pool-left.png",voteRightImage="http://static.orbcube.lt/img/pool-right.gif",voteCenterImage="http://static.orbcube.lt/img/pool-middle.png",graphMaxWidth=135,graphMinWidth=15,pollScrollSpeed=5,useCookiesToRememberCastedVotes=true,txt_totalVotes="<br />Total number of votes: ",ajaxObjects=[],pollVotes=[],pollVoteCounted=[],totalVotes=[],preloadedImages=[];preloadedImages[0]=new Image;preloadedImages[0].src=voteLeftImage;
preloadedImages[1]=new Image;preloadedImages[1].src=voteRightImage;preloadedImages[2]=new Image;preloadedImages[2].src=voteCenterImage;
function headerAction(){document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="980" height="298">\n');document.write('<param name="allowScriptAccess" value="always" />\n');document.write('<param name="movie" value="http://static.orbcube.eu/index.swf" />\n');document.write('<param name="quality" value="high" />\n');document.write('<embed src="http://static.orbcube.eu/index.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" allowScriptAccess="always" type="application/x-shockwave-flash" width="980" height="298"></embed>\n');
document.write("</object>\n")}function Poller_Get_Cookie(c){var b=document.cookie.indexOf(c+"="),a=b+c.length+1;if(!b&&c!=document.cookie.substring(0,c.length))return null;if(b==-1)return null;c=document.cookie.indexOf(";",a);if(c==-1)c=document.cookie.length;return unescape(document.cookie.substring(a,c))}
function Poller_Set_Cookie(c,b,a,e,d,k){a=a*60*60*24*1000;var h=new Date;h=new Date(h.getTime()+a);c=c+"="+escape(b)+(a?";expires="+h.toGMTString():"")+(e?";path="+e:"")+(d?";domain="+d:"")+(k?";secure":"");document.cookie=c}
function showVoteResults(c,b){document.getElementById("poller_waitMessage"+c).style.display="none";var a=ajaxObjects[b].response;a=a.replace(/\n/gi,"");b=new RegExp("^.*?<pollerTitle>(.*?)<.*$","gi");var e=a.replace(b,"$1");b=document.getElementById("poller_results"+c);var d=document.createElement("div");d.className="question";d.innerHTML=e+"<br />&nbsp;";b.appendChild(d);a=a.split(/<option>/gi);pollVotes[c]=[];totalVotes[c]=0;for(e=1;e<a.length;e++){d=a[e].split(/</gi);for(var k=false,h=0;h<d.length;h++)if(d[h].substring(0,
1)!="/"){var f=d[h].replace(/^(.*?)>.*$/gi,"$1"),l=d[h].replace(/^.*?>(.*)$/gi,"$1");if(f.indexOf("optionId")>=0)k=l/1;if(f.indexOf("optionText")>=0){var j=document.createElement("div");j.className="pOption";j.innerHTML=l;b.appendChild(j)}if(f.indexOf("votes")>=0){f=document.createElement("div");f.className="result_pollGraph";b.appendChild(f);var g=document.createElement("div");g.style.backgroundImage="url('"+voteLeftImage+"')";g.style.width="3px";g.style.height="6px";f.appendChild(g);g=document.createElement("div");
g.style.backgroundImage="url('"+voteCenterImage+"')";g.style.height="6px";g.id="result_voteTxt"+k;f.appendChild(g);g=document.createElement("div");g.style.backgroundImage="url('"+voteRightImage+"')";g.style.width="3px";g.style.height="6px";f.appendChild(g);f=document.createElement("p");f.className="prInserter";f.id="result_voteTxt1"+k;f.innerHTML="0%";j.appendChild(f);pollVotes[c][k]=l;totalVotes[c]=totalVotes[c]/1+l/1}}}j=document.createElement("div");j.className="question";j.innerHTML=txt_totalVotes+
totalVotes[c];b.appendChild(j);setPercentageVotes(c);slideVotes(c,0)}function setPercentageVotes(c){for(var b in pollVotes[c])pollVotes[c][b]=Math.round(pollVotes[c][b]/totalVotes[c]*100);var a=0;for(b in pollVotes[c])a+=pollVotes[c][b]/1;pollVotes[c][b]+=100-a}
function slideVotes(c,b){b=b/1+1;for(var a in pollVotes[c])if(pollVotes[c][a]>=b){var e=document.getElementById("result_voteTxt"+a),d=document.getElementById("result_voteTxt1"+a);d.innerHTML=b+"%";e.style.width=Math.max(graphMinWidth,Math.round(b/100*graphMaxWidth))+"px"}b<100&&setTimeout('slideVotes("'+c+'","'+b+'")',pollScrollSpeed)}
function prepareForPollResults(c){document.getElementById("poller_waitMessage"+c).style.display="block";document.getElementById("poller_question"+c).style.display="none"}
function castMyVote(c,b){b=b.elements["vote["+c+"]"];for(var a=false,e=0;e<b.length;e++)if(b[e].checked)a=b[e].value;Poller_Set_Cookie("poller_"+c,"1",6000000);if(a){var d=ajaxObjects.length;ajaxObjects[d]=new sack;ajaxObjects[d].requestFile=serverSideFile+"?pollId="+c+"&optionId="+a;prepareForPollResults(c);ajaxObjects[d].onCompletion=function(){showVoteResults(c,d)};ajaxObjects[d].runAJAX()}}
function displayResultsWithoutVoting(c){var b=ajaxObjects.length;ajaxObjects[b]=new sack;ajaxObjects[b].requestFile=serverSideFile;prepareForPollResults(c);ajaxObjects[b].onCompletion=function(){showVoteResults(c,b)};ajaxObjects[b].runAJAX()}
function sack(c){this.xmlhttp=null;this.resetData=function(){this.method="POST";this.queryStringSeparator="?";this.argumentSeparator="&";this.URLString="";this.encodeURIString=true;this.execute=false;this.elementObj=this.element=null;this.requestFile=c;this.vars={};this.responseStatus=new Array(2)};this.resetFunctions=function(){this.onLoading=function(){};this.onLoaded=function(){};this.onInteractive=function(){};this.onCompletion=function(){};this.onError=function(){};this.onFail=function(){}};
this.reset=function(){this.resetFunctions();this.resetData()};this.createAJAX=function(){try{this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){try{this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){this.xmlhttp=null}}if(!this.xmlhttp)if(typeof XMLHttpRequest!="undefined")this.xmlhttp=new XMLHttpRequest;else this.failed=true};this.setVar=function(b,a){this.vars[b]=Array(a,false)};this.encVar=function(b,a,e){if(true==e)return Array(encodeURIComponent(b),encodeURIComponent(a));else this.vars[encodeURIComponent(b)]=
Array(encodeURIComponent(a),true)};this.processURLString=function(b,a){encoded=encodeURIComponent(this.argumentSeparator);regexp=new RegExp(this.argumentSeparator+"|"+encoded);varArray=b.split(regexp);for(i=0;i<varArray.length;i++){urlVars=varArray[i].split("=");true==a?this.encVar(urlVars[0],urlVars[1]):this.setVar(urlVars[0],urlVars[1])}};this.createURLString=function(b){this.encodeURIString&&this.URLString.length&&this.processURLString(this.URLString,true);if(b)if(this.URLString.length)this.URLString+=
this.argumentSeparator+b;else this.URLString=b;this.setVar("rndval",(new Date).getTime());urlstringtemp=[];for(key in this.vars){if(false==this.vars[key][1]&&true==this.encodeURIString){encoded=this.encVar(key,this.vars[key][0],true);delete this.vars[key];this.vars[encoded[0]]=Array(encoded[1],true);key=encoded[0]}urlstringtemp[urlstringtemp.length]=key+"="+this.vars[key][0]}this.URLString+=b?this.argumentSeparator+urlstringtemp.join(this.argumentSeparator):urlstringtemp.join(this.argumentSeparator)};
this.runResponse=function(){eval(this.response)};this.runAJAX=function(b){if(this.failed)this.onFail();else{this.createURLString(b);if(this.element)this.elementObj=document.getElementById(this.element);if(this.xmlhttp){var a=this;if(this.method=="GET"){totalurlstring=this.requestFile+this.queryStringSeparator+this.URLString;this.xmlhttp.open(this.method,totalurlstring,true)}else{this.xmlhttp.open(this.method,this.requestFile,true);try{this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(e){}}this.xmlhttp.onreadystatechange=
function(){switch(a.xmlhttp.readyState){case 1:a.onLoading();break;case 2:a.onLoaded();break;case 3:a.onInteractive();break;case 4:a.response=a.xmlhttp.responseText;a.responseXML=a.xmlhttp.responseXML;a.responseStatus[0]=a.xmlhttp.status;a.responseStatus[1]=a.xmlhttp.statusText;a.execute&&a.runResponse();if(a.elementObj){elemNodeName=a.elementObj.nodeName;elemNodeName.toLowerCase();if(elemNodeName=="input"||elemNodeName=="select"||elemNodeName=="option"||elemNodeName=="textarea")a.elementObj.value=
a.response;else a.elementObj.innerHTML=a.response}a.responseStatus[0]=="200"?a.onCompletion():a.onError();a.URLString="";break}};this.xmlhttp.send(this.URLString)}}};this.reset();this.createAJAX()};
