
	// contain all needed `ID` selectors ;
	var htmlSelectors = new Array();
    htmlSelectors[0] = 'rows_content';

	/**
	 * @description : constructor ;
	 */

	function CommunicatorPage()
	{
		// will need to define this ;
		this.sErrorMessage	    = '';
		this.sSureCaption	    = '';

		// URL for page receiver ;
        this.sPageReceiver	    = '';

        // current communicator mode ;
        this.sCommunicatorMode  = '';

        // ID of block that will be draw ajax's return result ;
        this.sResponceBlock  = '';
	}

    /**
     * Function will return the communicator page with person mode consideration ;
     *
     * @param  : sPersonMode (string) - person's mode (from, to);
     * @return : (text) Html presentation data ;
     */
    CommunicatorPage.prototype.getTypifiedPage = function( sPersonMode )
    {
        var sPageUrl = oCommunicatorPage.sPageReceiver + '&action=get_page' ;
        sPageUrl = sPageUrl + '&person_switcher=' + sPersonMode;
        sPageUrl = sPageUrl + '&communicator_mode=' + this.sCommunicatorMode;

        getHtmlData( $('#'+htmlSelectors[0]).parent(), sPageUrl); 
    }

    /**
     * Function will return the communicator page, consideration the page's parameters ;
     *
     * @param  : sPageUrl (string) - page's URL;
     * @return : (text) Html presentation data ;
     */
    CommunicatorPage.prototype.getPaginatePage = function(sPageUrl)
    {
        getHtmlData( $('#'+htmlSelectors[0]).parent(), sPageUrl); 
    }

    /**
     * Function will return the communicator page, consideration the per page parameter ;
     *
     * @param  : iPerPage (integer) - number elements for per page;
     * @param  : sPageUrl (string)  - page's URL;
     * @return : (text) Html presentation data ;
     */
    CommunicatorPage.prototype.getPage = function(iPerPage, sPageUrl)
    {
        sPageUrl = sPageUrl + '&per_page=' + iPerPage;
        getHtmlData( $('#'+htmlSelectors[0]).parent(), sPageUrl); 
    }

    /**
     * Function will return page consideration the page sort parameter ;
     *
     * @param  : sPageUrl (string) - page's URL;
     * @param  : sSortType (string) - sort parameter ;
     * @return : (text) Html presentation data ;
     */
    CommunicatorPage.prototype.getSortedPage = function(sPageUrl, sSortType)
    {
        sPageUrl = sPageUrl + '&sorting=' + sSortType;
        getHtmlData( $('#'+htmlSelectors[0]).parent(), sPageUrl);
    }
    
    /**
     * Function will check or uncheck all checkboxes into wrapper ;
     *
     * @param		: bChecked (boolean) - contain true if checkbox was checked;
     * @param		: sContainer (string) - contain name of section where jquery will find it ;
     */
    CommunicatorPage.prototype.selectCheckBoxes = function( bChecked, sContainer )
    {
        var oCheckBoxes = $("." + sContainer + " input:checkbox:enabled");

        if ( bChecked )
        {
            oCheckBoxes.attr('checked', 'checked');
        }
        else
        {
            oCheckBoxes.removeAttr('checked');	
        }
    }

    /**
     * Function will send action  ;
     *
     * @param		: sContainer (string)  - contain name of section where jquery will find it ;
     * @param		: sActionName (string) - contain name of needed action  ;
     * @param		: sCallbackFunction (string) - callback function that will return answer from server side;
     * @return      : (text) - html data from server side ;
     */
    CommunicatorPage.prototype.sendAction = function(sContainer, sActionName, sCallbackFunction)
    {
		var sMessagesId = '';
        var iValue		= '';

        var oCheckBoxes = $("." + sContainer + " input:checkbox:enabled[checked]").each(function(){
            iValue = $(this).attr('value').replace(/[a-z]{1,}/i, '');
            if ( iValue )
                    sMessagesId += iValue + ',';
        });

        if ( sMessagesId )
        {
            if ( confirm(this.sSureCaption) )
            {
                // sand data to the web server ;
                var sPageUrl = this.sPageReceiver + '&action=' + sActionName + '&rows=' 
                                                  + sMessagesId + '&callback_function=' + sCallbackFunction
                                                  + '&communicator_mode=' + this.sCommunicatorMode 
                                                  + '&person_switcher=' + this.sPersonMode;

                getHtmlData( $('#'+htmlSelectors[0]).parent(), sPageUrl);
            }
        }
        else
			alert(this.sErrorMessage);
    }
