﻿Type.registerNamespace("RateGate");RateGate.Voter=function(a){RateGate.Voter.initializeBase(this,[a]);var b=this._container=$(a);var c=a.id;this._servicePath=null;this._userImageId=null;this._votes=b.find('span[class=photoRate]:first');this._voteUp=$('#'+c+'_plus');this._voteDown=$('#'+c+'_minus')};RateGate.Voter.prototype={initialize:function(){RateGate.Voter.callBaseMethod(this,'initialize');this._voteUp.click(Function.createDelegate(this,this._voteUpHandler));this._voteDown.click(Function.createDelegate(this,this._voteDownHandler))},_voteUpHandler:function(){var c=this;Sys.Net.WebServiceProxy.invoke(c.get_servicePath(),'VoteUp',false,{userImageId:c._userImageId},function(a){if(a.error){if(a.plus){window.alert(a.error);c._setAllPlusOff()}else if(a.minus){window.alert(a.error);c._setAllMinusOff()}else{window.alert(a.error)}}else{c._votes.text(a.val);c._voteUp.attr('class','plusOff');c._voteDown.attr('class','minusOff')}},function(a,b){window.alert('При попытке проголосовать за фото произошла ошибка, пожайлуста повторите попытку.')})},_setAllPlusOff:function(){$('a[class=plus]').attr('class','plusOff')},_setAllMinusOff:function(){$('a[class=minus]').attr('class','minusOff')},_voteDownHandler:function(){var c=this;Sys.Net.WebServiceProxy.invoke(c.get_servicePath(),'VoteDown',false,{userImageId:c._userImageId},function(a){if(a.error){if(a.plus){window.alert(a.error);c._setAllPlusOff()}else if(a.minus){window.alert(a.error);c._setAllMinusOff()}else{window.alert(a.error)}}else{c._votes.text(a.val);c._voteDown.attr('class','minusOff');c._voteUp.attr('class','plusOff')}},function(a,b){window.alert('При попытке проголосовать за фото произошла ошибка, пожайлуста повторите попытку.')})},get_servicePath:function(){return this._servicePath},set_servicePath:function(a){this._servicePath=a},get_userImageId:function(){return this._userImageId},set_userImageId:function(a){this._userImageId=a},dispose:function(){RateGate.Voter.callBaseMethod(this,'dispose')}};RateGate.Voter.registerClass('RateGate.Voter',Sys.UI.Control);if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
