<!--
function ShopNotificationManager ()
{
	this.notificationLayerId = 'shop_productnotification';
	this.notificationMsgLayerId = 'shop_productnotification_msg';
	this.notificationFormId = 'shop_productnotificationform';
	
	this.handleBeforeInitForm = null;
	this.handleAfterInitForm = null;
	this.handleBeforeRegister = null;
	this.handleAfterRegister = null;
	
	this.reposeNotification =	function ( linkObj )
								{
									myCenterLayer( shopNotificationManager.notificationLayerId, true, false );
									myReposLayerByLinkAndDesktop( shopNotificationManager.notificationLayerId, linkObj, 0, 0, true, true );
								};
	this.reposeNotificationMsg =	function ()
									{
										myReposLayerByLink( shopNotificationManager.notificationMsgLayerId, myGetObj( shopNotificationManager.notificationLayerId ), 0, 100, true, true );
									};
	
	this.initForm =	function ( foreignKey1, foreignKey2, foreignKey3, linkId )
					{
						if ( shopNotificationManager.handleBeforeInitForm )
							shopNotificationManager.handleBeforeInitForm();
						
						if ( foreignKey1 == null )
							foreignKey1 = "";
						if ( foreignKey2 == null )
							foreignKey2 = "";
						if ( foreignKey3 == null )
							foreignKey3 = "";
						
						new Ajax.Request( myWebRoot + "myinterfaces/" + myLanguagePath + "/shop-productnotification" + firstSeparator + "0" + paramSeparator + "0" + paramSeparator + "0" + paramSeparator + foreignKey1 +  paramSeparator + foreignKey2 +  paramSeparator + foreignKey3 +  paramSeparator + linkId + ".ajax", { method: "post", onComplete: this.onCompleteInitForm } );
					};
	this.onCompleteInitForm =	function ( originalRequest )
								{
									var response = originalRequest.responseText.evalJSON();
									
									var notificationDiv = myGetObj( shopNotificationManager.notificationLayerId );
									if ( notificationDiv == null )
									{
										notificationDiv = document.createElement( 'div' );
										notificationDiv.setAttribute( 'id', shopNotificationManager.notificationLayerId );
										document.body.appendChild( notificationDiv );
									}
									
									myHideLayer( shopNotificationManager.notificationLayerId );
									
									writeHTMLToLayer( shopNotificationManager.notificationLayerId, response.htmlCode );
									
									if( shopNotificationManager.reposeNotification != null )
										shopNotificationManager.reposeNotification( myGetObj( response.linkId ) );
									
									myShowLayer( shopNotificationManager.notificationLayerId );
									
									if ( shopNotificationManager.handleAfterInitForm )
										shopNotificationManager.handleAfterInitForm();
								};
	this.register =	function ( fileNameParamsAsString )
					{
						var handleBeforeRegister = false;
						if ( shopNotificationManager.handleBeforeRegister )
							handleBeforeRegister = shopNotificationManager.handleBeforeRegister();
						else
							handleBeforeRegister = true;
						
						if ( handleBeforeRegister && shop_productnotification_check() )
						{
							new Ajax.Request( myWebRoot + "myinterfaces/" + myLanguagePath + "/shop-productnotification-step2" + fileNameParamsAsString + ".ajax", { method: "post", postBody: $( shopNotificationManager.notificationFormId ).serialize(), onComplete: this.onCompleteRegister } );
						}
						
						return false;
					};
	this.onCompleteRegister =	function ( originalRequest )
								{
									var response = originalRequest.responseText.evalJSON();
									
									if ( response.showForm )
									{
										myHideLayer( shopNotificationManager.notificationLayerId );
										writeHTMLToLayer( shopNotificationManager.notificationLayerId, response.htmlCode );
										
										if( shopNotificationManager.reposeNotification != null )
											shopNotificationManager.reposeNotification( myGetObj( response.linkId ) );
										myShowLayer( shopNotificationManager.notificationLayerId );
									}
									else
									{
										myHideLayerBugControlsInForm( myGetObj( shopNotificationManager.notificationFormId ) );
										
										var notificationMsgDiv = myGetObj( shopNotificationManager.notificationMsgLayerId );
										if ( notificationMsgDiv == null )
										{
											notificationMsgDiv = document.createElement( 'div' );
											notificationMsgDiv.setAttribute( 'id', shopNotificationManager.notificationMsgLayerId );
											document.body.appendChild( notificationMsgDiv );
										}
										
										myHideLayer( shopNotificationManager.notificationMsgLayerId );
										writeHTMLToLayer( shopNotificationManager.notificationMsgLayerId, response.htmlCode );
										
										if( shopNotificationManager.reposeNotificationMsg != null )
											shopNotificationManager.reposeNotificationMsg();
										myShowLayer( shopNotificationManager.notificationMsgLayerId );
									}
									
									if ( shopNotificationManager.handleAfterRegister )
										shopNotificationManager.handleAfterRegister();
								};
	
	this.closeMsg =	function ()
					{
						var notificationMsgDiv = myGetObj( shopNotificationManager.notificationMsgLayerId );
						if ( notificationMsgDiv != null )
						{
							document.body.removeChild( notificationMsgDiv );
							myShowLayerBugControlsInForm( myGetObj( shopNotificationManager.notificationFormId ) );
						}
					};
	this.closeNotification =	function ()
								{
									shopNotificationManager.closeMsg();
									
									var notificationDiv = myGetObj( shopNotificationManager.notificationLayerId );
									if ( notificationDiv != null )
										document.body.removeChild( notificationDiv );
										
									if ( shopNotificationManager.handleAfterCloseNotification != null )
										shopNotificationManager.handleAfterCloseNotification();
								};
	
	this.setHandleBeforeInitForm = function ( handleBeforeInitForm ) { this.handleBeforeInitForm = handleBeforeInitForm; };
	this.setHandleAfterInitForm = function ( handleAfterInitForm ) { this.handleAfterInitForm = handleAfterInitForm; };
	this.setHandleBeforeRegister = function ( handleBeforeRegister ) { this.handleBeforeRegister = handleBeforeRegister; };
	this.setHandleAfterRegister = function ( handleAfterRegister ) { this.handleAfterRegister = handleAfterRegister; };
	this.setHandleAfterCloseNotification = function ( handleAfterCloseNotification ) { this.handleAfterCloseNotification = handleAfterCloseNotification; };
	
	this.setReposeNotification = function ( reposeNotification ) { this.reposeNotification = reposeNotification; };
	this.setReposeNotificationMsg = function ( reposeNotificationMsg ) { this.reposeNotificationMsg = reposeNotificationMsg; };
}

var shopNotificationManager = new ShopNotificationManager();
//-->