Figment.Import("Figment.DOM",Figment.getJSRoot()+"_framework/");Figment.Import("Figment.Form",Figment.getJSRoot()+"_framework/");Figment.Import("Figment.EventHandler",Figment.getJSRoot()+"_framework/");Figment.Import("Figment.HashTable",Figment.getJSRoot()+"_framework/");Figment.Import("Disney.WDPRO.IBC.Reporting",Figment.getJSRoot()+"reporting/");Figment.Namespace("Disney.WDPRO.IBC.GuestServices");(function(){var self=Disney.WDPRO.IBC.GuestServices;self.CONSTANTS={SECURE_SITE_URL:"",GUEST_SERVICES_SECURE_WORKFLOW_NAME:"Guest_STD_LoginReg_Guest_Information_WorkFlow",DEFAULT_FORM_NAME:"columnCenter_Form",GUEST_SERVICES_CONTAINER_CLASS:"guest_services_module_container",GUEST_SERVICES_PLUGIN_CLASS:"guest_services_plugin",CALLER_ELEMENT_PLUGIN_ATTRIBUTE_NAME:"plugins",CALLER_ELEMENT_PLUGIN_INIT_STATES_NAME:"plugin-init-states",PLUGIN_NAME_ATTRIBUTE_NAME:"plugin-name",STATE_ATTRIBUTE_NAME:"plugin-state",SHOW_MODULE_CLASS:"openedState",HIDE_MODULE_CLASS:"closedState",ERRORS_LIST_CLASS:"guest_services_error_list",PREVENT_ASYNC_FROM_PLEASEWAIT:"noAsync",PROCESS_ENGINE:"",SELECT_FIELD_CLASS:"guest_services_birthday",SELECT_HIDE_CLASS:"guest_services_hide"};self.mapLoginHBXPNCodes=null;self.mapLoginHBXMLCCodes=null;self.mapLoginSCPNCodes=null;self.mapLoginSCHierCodes=null;self.strHBXCustom5Variable=null;self.strHBXCustom7Variable=null;self.strHBXCustom8Variable=null;self._observable=null;self._debug=false;self._plugin_mapping=null;self._sourceName=null;self._errors=[];self.addError=function(_fc5,_fc6){self._errors[_fc5]=_fc6;};self.getError=function(_fc7){return self._errors[_fc7];};self.getSourceName=function(){return self._sourceName;};self.setSourceName=function(_fc8){self._sourceName=_fc8;};self.getClassName=function(){return "Disney.WDPRO.IBC.GuestServices";};self.registerPlugin=function(_fc9){var _fca=self._plugin_mapping;if(_fca===null){_fca=new Figment.HashTable();}var _fcb=_fc9.getPluginElement();if(_fcb!==null){var _fcc=_fcb.getAttribute(self.CONSTANTS.PLUGIN_NAME_ATTRIBUTE_NAME);if(self.Shared.isNotEmptyOrNull(_fcc)){self.Shared.logger.debug("Registering plug-in: "+_fcc+" with: "+_fcb.id);_fca.put(_fcc,_fc9);self._plugin_mapping=_fca;}}};self.open=function(_fcd,_fce,_fcf){if(!Figment.isSecure()){var form;var _fd1={type:"hidden",name:"workflow",value:self.CONSTANTS.GUEST_SERVICES_SECURE_WORKFLOW_NAME};var _fd2={type:"hidden",name:"completeAction",value:"return"};if(!_fcf||!_fcf.form){form=document.getElementById(self.CONSTANTS.DEFAULT_FORM_NAME);if(form){form.action=self.CONSTANTS.SECURE_SITE_URL;form.method="post";Figment.Form.addInputsToForm(form,[_fd1,_fd2]);form.submit();}}else{if(_fcf){if(_fcf.form){_fcf.form.action=self.CONSTANTS.SECURE_SITE_URL;_fcf.form.method="post";Figment.Form.addInputsToForm(_fcf.form,[_fd1,_fd2]);if(_fcf.inputs){Figment.Form.addInputsToForm(_fcf.form,_fcf.inputs);}_fcf.form.submit();}}}}else{self.setSourceName(_fce);var _fd3=Figment.DOM.getElementsByClassName(self.CONSTANTS.GUEST_SERVICES_CONTAINER_CLASS);var _fd4=_fd3.length>0?_fd3[0]:null;if(_fd4!==null){var _fd5=null;var i;var _fd7=Figment.DOM.getElementsByClassName(self.CONSTANTS.GUEST_SERVICES_PLUGIN_CLASS,_fd4);var len=_fd7.length;for(i=0;i<len;i++){_fd5=_fd7[i];Figment.DOM.replaceClassName(_fd5,self.CONSTANTS.SHOW_MODULE_CLASS,self.CONSTANTS.HIDE_MODULE_CLASS);}var _fd9=_fcd.getAttribute(self.CONSTANTS.CALLER_ELEMENT_PLUGIN_ATTRIBUTE_NAME);if(_fd9!==null){var _fda=self._plugin_mapping;if(_fda!==null){var _fdb=[];var _fdc=_fcd.getAttribute(self.CONSTANTS.CALLER_ELEMENT_PLUGIN_INIT_STATES_NAME);if(_fdc!==null){_fdb=_fdc.split(",");}var _fdd=_fd9.split(",");len=_fdd.length;for(i=0;i<len;i++){var _fde=_fdd[i].trim();self.Shared.logger.debug("Show plug-in: "+_fde);var _fdf;if(_fdb.length>i){_fdf=_fdb[i].trim();self.Shared.logger.debug("Plug-in's Init State: "+_fdf);}_fd5=_fda.get(_fde);if(typeof _fd5!=="undefined"&&_fd5!==null){if(_fdf!==undefined){_fd5.setToState(_fdf);}else{_fd5.setToDefaultState();}var _fe0=_fd5.getPluginElement();if(_fe0!==null){Figment.DOM.replaceClassName(_fe0,self.CONSTANTS.HIDE_MODULE_CLASS,self.CONSTANTS.SHOW_MODULE_CLASS);}}delete _fde;delete _fdf;}delete _fdd;delete _fdc;delete _fdb;}delete _fda;}delete len;delete i;delete _fd5;delete _fd7;delete _fd9;self._clearErrors();self._hideSelects();Figment.DOM.replaceClassName(_fd4,self.CONSTANTS.HIDE_MODULE_CLASS,self.CONSTANTS.SHOW_MODULE_CLASS);self._move(_fd4,_fcd);self._relocate(_fd4,_fcd);}delete _fd3;delete _fd4;}self._stopFormEvents();};self.close=function(){self._showSelects();var _fe1=Figment.DOM.getElementsByClassName(self.CONSTANTS.GUEST_SERVICES_CONTAINER_CLASS);var _fe2=_fe1.length>0?_fe1[0]:null;if(_fe2!==null){Figment.DOM.replaceClassName(_fe2,self.CONSTANTS.SHOW_MODULE_CLASS,self.CONSTANTS.HIDE_MODULE_CLASS);}self._restoreFormEvents();};self.subscribe=function(_fe3){return (typeof _fe3!=="undefined"&&_fe3!==null)?_fe3:new Figment.EventHandler.Observer(self._observable);};self.unsubscribe=function(_fe4){self._observable.deleteObserver(_fe4);};self.dispatchEvent=function(_fe5){self._observable.notifyObservers(_fe5);};self._hideSelects=function(){if(document.all){var _fe6=document.getElementsByTagName("SELECT");for(var i=0;i<_fe6.length;i++){var _fe8=_fe6[i];if(Figment.DOM.hasClassName(_fe8,self.CONSTANTS.SELECT_FIELD_CLASS)===false){Figment.DOM.addClassName(_fe8,self.CONSTANTS.SELECT_HIDE_CLASS);}}}};self._showSelects=function(){if(document.all){var _fe9=document.getElementsByTagName("SELECT");for(var i=0;i<_fe9.length;i++){var _feb=_fe9[i];if(Figment.DOM.hasClassName(_feb,self.CONSTANTS.SELECT_HIDE_CLASS)){Figment.DOM.removeClassName(_feb,self.CONSTANTS.SELECT_HIDE_CLASS);}}}};self._clearErrors=function(){self.Shared.logger.debug("Clear all errors");var _fec=Figment.DOM.getElementsByClassName(self.CONSTANTS.ERRORS_LIST_CLASS);for(var i=0;i<_fec.length;i++){var _fee=_fec[i];var _fef=_fee.getElementsByTagName("UL");for(var j=0;j<_fef.length;j++){var _ff1=_fef[j];_fee.removeChild(_ff1);}}};self.changeState=function(_ff2,_ff3){self._clearErrors();self.Shared.logger.debug("Change state to: "+_ff2);var _ff4=new Figment.HashTable();for(var i=0;i<_ff3.length;i++){var _ff6=_ff3[i];var _ff7=_ff6.getAttribute(self.CONSTANTS.STATE_ATTRIBUTE_NAME);if(_ff7===_ff2){Figment.DOM.replaceClassName(_ff6,self.CONSTANTS.HIDE_MODULE_CLASS,self.CONSTANTS.SHOW_MODULE_CLASS);}else{Figment.DOM.replaceClassName(_ff6,self.CONSTANTS.SHOW_MODULE_CLASS,self.CONSTANTS.HIDE_MODULE_CLASS);}}};self._stopFormEvents=function(){self.Shared.logger.debug("Stopping form events temporarily");var _ff8=document.getElementsByTagName("FORM");for(var i=0;i<_ff8.length;i++){var _ffa=_ff8[i];_ffa._onsubmit=_ffa.onsubmit;_ffa.onsubmit=function(_ffb){return false;};}};self._restoreFormEvents=function(){self.Shared.logger.debug("Restoring form events");var _ffc=document.getElementsByTagName("FORM");for(var i=0;i<_ffc.length;i++){var _ffe=_ffc[i];_ffe.onsubmit=_ffe._onsubmit;_ffe._onsubmit=null;}};self._move=function(_fff,_1000){Figment.DOM.insertNodeBefore(_fff,document.body.firstChild);_fff.style.zIndex=107242346;};self._relocate=function(_1001,_1002){var _1003;var _1004,moduleLocation,callerLocation;var _1005=_1002.parentNode;if((typeof _1002==="undefined"||_1002===null)||(typeof _1001==="undefined"||_1001===null)){return;}_1003=self._getPosition(_1002);try{moduleLocation=self.Support.getLocation(_1001);callerLocation=self.Support.getLocation(_1002);_1001.style.top=_1003.top+(-_1001.offsetHeight)+"px";_1001.style.left=(_1003.left-(_1001.offsetWidth-_1002.offsetWidth))+"px";_1001.style.position="absolute";_1004=self.Support.getViewPortDimensions();moduleLocation=self.Support.getLocation(_1001);if(moduleLocation.x1<0){_1001.style.left=_1003.left+"px";}if(moduleLocation.y2<0){_1001.style.top=_1003.top+"px";}if(moduleLocation.y2<callerLocation.y2){_1001.style.top=_1003.top+"px";}if((_1001.offsetTop+_1001.offsetHeight)>_1004.y2){var _1006=0;if(document.documentElement&&document.documentElement.scrollTop){_1006=document.documentElement.scrollTop;}else{if(document.body){_1006=document.body.scrollTop;}}window.scrollTo(0,moduleLocation.y1);}}catch(error){}};self._getPosition=function(_1007){var _1008=0;var _1009=0;if(_1007.offsetParent){_1008=_1007.offsetLeft;_1009=_1007.offsetTop;while((_1007=_1007.offsetParent)){_1008+=_1007.offsetLeft;_1009+=_1007.offsetTop;}}return {"top":_1009,"left":_1008,"toString":function(){return "{top: "+this.top+", left: "+this.left+"}";}};};self._closeCallback=function(e){var event=Figment.EventHandler.getEvent(e);var _100c=event.element;self.close();var _100d=hbx.pn;var _100e=hbx.mlc;var _100f="";var _1010="";if(s_wdpro.hier1!==null){_100f=s_wdpro.pageName;_1010=s_wdpro.hier1;}if(_100d!==null&&_100e!==null){self.EVENT_HBX_Event_PageView(_100d,_100e,_100f,_1010);}};self.main=function(){var _1011="/_framework/components/processEngine";this.CONSTANTS.SECURE_SITE_URL=Figment.getSecureBase()+Figment.getWebRoot()+Figment.getContentLanguage()+_1011;this.CONSTANTS.PROCESS_ENGINE=Figment.getWebRoot()+Figment.getContentLanguage()+_1011;self.strHBXCustom5Variable=cv.c5;self.strHBXCustom7Variable=cv.c7;self.strHBXCustom8Variable=cv.c8;try{Disney.WDPRO.IBC.GuestServices.strHBXCustom5Variable=cv.c5;Disney.WDPRO.IBC.GuestServices.strHBXCustom8Variable=cv.c8;}catch(e){}self._observable=new Figment.EventHandler.Observable();self._debug=self.Shared.getQueryVariable("debug")==="true"?true:false;if(typeof console==="undefined"){console={debug:function(_1012){alert(_1012);}};}self.Shared.logger.debug("Loading Guest Services...");var _1013=document.getElementById("guest_services_module_close_link");if(_1013!==null){Figment.EventHandler.addEvent(_1013,"click",self._closeCallback);}self.mapLoginHBXPNCodes=new Figment.HashTable();self.mapLoginHBXMLCCodes=new Figment.HashTable();self.mapLoginSCPNCodes=new Figment.HashTable();self.mapLoginSCHierCodes=new Figment.HashTable();};self.EVENT_HBX_Event_PageView=function(_1014,_1015,_1016,_1017){var _1018={engines:[Disney.WDPRO.IBC.Reporting.ANALYTICS_ENGINES.HitBox,Disney.WDPRO.IBC.Reporting.ANALYTICS_ENGINES.SiteCatalyst],customVarsName:["cv.c5","cv.c7","cv.c8"],customVarsValue:[self.strHBXCustom5Variable,self.strHBXCustom7Variable,self.strHBXCustom8Variable]};_1018.pageName=_1014;_1018.MLC=_1015;_1018.scPageName=_1016;_1018.hier=_1017;Disney.WDPRO.IBC.Reporting.TrackCustomPageView(_1018);delete _1018;};self.getHBXPNCode=function(_1019){var _101a=_1019.element;var _101b=_101a.id;var _101c=self.mapLoginHBXPNCodes.get(_101b);return _101c;};self.getHBXMLCCode=function(_101d){var _101e=_101d.element;var _101f=_101e.id;var _1020=self.mapLoginHBXMLCCodes.get(_101f);return _1020;};self.getSCPNCode=function(_1021){var _1022=_1021.element;var _1023=_1022.id;var _1024=self.mapLoginSCPNCodes.get(_1023);return _1024;};self.getSCHierCode=function(_1025){var _1026=_1025.element;var _1027=_1026.id;var _1028=self.mapLoginSCHierCodes.get(_1027);return _1028;};})();Disney.WDPRO.IBC.GuestServices.Shared={isNotEmptyOrNull:function(obj){return (typeof obj!=="undefined"&&obj!==null)?true:false;},getQueryVariable:function(_102a){var _102b=location.search.substring(1);var _102c=_102b.split("&");for(var i=0;i<_102c.length;i++){var pair=_102c[i].split("=");if(pair[0]==_102a){return pair[1];}}return null;},logger:{debug:function(_102f){if(Disney.WDPRO.IBC.GuestServices._debug){console.debug(_102f);}}}};Disney.WDPRO.IBC.GuestServices.Event=Figment.Class();Disney.WDPRO.IBC.GuestServices.Event.prototype={initialize:function(){this.source=null;this.errors=[];this.event=null;this.data=new Figment.HashTable();this.result=false;},getEvent:function(){return this.event;},setEvent:function(event){this.event=event;},getErrors:function(){return this.errors;},addError:function(error){this.errors.push(error);},setErrors:function(_1032){this.errors=_1032;},getSource:function(){return this.source;},setSource:function(_1033){this.source=_1033;},getData:function(){return this.data;},addData:function(key,value){this.data.put(key,value);},setData:function(data){this.data=data;},getResult:function(){return this.result;},setResult:function(_1037){this.result=_1037;},toString:function(){return "{event: \""+this.event+"\", source: \""+this.source+"\", result: "+this.result+", errors: "+this.errors.toString()+", data: "+this.data.toString()+"}";}};Disney.WDPRO.IBC.GuestServices.Support={getViewPortDimensions:function(){var rect=new Disney.WDPRO.IBC.GuestServices.Rect();if(document.documentElement&&document.documentElement.clientWidth){rect.x2=document.documentElement.clientWidth;}else{if(document.body&&document.body.clientWidth){rect.x2=document.body.clientWidth;}else{if(window.innerWidth){rect.x2=window.innerWidth-18;}}}if(document.documentElement&&document.documentElement.clientHeight){rect.y2=document.documentElement.clientHeight;}else{if(document.body&&document.body.clientHeight){rect.y2=document.body.clientHeight;}else{if(window.innerHeight){rect.y2=window.innerHeight-18;}}}return rect;},isWithinRect:function(rect,_103a){var _103b=true;if(rect.x1>=_103a.x1&&rect.x2<=_103a.x2){_103b=true;}else{_103b=false;}if(_103b&&rect.y1>=_103a.y1&&rect.y2<=_103a.y2){_103b=true;}else{_103b=false;}return _103b;},getLocation:function(_103c){var rect=new Disney.WDPRO.IBC.GuestServices.Rect();if(_103c!==null){rect.x1=Figment.DOM.getX(_103c);rect.x2=Figment.DOM.getX(_103c)+_103c.offsetWidth;rect.y1=Figment.DOM.getY(_103c);rect.y2=Figment.DOM.getY(_103c)+_103c.offsetTop+_103c.offsetHeight;}return rect;}};Disney.WDPRO.IBC.GuestServices.Rect=Figment.Class();Disney.WDPRO.IBC.GuestServices.Rect.prototype={initialize:function(){this.x1=0;this.x2=0;this.y1=0;this.y2=0;},toString:function(){return "{x1:"+this.x1+",x2:"+this.x2+",y1:"+this.y1+",y2:"+this.y2+"}";}};Figment.EntryPoint.add(Disney.WDPRO.IBC.GuestServices);
