function vote(div,vid){this.div=document.getElementById(div);this.vid=vid}vote.prototype.display=function(){this.loadXMLDoc('/_poll/vote.php?mode=xml&p='+this.vid,this.div)}vote.prototype.loadXMLDoc=function(url,div,pa){var self=this;if(window.XMLHttpRequest){self.req=new XMLHttpRequest();self.req.onreadystatechange=function(){self.processReqChange(div,pa)}self.req.open("GET",url,true);self.req.send(null)}else if(window.ActiveXObject){self.req=new ActiveXObject("Microsoft.XMLHTTP");if(self.req){self.req.onreadystatechange=function(){self.processReqChange(div,pa)}self.req.open("GET",url,true);self.req.send(null)}}}vote.prototype.postXMLDoc=function(url,str,div,pa){var self=this;if(window.XMLHttpRequest){self.req=new XMLHttpRequest();self.req.onreadystatechange=function(){self.processReqChange(div,pa)}self.req.open("POST",url,true);self.req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");self.req.send(str)}else if(window.ActiveXObject){self.req=new ActiveXObject("Microsoft.XMLHTTP");if(self.req){self.req.onreadystatechange=function(){self.processReqChange(div,pa)}self.req.open("POST",url,true);self.req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");self.req.send(str)}}}vote.prototype.processReqChange=function(div,pa){if(this.req.readyState==4){if(this.req.status==200){if(div!=null){this.resp=this.req.responseXML.documentElement;this.start=this.req.responseText.indexOf('<result>')+8;this.stop=this.req.responseText.indexOf('</result>');this.response=this.req.responseText.substring(this.start,this.stop);div.innerHTML=this.response}if(pa!=null){eval(pa)}}else{alert("There was a problem retrieving the XML data:\n"+this.req.status)}}}vote.prototype.enter=function(f){var str=this.getFormValues(f,'');this.postXMLDoc('/_poll/vote.php?mode=xml&p='+this.vid,str,this.div)}vote.prototype.getFormValues=function(fobj,valFunc){var str="";var valueArr=null;var val="";var cmd="";for(var i=0;i<fobj.elements.length;i++){switch(fobj.elements[i].type){case"text":if(valFunc){cmd=valFunc+"("+'fobj.elements[i].value'+")";val=eval(cmd)}str+=fobj.elements[i].name+"="+escape(fobj.elements[i].value)+"&";break;case"select-one":str+=fobj.elements[i].name+"="+fobj.elements[i].options[fobj.elements[i].selectedIndex].value+"&";break;case"checkbox":if(fobj.elements[i].checked==true){str+=fobj.elements[i].name+"="+escape(fobj.elements[i].value)+"&"}break;case"radio":if(fobj.elements[i].checked==true){str+=fobj.elements[i].name+"="+escape(fobj.elements[i].value)+"&"}break;default:str+=fobj.elements[i].name+"="+escape(fobj.elements[i].value)+"&";break}}str=str.substr(0,(str.length-1));return str}