Type.registerNamespace("www.rferl.org.Widgets");www.rferl.org.Widgets.PollWidgetBehavior=function(a){www.rferl.org.Widgets.PollWidgetBehavior.initializeBase(this,[a])};www.rferl.org.Widgets.PollWidgetBehavior.prototype={_pollType:null,_pollId:null,_pollAnswers:null,_errorCallbackHandler:null,_successCallbackHandler:null,initialize:function initialize(){www.rferl.org.Widgets.PollWidgetBehavior.callBaseMethod(this,"initialize");this._errorCallbackHandler=Function.createDelegate(this,this._errorCallback);this._successCallbackHandler=Function.createDelegate(this,this._successCallback);this._pollAnswers=document.getElementsByName(String.format("poll{0}_{1}",this.get_pollType(),this.get_pollId()));this.getPollBody()},dispose:function dispose(){www.rferl.org.Widgets.PollWidgetBehavior.callBaseMethod(this,"dispose");this._errorCallbackHandler=null;this._successCallbackHandler=null},get_pollType:function get_pollType(){return this._pollType},set_pollType:function set_pollType(a){if(a!==this._pollType){this._pollType=a;this.raisePropertyChanged("pollType")}},get_pollId:function get_pollId(){return this._pollId},set_pollId:function set_pollId(a){if(a!==this._pollId){this._pollId=a;this.raisePropertyChanged("pollId")}},_getCheckedValue:function _getCheckedValue(b){if(!b){return 0}var c=b.length;if(c==undefined){if(b.checked){return b.value}else{return 0}}for(var a=0;a<c;a++){if(b[a].checked){return b[a].value}}return 0},pollVote:function pollVote(){var b=this._getCheckedValue(this._pollAnswers);var a=($get(this.get_id()+"_btnSeeResults")==null);www.rferl.org.Services.PollWidgetService.PollVote(this.get_pollType(),this.get_pollId(),b,a,userIP,this.get_id(),this._successCallbackHandler,this._errorCallbackHandler)},pollShowResults:function pollShowResults(){var a=this._getCheckedValue(this._pollAnswers);www.rferl.org.Services.PollWidgetService.PollShowResults(this.get_pollType(),this.get_pollId(),a,userIP,this.get_id(),this._successCallbackHandler,this._errorCallbackHandler)},getPollBody:function getPollBody(){www.rferl.org.Services.PollWidgetService.GetPollBody(this.get_pollType(),this.get_pollId(),userIP,this.get_id(),this._successCallbackHandler,this._errorCallbackHandler)},getPollBodyPreview:function getPollBodyPreview(){this.get_element().innerHTML="This is poll preview - please check live site to see real values."},_successCallback:function _successCallback(a){this.get_element().innerHTML=a},_errorCallback:function _errorCallback(a){}};www.rferl.org.Widgets.PollWidgetBehavior.registerClass("www.rferl.org.Widgets.PollWidgetBehavior",Sys.UI.Control);;
