function mdi_widgets_Slider( selector, ppage ) {

	var ITEMS_PER_PAGE = ppage;

	var _mainObj = $( selector );
	var _sliderObj = _mainObj.children( ".slider" );
	var _containerObj = _sliderObj.children( ".items" );
	var _arrowLeftObj = _mainObj.find( ".arrow-left" );
	var _arrowRightObj = _mainObj.find( ".arrow-right" );

	var _itemObj = _containerObj.children( ".item" );
	var _itemFullWidth = _itemObj.outerWidth( true );

	var _mainObjCurrentPage = 0;
	var _mainObjPageCount = Math.ceil( _itemObj.length / ITEMS_PER_PAGE );

	function _init() {

		_containerObj.css( {
			"position"	: "relative",
			"width"		: ( _itemFullWidth * ( _itemObj.length + 1 ) ) + "px"
		} );

		if( _itemObj.length <= ITEMS_PER_PAGE ) {
			_arrowLeftObj.remove();
			_arrowRightObj.remove();
		} else {
			_arrowLeftObj.click( _onArrowLeftClickHandler );
			_arrowRightObj.click( _onArrowRightClickHandler );
		}

	}

	function _onArrowLeftClickHandler() {

		if( _mainObjCurrentPage == 0 ) {
			_mainObjCurrentPage = _mainObjPageCount;
		}

		_mainObjCurrentPage--;

		_showCurrentPage();

	}

	function _onArrowRightClickHandler() {

		if( _mainObjCurrentPage == _mainObjPageCount - 1 ) {
			_mainObjCurrentPage = -1;
		}

		_mainObjCurrentPage++;

		_showCurrentPage();

	}

	function _showCurrentPage() {

		if( _itemObj.length <= ITEMS_PER_PAGE ) {
			return;
		}

		_containerObj.stop( true ).animate( {
			"left": - ( _mainObjCurrentPage * _itemFullWidth * ITEMS_PER_PAGE ) + "px"
		} );

	}

	function _getCurrentPage() {
		return _mainObjCurrentPage;
	}

	function _setCurrentPage( page ) {

		if( page < 0 || page == _mainObjPageCount ) {
			return;
		}

		_mainObjCurrentPage = page;

		_showCurrentPage();

	}

	_init();

	return {
		getCurrentPage	: _getCurrentPage,
		setCurrentPage	: _setCurrentPage
	};

}
