function VoteControlShowResults(n,t){var u=document.getElementById(n+"Questions"),i=document.getElementById(n+"AnswersWithPercent"),r=document.getElementById(n+"AnswersWithCount");u.style.display="none";t==!0?(i.style.display="",r.style.display="none"):(i.style.display="none",r.style.display="")}function VoteControlShowQuestion(n){var t=document.getElementById(n+"Questions"),i=document.getElementById(n+"AnswersWithPercent"),r=document.getElementById(n+"AnswersWithCount");t.style.display="";i.style.display="none";r.style.display="none"}function VoteControlDoVote(n,t){var i,r;i=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");i.onreadystatechange=function(){i.readyState==4&&i.status==200&&(i.responseText.substring(0,1)=="*"?alert(i.responseText.substring(1)):(document.getElementById(t+"VoteControl").innerHTML=i.responseText,VoteControlShowResults(t,!0)))};r=getVoteIndex(t+"QuestionList");r>=0?(i.open("POST",n+"DoVote/"+t+"/"+r,!0),i.send()):alert("Выберите вариант ответа")}function getVoteIndex(n){var t=document.getElementById(n),r=0,u=-1,i;for(x=0;x<t.childNodes.length;x++)if(t.childNodes[x].childNodes.length>0&&(i=t.childNodes[x].getElementsByTagName("input"),i!=null)){if(i[0].checked){u=r;break}r++}return u}