var flagCaptcha = false; var flagFields = true; var message = 'Please fill in all mandatory fields ! \n'; var bustcachevar=1; //bust potential caching of external pages after initial request? (1=yes, 0=no) var bustcacheparameter=""; function createRequestObject(){ try { xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert('Sorry, but your browser doesn\'t support XMLHttpRequest.'); }; return xmlhttp; }; function ajaxpage(url, containerid, requesttype){ var page_request = createRequestObject(); if (requesttype=='get'){ if (bustcachevar) bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime() page_request.open('GET', url+bustcacheparameter, true) page_request.send(null) } else if (requesttype=='post') { page_request.open('POST', url, true); page_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); page_request.setRequestHeader("Content-length", poststr.length); page_request.setRequestHeader("Connection", "close"); page_request.send(poststr); }; page_request.onreadystatechange=function(){ loadpage(page_request, containerid) } } function loadpage(page_request, containerid){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) { document.getElementById(containerid).innerHTML=page_request.responseText; }; } function submitVote(element, id) { var selectedAnswers = ''; var answersCount = document.PollFrm.answers.length; for (i=0; i< answersCount; i++) { if (document.PollFrm.answers[i].checked) { if(element=="radio") selectedAnswers = document.PollFrm.answers[i].value; else if(element=="checkbox") selectedAnswers = selectedAnswers + "-" + document.PollFrm.answers[i].value; } } if (selectedAnswers=='') { } else { ajaxpage('/PHPpoll/poll.php?ac=vote&id='+id+'&answers='+selectedAnswers,'poll_'+id,'get'); }; }; function SelectFormElement(el,id) { if(el=="radio"){ document.PollFrm.answers[id].checked = "checked"; } else if(el=="checkbox"){ document.PollFrm.answers[id].checked = !document.PollFrm.answers[id].checked; } } loadPoll = '
'; document.writeln(loadPoll);