
    SasDuels = function()
    {
        this.sPageReceiver = '',
        this._sDuelBlockPrefix = 'esase_duel_unit_',
        this._sAjaxPopupWindow = 'esase_duel_popup_window',

        /**
         * Send ajax query with selected vote 
         *
         * @param iProfileId integer
         * @paraqm iDuelId integer
         * @param sType string
         * @return void
         */
        this.sendVote = function(iProfileId, iDuelId, sType)
        {
        	var _this = this;
            var _sRandom = Math.random();

        	bx_loading(this._sDuelBlockPrefix + iDuelId, true);

            $.get(this.sPageReceiver + 'AjaxDuelVote/' + iProfileId + '/' + iDuelId + '/' + sType + '&_random=' + _sRandom, function(sData){
            	//process recivied data
            	var oResponse  = eval("(" + sData + ")");
            	bx_loading(_this._sDuelBlockPrefix + iDuelId, false);

            	if(oResponse.block) {
            		//update duel block
            		$('#' + _this._sDuelBlockPrefix + iDuelId).replaceWith(oResponse.block); 
            	}

            	alert(oResponse.message);
            });
        },
        this.previwMedia = function(iId, sType)
        {
            var _sRandom = Math.random();
            this.getPopupAnyHtml(this.sPageReceiver + 'ajaxPreviewMedia/' + iId + '/' + sType + '&_random=' + _sRandom);
        },
        this.getPopupAnyHtml = function(sUrl) 
        {
            var oPopupOptions = {
                fog: {color: '#fff', opacity: .7}
            };

        	$('<div id="' + this._sAjaxPopupWindow + '" style="display: none;"></div>').prependTo('body').load(
        		sUrl.match('^http[s]{0,1}:\/\/') ? sUrl : site_url + sUrl,
        		function() {
        			$(this).dolPopup(oPopupOptions);
        		}
        	);
        }
    }
