﻿// JScript File
function Vote(){
    this.voteid = "";
}

function saveVote(pollid,answerids,otheranswer,displaytype,htmlid){                      
       new Ajax.Request("/ajaxservices/votes/vote.aspx", {method:'post',asynchronous:true,postBody:'pollid=' + pollid+ '&answerids=' + answerids + '&otheranswer=' + escape(otheranswer) + '&action=savevote', onSuccess:function(t){         
            this.voteid = t.responseText;
            //var oHtml = document.getElementById(htmlid);
//            if (oHtml ) {
//                var oPoll = new Poll();
//                if (displaytype.length > 0 ) {
//                    oPoll.getfusionpoll(pollid,htmlid,displaytype,680,350);
//                }
//                else {
//                    
//                }
//            }
            var oPoll = new Poll();
            oPoll.getlocalpoll(pollid,htmlid);
       
        }, onFailure:function(t){
        alert(t.responseText);
    }}); 
}

function saveVoteByWidget(pollid,answerids,otheranswer,displaytype,htmlid){                      

       new Ajax.Request("/ajaxservices/votes/vote.aspx", {method:'post',asynchronous:true,postBody:'pollid=' + pollid+ '&answerids=' + answerids + '&otheranswer=' + escape(otheranswer) + '&action=savevote', onSuccess:function(t){         
            this.voteid = t.responseText;
//            var oHtml = document.getElementById(htmlid);
//            if (oHtml ) {
//                var oPoll = new Poll();
//                if (displaytype.length > 0 ) {
//                    oPoll.getfusionpoll(pollid,htmlid,displaytype,default_width,default_height);
//                }
//                else {
//                    oPoll.getlocalpoll(pollid,htmlid);
//                }
//            }
            var oPoll = new Poll();
            oPoll.getlocalpoll(pollid,htmlid);
       
        }, onFailure:function(t){
        alert(t.responseText);
    }}); 
}

Vote.prototype.savevote = saveVote;
Vote.prototype.saveVoteByWidget = saveVoteByWidget;

 