(function(){fcmsJs.Class('fcmsUser_Layout_Container').inherits(fcmsLib_Core_Class).construct(function(siteObject,layoutContainer){this._siteObject=siteObject;if(typeof layoutContainer==='object'&&layoutContainer.className==='fcmsLib_Utils_Dom_Element') {this._container=layoutContainer;}else{this._container=new fcmsLib_Utils_Dom_Element(layoutContainer);} this.onSetupComplete=new fcmsLib_Core_Observer();}).method('getShouldWipe',function(){return window.Modernizr.touch;}).method('getPosition',function(){return this._container.getPosition();}).method('remove',function(){this._container.remove();}).method('setup',function(layoutId,url,contextLevel){var pageLayout=new fcmsUser_Layout_Datastore(layoutId,url,contextLevel);pageLayout.onComplete.subscribe(function(){this.setLayoutHtml(pageLayout);this.registerControls();this.onSetupComplete.notify();}.bind(this,pageLayout));pageLayout.getLayout();}).method('setLayoutHtml',function(layoutDatastore){this._container.replaceContent(layoutDatastore.getHtml());}).method('findLayoutContainer',function(){var tmp=new fcmsLib_Utils_Dom_ElementSelector(this._container);return tmp.down('[data-fCMS-object="ajaxLayoutContainer"]');}).method('findForwardAction',function(){var actionContainer=this.findLayoutContainer(this._container);if(actionContainer){return actionContainer.getAttribute('data-fCMS-forwardAction');} return null;}).method('findBackwardAction',function(){var actionContainer=this.findLayoutContainer(this._container);if(actionContainer){return actionContainer.getAttribute('data-fCMS-backAction');} return null;}).method('registerControls',function(){var tmp=new fcmsLib_Utils_Dom_ElementSelector(this._container);var controls=tmp.select('[data-fCMS-object="controlContainer"]');if(controls&&controls.length){controls.each(function(){this._registerForwardButtons();this._registerBackwardButtons();if(this.getShouldWipe()===true){this._registerWipe();}}.bind(this));}}).method('_registerForwardButtons',function(){var tmp=new fcmsLib_Utils_Dom_ElementSelector(this._container);var forwardButtons=tmp.select('[data-fCMS-button="forward"]');if(forwardButtons&&forwardButtons.length){forwardButtons.each(function(buttonElement){var buttonDomElement=new fcmsLib_Utils_Dom_Element(buttonElement);buttonElement.bind('click',function(e){this._siteObject.clickForward();}.bind(this));}.bind(this));}}).method('_registerBackwardButtons',function(){var tmp=new fcmsLib_Utils_Dom_ElementSelector(this._container);var forwardButtons=tmp.select('[data-fCMS-button="back"]');if(forwardButtons&&forwardButtons.length){forwardButtons.each(function(buttonElement){var buttonDomElement=new fcmsLib_Utils_Dom_Element(buttonElement);buttonElement.bind('click',function(e){this._siteObject.clickBackward();}.bind(this));}.bind(this));}}).method('_registerWipe',function(){var tmp=new fcmsLib_Utils_Dom_ElementSelector(this._container);var wipeElements=tmp.select('[data-fCMS-control="wipe"]');if(wipeElements&&wipeElements.length){wipeElements.each(function(wipeElement){wipeElement.bind('touchstart',function(){this._siteObject.touchStart(event);}.bind(this),false);wipeElement.bind('touchmove',function(){this._siteObject.touchMove(event);}.bind(this),false);wipeElement.bind('touchend',function(){this._siteObject.touchEnd(event);}.bind(this),false);wipeElement.bind('touchcancel',function(){this._siteObject.touchCancel(event);}.bind(this),false);}.bind(this));}}).method('transform',function(pixel,duration){this._container.setWebkitTransition(duration+' ease-in-out');this._container.setWebkitTransform('translate3d('+pixel+'px, 0px, 0px)');});})();(function(){fcmsJs.Class('fcmsUser_Layout_Datastore').construct(function(layoutId,layoutUrl,contextLevel){this._layoutId=layoutId;this._layoutUrl=layoutUrl;this._contextLevel=contextLevel;this._webservice=new fcmsUser_Core_Webservice('layout');this.onComplete=new fcmsLib_Core_Observer();this._result=null;}).method('getLayout',function(){var data={'contextUrl':this._layoutUrl,'contextLevel':this._contextLevel};this._webservice.call('getLayout',data,this.fetchResult.bind(this),'layout',this._layoutId);}).method('fetchResult',function(returnData){this._result=returnData;this.onComplete.notify();}).method('getHtml',function(){if(this._result){if(this._result.data['html']){return this._result.data['html'];}} return'';});})();if(typeof fcmsJs==="object"){fcmsJs.loaded("fcmsUser_Layout");}