function PopupLoader(
	oPopup,
	sUrl,
	oParams
	) {

	Popup.baseConstructor.call(this);

	this.oPopup = oPopup;
	this.sUrl = sUrl;
	this.oContentLoader = new ContentLoader();
	this.oParams = oParams;

	var oThis = this;

	this.oContentLoader.attachObserver(
		ContentLoader.EVENT_TYPE_ON_LOAD,	
		function(
			sEventType,
			oObservable,
			sContent
			) {

			oThis.showContent(sContent);

		}
		);

	this.oPopup.attachObserver(
		Popup.EVENT_TYPE_ON_CLOSE,
		function(
			sEventType,
			oObservable
			) {

			oThis.notify(
				sEventType,
				oObservable
				);

		}
		);

};


PopupLoader.CLASS_NAME_LOADING = 'loading';


PopupLoader.inheritFrom(
	Observable,
	{

		load : function(sId) {

			var iOffsetTop = ((typeof(window.scrollY) != 'undefined'? window.scrollY : document.body.scrollTop) + document.body.clientHeight / 2) - 100;

			this.oPopup.top();

			if(!this.oPopup.isOpened()) {

				this.oPopup.open();

				this.oPopup.oElement.style.marginRight = '-30%';
				this.oPopup.oElement.style.top = iOffsetTop + 'px';

				this.oParams.oAnimationController.addAnimation(
					new AnimationEquation(
						this.oPopup.oElement,
						{
							aProperties  : ['marginRight'],
							aUnits       : ['%'],
							aValuesStart : [-30],
							aValuesEnd   : [0],
							aEquations   : [AnimationEquation.Cubic.easeOut],
							iFramesCount : 30
						}
						)
					);

				this.oParams.oAnimationController.start();

			}
			else {

				this.oParams.oAnimationController.addAnimation(
					new AnimationEquation(
						this.oPopup.oElement,
						{
							aProperties  : ['top'],
							aValuesStart : [this.oPopup.oElement.offsetTop],
							aValuesEnd   : [iOffsetTop],
							aEquations   : [AnimationEquation.Cubic.easeOut],
							iFramesCount : 30
						}
						)
					);

				this.oParams.oAnimationController.start();

			}

			this.showLoading();

			var aParams = [];

			aParams[this.oParams.sParamId || 'id'] = sId;

			this.oContentLoader.load(
				this.sUrl,
				aParams
				);

		},

		showLoading : function() {

			this.oPopup.addClass(PopupLoader.CLASS_NAME_LOADING);

		},

		hideLoading : function() {

			this.oPopup.removeClass(PopupLoader.CLASS_NAME_LOADING);
		
		},

		showContent : function(sContent) {

			this.hideLoading();
			this.oPopup.setContent(sContent);
		
		}

	}
	);