if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());if(!window.frosmo){window.frosmo={}}(function(){var c=window.frosmo,a=function(){return(c.config.debug&&window.console)},b=function(){var h=arguments[0],d,f;if(!a()){return}d=Array.prototype.slice.call(arguments);d.shift();if(typeof console[h]==="function"){console[h](d.length>1?d:d[0])}else{if(typeof d==="object"){f=JSON.stringify(d)}console.log(h+":"+f)}if(c.admin){if(typeof d==="object"){try{f=JSON.stringify(d)}catch(g){f=d.toString()}}else{f=d[0]}if(!window.frosmo.log){window.frosmo.log={}}if(!c.log[h]){c.log[h]=[]}c.log[h].push(f)}};if(!c){c={api:null,pb:null,messageApi:null,message:null,fbWrapper:null,fbElement:null,cookies:null,session:null,pmm:null,site:{events:null,contexts:null,config:{init:null},auth:null},event:null}}if(!c.config){c.config={origin:null,css:null,domain:null,pathname:window.location.pathname,api:{server:null},message:{rpc:null,enabled:true},fbWrapper:{locale:null,reloadOnLogin:null,cookieName:null,permissions:null,fbAppId:null,fanPageHref:false,loginTimeout:false,oauth:true},popup:{animationSpeed:200,closeButtonText:"Close",destroyOnClose:true},pb:{html:null,popups:null,navigation:null,apiUrl:null},cookies:{domain:window.location.host},user:{anonymize:false},product:{rpc:null},admin:{js:null},debug:false};c.config.get=function(e){var d=e.split("."),f,g=null;for(f=0;f<d.length;f=f+1){if(f===0&&c.config[d[f]]){g=c.config[d[f]]}else{if(g&&g[d[f]]){g=g[d[f]]}else{return null}}}return g}}if(!c.browser){c.browser={cors:function(){if(window.XMLHttpRequest){var d=new XMLHttpRequest();if("withCredentials" in d){return true}else{if(window.XDomainRequest){return true}}}return false}}}if(!c.error){c.error={log:function(d,e){e=e||0;c.console.error(d+" ["+e+"]");c.api.error(d,e)}}}c.error.SESSION_INVALID_CID=10001;c.error.SESSION_UNDEFINED_STARTTIME=10002;c.error.MESSAGE_CID_MISSING=20001;if(!c.enableDebug){c.enableDebug=function(){c.config.debug=true}}if(!c.console){c.console={log:function(){var d=["log"];d=d.concat(Array.prototype.slice.call(arguments));b.apply(this,d)},debug:function(){var d=["debug"];d=d.concat(Array.prototype.slice.call(arguments));b.apply(this,d)},info:function(){var d=["info"];d=d.concat(Array.prototype.slice.call(arguments));b.apply(this,d)},warn:function(){var d=["warn"];d=d.concat(Array.prototype.slice.call(arguments));b.apply(this,d)},error:function(){var d=["error"];d=d.concat(Array.prototype.slice.call(arguments));b.apply(this,d)}}}if(!c.addCss){c.addCss=function(f,g){var e=false,h,d;if(typeof f==="undefined"||f===null){return}h=document.createElement("link");h.type="text/css";h.rel="stylesheet";h.href=f;h.onload=function(){if(!e){e=true;c.console.log("frosmo.core.js -- loaded CSS file: "+f);if(g){g(h)}}};document.getElementsByTagName("head")[0].appendChild(h);if(document.body){d=document.createElement("img");d.src=f;d.onerror=function(){if(!e){e=true;c.console.log("frosmo.core.js -- loaded CSS file: "+f);if(g){g(h)}}document.body.removeChild(d)};document.body.appendChild(d)}else{c.console.error("Trying to load CSS file before document is fully loaded")}}}if(!c.site){c.site={}}if(!c.loader){c.loader={ready:function(d){d.call(window)}}}}());frosmo.user=(function(){var j,q=["family","travelType","season"],a="userData",n={id:null,country:null,gender:null,dob:null,city:null,email:null,displayname:null,firstname:null,lastname:null,facebookId:null,linkedinId:null,loginId:null,language:null,registrationTime:null},i=function(s){if(!n.hasOwnProperty(s)){return false}if(typeof n[s]==="undefined"){return false}return true},c=function(s){return"segment"+s.charAt(0).toUpperCase()+s.slice(1)},f=function(t,u){t=c(t);var s=frosmo.jstorage.get("segments",{});s[t]=u;frosmo.jstorage.set("segments",s)},o=false,g=function(){var s;if(o){return n}else{s=frosmo.jstorage.get(a,{});frosmo.utils.each(s,function(u,t){if(t==="source"){return}if(i(t)){n[t]=u}else{frosmo.console.error("trying to set unknown user data from jstorage: "+t+"="+u)}});o=true;return n}},b=function(){var s=g();return s.id},r=function(x){var w=frosmo.jstorage.get("userIdRelations",[]),u,s,t,v;for(u=0,s=w.length;u<s;u=u+1){t=w[u];v=t.facebookId?t.facebookId.toString():null;if(t.id===x||v===x||t.loginId===x){return t.id}}return null},p=function(v){var s=g(),t,u;u=s.facebookId?s.facebookId.toString():null;if(u&&u===v){return s.id}if(s.loginId===v){return s.id}t=r(v);return t||s.id||v},h=function(s){var y=frosmo.jstorage.get("userIdRelations",[]),w,u,x,v,t=false;for(w=0,u=y.length;w<u;w=w+1){v=y[w];x=v.facebookId?v.facebookId.toString():null;if(v.id===s.id||x===s.id||v.loginId===s.id){y[w]=s;t=true}}if(!t){y.push(s)}frosmo.jstorage.set("userIdRelations",y)},e=function(s){frosmo.jstorage.set(a,s);h(s);n=s;o=true;return n},k=function(s,t){if(s==="id"||s==="loginId"){s="userId"}return frosmo.validator.validateUserAttribute(s,t)},d=function(u){var t,s=frosmo.utils.clone(u);delete s.loginId;delete s.id;if(frosmo.config.user.anonymize){delete s.displayname;delete s.firstname;delete s.lastname;delete s.email;if(s.dob){s.dob=s.dob.replace(/-\d{2}/g,"-01")}}frosmo.utils.each(s,function(w,v){if(w===null){delete s[v]}});s.source=frosmo.session?frosmo.session.getSource():null;frosmo.api.setUserData(u.id,s)},l=function(w,t,y){var v=frosmo.utils.clone(n),x,u,s;x=k("userId",w);if(x){v.id=p(x.value)||x.value}frosmo.console.log("user.id from auth:"+p(x.value));s=frosmo.utils.clone(t);if(typeof s.id!=="undefined"){delete s.id}frosmo.utils.each(s,function(A,z){if(i(z)){x=k(z,A);if(x){v[z]=x.value}}else{frosmo.console.error("trying to set unknown user data: "+z+"="+A)}});if(v.id){d(v)}return e(v)},m=function(){var s={};frosmo.utils.each(frosmo.utils.objectKeys(n),function(t){s[t]=null});frosmo.jstorage.set(a,s);n=s;return n};j={setSegment:f,deleteSegment:function(t){var u=c(t),s=frosmo.jstorage.get("segments",{});delete s[u];frosmo.jstorage.set("segments",s);if(frosmo.utils.contains(q,t)){frosmo.api.clearCustomAttribute(b(),t)}else{frosmo.api.clearUserSegment(b(),t)}},setSegments:function(t){var u,v,s={},w=false;for(u in t){if(t.hasOwnProperty(u)){v=t[u];f(u,v);if(frosmo.utils.contains(q,u)){s[u]=v;w=true}else{frosmo.api.setUserSegment(b(),u,v)}}}if(w){frosmo.api.setCustomUserData(b(),s)}},setState:function(t,v){var s=frosmo.jstorage.get("states",{}),u=function(w){return"state"+w.charAt(0).toUpperCase()+w.slice(1)};t=u(t);s[t]=v;frosmo.jstorage.set("states",s)},getSegments:function(){return frosmo.jstorage.get("segments",{})},getStates:function(){return frosmo.jstorage.get("states",{})},setUserData:l,getUserData:g,getUserId:b,deleteUserData:m,getUserIdWithAuthId:p};if(window.frosmo.test){j.reset=function(){m();frosmo.jstorage.set(a,{});o=false};j.saveUserData=e;j.saveUserIdRelations=h;j.getUserIdFromRelations=r}return j}());frosmo.api=(function(){var a=0,c,g,k=[],f=function(p,l){var n,o,m,q,r={};if(typeof c==="undefined"||typeof g==="undefined"){k.push({event:p,args:l});frosmo.console.error('frosmo.api: API not initialized, event "'+p+'" queued');return null}for(n in l){if(l[n] instanceof Object){m=l[n];for(o in m){if(m.hasOwnProperty(o)){r[o]=m[o]}}}else{if(l[n]===undefined){r[n]=null}else{r[n]=l[n]}}}for(n in r){if(r[n]===null||r[n]===false){r[n]=""}else{if(r[n]===true){r[n]="1"}}}if(frosmo.session){if(p!=="error"||frosmo.session.hasPersistentId()){r.cookieId=frosmo.session.getPersistentId();frosmo.console.log('frosmo.api: Event "'+p+'" using cookieId "'+r.cookieId+'"')}else{frosmo.console.log('frosmo.api: Event "'+p+'" with missing cookieId')}}else{frosmo.console.log('frosmo.api: Event "'+p+'" without cookieId')}r.event=p;r.origin=g;q=[];for(n in r){if(r.hasOwnProperty(n)){q.push(encodeURIComponent(n)+"="+encodeURIComponent(r[n]))}}return c+q.join("&")+"&"+(a+=1)},j=function(m){var n=m.getFullYear(),o=m.getMonth(),l=m.getDate();if(o<10){o="0"+o}if(l<10){l="0"+l}return n+"-"+o+"-"+l},i=function(n){var l=n.getHours(),o=n.getMinutes(),m=n.getSeconds();if(l<10){l="0"+l}if(o<10){o="0"+o}if(m<10){m="0"+m}return l+":"+o+":"+m},d=function(l){return j(l)+" "+i(l)},b=function(m){if(m){var l=new Image();l.src=m;frosmo.console.log("frosmo.api: Call URL "+m)}},e=function(){var o,m,n;if(k.length>0){for(o=0,m=k.length;o<m;o+=1){frosmo.console.log('frosmo.api: Call queued "'+k[o].event+'" event');n=f(k[o].event,k[o].args);b(n)}k=[]}},h=function(l,m){c=l;g=m;frosmo.console.log('frosmo.api: Initialized with origin "'+g+'"');e()};return{init:h,setCallUrl:function(l){b=l},error:function(n,o){var m,l=window.location.href,p=navigator.userAgent;o=o||0;m=f("error",{error:n,code:o,href:l,ua:p});b(m)},login:function(m,n){var l=f("login",{userId:m,source:n});b(l)},showFeed:function(l,n){var m=f("showFeed",{feedType:l,userId:n});b(m)},publishFeed:function(l,n,o){var m=f("publishFeed",{feedType:l,userId:n,uniqueId:o});b(m)},clickFeed:function(l,n,o){var m=f("clickFeed",{feedType:l,userId:n,uniqueId:o});b(m)},invite:function(n,m,o){var l=f("invite",{userId:n,invitationType:m,uniqueId:o});b(l)},acceptInvitation:function(m,n,o){var l=f("acceptInvitation",{userId:m,invitationType:n,uniqueId:o});b(l)},newUser:function(n,r,s,o,m,q,p){var l=f("newUser",{userId:n,country:r,language:s,gender:o,email:m,dob:q,source:p});b(l)},updateUser:function(n,r,s,o,m,q,p){var l=f("updateUser",{userId:n,country:r,language:s,gender:o,email:m,dob:q,source:p});b(l)},sendGift:function(o,n,m){var l=f("sendGift",{senderId:o,giftType:n,onRequest:m});b(l)},receiveGift:function(n,m){var l=f("receiveGift",{receiverId:n,giftType:m});b(l)},useGift:function(m,n){var l=f("useGift",{userId:m,giftType:n});b(l)},requestGift:function(m){var l=f("requestGift",{userId:m});b(l)},buyVirtualGood:function(o,q,n,p,l){var m=f("buyVirtualGood",{userId:o,category:q,name:n,price:p,currency:l});b(m)},receiveMoney:function(o,n,l,p){var m=f("receiveMoney",{userId:o,amount:n,currency:l,moneySource:p});b(m)},trackUserPath:function(o,p,n,l){var m=f("trackUserPath",{userId:o,pathId:p,pathState:n,position:l});b(m)},advanceToRank:function(m,n){var l=f("advanceToRank",{userId:m,rank:n});b(l)},showSaleTrigger:function(n,l,o){var m=f("showSaleTrigger",{userId:n,campaignId:l,triggerId:o});b(m)},clickSaleTrigger:function(n,l,o){var m=f("clickSaleTrigger",{userId:n,campaignId:l,triggerId:o});b(m)},buySaleTrigger:function(n,l,o){var m=f("buySaleTrigger",{userId:n,campaignId:l,triggerId:o});b(m)},setVirtualGoodInfo:function(n,m,o){var l=f("setVirtualGoodInfo",{category:n,name:m,imgUrl:o});b(l)},viewProduct:function(m,o,n){var l=f("viewProduct",{userId:m,productType:o,productId:n});b(l)},buyProduct:function(o,s,q,m,l,p,r){var n=f("buyProduct",{userId:o,productType:s,productId:q,netValue:m,fee:l,tax:p,paymentChannel:r});b(n)},recommendProduct:function(m,o,n){var l=f("recommendProduct",{userId:m,productType:o,productId:n});b(l)},practice:function(n,m){var l=f("practice",{gameId:n,userId:m});b(l)},setUserData:function(n,m){var l=f("setUserData",{userId:n,userAttributes:m});b(l)},showMessage:function(o,n,m){var l=f("showMessage",{userId:o,messageId:n,revision:m});b(l)},clickMessage:function(o,n,m){var l=f("clickMessage",{userId:o,messageId:n,revision:m});b(l)},progressBarEvent:function(q,p,o,l,n){var m=f("progressBarEvent",{userId:q,progressBarName:p,progressBarState:o,progressBarEvent:l,progressBarValue:n});b(m)},advanceProgressBarState:function(o,n,m){var l=f("advanceProgressBarState",{userId:o,progressBarName:n,progressBarState:m});b(l)},skipProgressBarState:function(o,n,m){var l=f("skipProgressBarState",{userId:o,progressBarName:n,progressBarState:m});b(l)},setCustomUserData:function(n,l){var m=f("setCustomUserData",{userId:n,customUserAttributes:l});b(m)},visit:function(m,o,n){var l=f("visit",{userId:m,source:o,newSession:n});b(l)},showOffer:function(n,o,m){var l=f("showOffer",{userId:n,compositeOfferId:o,placement:m});b(l)},clickOffer:function(m,n){var l=f("clickOffer",{userId:m,compositeOfferId:n});b(l)},setProductData:function(m,n){var l=f("setProductData",{productId:m,productAttributes:n});b(l)},buyOffer:function(n,q,l,p,o,r){var m=f("buyOffer",{userId:n,compositeOfferId:q,normalPrice:l,discountPrice:p,businessPrice:o,paymentChannel:r});b(m)},clearCustomAttribute:function(n,m){var l=f("clearCustomAttribute",{userId:n,customAttributeName:m});b(l)},setUserSegment:function(n,o,l){var m=f("setUserSegment",{userId:n,segmentName:o,segmentValue:l});b(m)},clearUserSegment:function(m,n){var l=f("clearUserSegment",{userId:m,segmentName:n});b(l)}}}());if(!window.frosmo){window.frosmo={}}frosmo.cookies=(function(){if(frosmo.cookies){return frosmo.cookies}return{set:function(b,f,e,a){var d="",c;if(f===null){d=escape(b)+"="}else{d=escape(b)+"="+escape(f)}if(a){c=new Date();c.setTime(new Date().getTime()+a*24*60*60*1000);d+=";expires="+c.toUTCString()}if(!e){e=frosmo.config.cookies.domain||null}if(e&&/\.[a-z]+$/.exec(e)){d+=";domain="+escape(e)}d+=";path=/";document.cookie=d},get:function(b){if(document.cookie.length>0){var c=document.cookie.indexOf(b+"="),a;if(c!==-1){c+=b.length+1;a=document.cookie.indexOf(";",c);if(a===-1){a=document.cookie.length}return unescape(document.cookie.substring(c,a))}}return""}}}());frosmo.event=(function(){var g=function(){if(typeof frosmo.api==="undefined"){throw new Error("frosmo.api.js not loaded (required by frosmo.event.js)")}if(typeof frosmo.session==="undefined"){throw new Error("frosmo.session.js not loaded (required by frosmo.event.js)")}if(typeof frosmo.user==="undefined"){throw new Error("frosmo.user.js not loaded (required by frosmo.event.js)")}},d=function(i,h){frosmo.console.log("frosmo.event.login() userId: "+i);frosmo.user.setUserData(i,h);frosmo.session.login();frosmo.api.login(i,(frosmo.session?frosmo.session.getSource():null));if(frosmo.site.event.login){frosmo.site.event.login()}},b=function(){frosmo.console.log("frosmo.event.logout()");var h=frosmo.site.auth&&frosmo.site.auth.isLoggedIn?frosmo.site.auth.isLoggedIn():false;if(!frosmo.fbWrapper.getLoggedIn()&&!h){frosmo.console.log("not logged in with FB or site: "+h+" & "+frosmo.fbWrapper.getLoggedIn());frosmo.user.deleteUserData()}if(frosmo.site.event.logout){frosmo.site.event.logout()}},c=function(i,j){i=i||null;j=j||i;frosmo.console.log("frosmo.event.newVisitor()");frosmo.api.setUserData(null,{source:j});frosmo.api.visit(null,i,true);var h=function(){if(frosmo.site.event.newVisitor){frosmo.site.event.newVisitor()}};frosmo.init.afterInit(h)},a=function(i){frosmo.console.log("frosmo.event.returningVisitor()");frosmo.api.visit(null,i,false);var h=function(){if(frosmo.site.event.returningVisitor){frosmo.site.event.returningVisitor()}};frosmo.init.afterInit(h)},f=function(){var h={},i;if(arguments.length>=1){h=arguments[0]}else{h={}}frosmo.console.log("Event Call >>>> Message Call with context name");if(h.inline){if(typeof h.inline==="object"){if(typeof h.inline.html==="function"){i=h.inline.get(0)}else{i=h.inline}}else{if(h.inline.match(/^#/)){i=document.getElementById(h.inline.replace(/^#/,""))}else{i=document.getElementById(h.inline)}}if(!i||i.length===0){frosmo.console.error("Can not find inline element!!!");return}}if(i&&h.position){frosmo.console.log("calling message to position: "+h.position);frosmo.message.display(h.position,{inline:i,position:h.position})}else{frosmo.console.log("calling popup message");frosmo.message.display()}},e=function(){frosmo.console.log("Event Call >>>> viewProduct");frosmo.pageContext.viewProduct()};return{init:g,login:d,logout:b,newVisitor:c,returningVisitor:a,provideMessage:f,viewProduct:e}}());frosmo.message=(function(){var c={},d=function(g,h){if(h){frosmo.console.log(h+": "+g)}else{frosmo.console.log("frosmo.message: "+g)}},a=function(g,h){if(h){frosmo.console.error(h+": "+g)}else{frosmo.console.error("frosmo.message: "+g)}},b=null,f=function(g){var h;frosmo.console.log("frosmo.message: Initializing...");if(typeof frosmo.request==="undefined"){throw new Error("frosmo.request.js not loaded (required by frosmo.message.js)")}if(typeof frosmo.messageApi==="undefined"){throw new Error("frosmo.messageApi.js not loaded (required by frosmo.message.js)")}if(typeof frosmo.pageContext==="undefined"){throw new Error("frosmo.pageContext.js not loaded (required by frosmo.message.js)")}if(!g){g={}}if(typeof frosmo.config.message.enabled==="undefined"){frosmo.config.message.enabled=true}if(typeof g.limit==="undefined"){d("Message limit not defined, set it to unlimited","frosmo.message.init()");g.limit=false}else{if(g.limit){d("Message limit set to: "+g.limit,"frosmo.message.init()")}else{d("Message limit set to unlimited","frosmo.message.init()")}}if(!g.rpc){d("Using rpc URL from frosmo.config.message","frosmo.message.init()");g.rpc=frosmo.config.message.rpc}if(frosmo.api){d("Tracking displayed messages with frosmo.api.showMessage()","frosmo.message.init()");if(g.afterDisplay&&typeof g.afterDisplay==="function"){h=g.afterDisplay}g.afterDisplay=function(j){var i=this;d("Track message display with frosmo.api.showMessage()","frosmo.message.init()");frosmo.api.showMessage(i.getUser(),j.id,j.revision);if(h&&typeof g.afterDisplay==="function"){h.call(i,j)}}}if(!g.afterClick){if(frosmo.api){d("Tracking message clicks with frosmo.api.clickMessage()","frosmo.message.init()");g.afterClick=function(l,k,j){var i=this;d("Track message click with frosmo.api.clickMessage()","frosmo.message.init()");frosmo.api.clickMessage(i.getUser(),l.id,l.revision);if(typeof j==="function"){window.setTimeout(function(){d("Call callback function after clicking","frosmo.message.init()");j.call(i)},500)}}}}this.options=g;d("frosmo.message options set","frosmo.message.init()")},e=function(g,h){var i,k,j;if(!h){h={}}if(!frosmo.config.message.enabled){d("frosmo.message is disabled","frosmo.message.display()");return}if(!this.options){a("frosmo.message is not initialized","frosmo.message.display()")}if(g===undefined){d("position is not set, using popup by default","frosmo.message.display()");g="popup"}if(g!=="popup"&&!h.inline){a("Trying to call inline message without inline container","frosmo.message.display()");return}k=frosmo.utils.extend({},this.options);if(h&&typeof(h)==="object"){k=frosmo.utils.extend(k,h)}j=frosmo.pageContext.getPath();if(typeof j==="undefined"||j===null||j===""){a("Message path not defined");return}i=new frosmo.messageApi(frosmo.config.message.origin,null,null,k);d("frosmo.messageApi version "+i.getVersion()+" initialized for position: "+g,"frosmo.message.init()");d("Set message path to '"+j+"'");i.setPath(j);i.setPosition(g);i.setUser(frosmo.user.getUserId());d("Set segment metadata");i.addMetadata(frosmo.user.getSegments());d("Set pageContext metadata");i.addMetadata(frosmo.pageContext.getContextAttributes());d("Set user metadata");i.addMetadata(frosmo.user.getUserData());d("Set state metadata");i.addMetadata(frosmo.user.getStates());i.addMetadata({source:frosmo.session.getSource(),referer:frosmo.session.getReferer()});i.resetStartTime();i.resetRequestTime();i.resetMessages();frosmo.console.log("frosmo.message.js -- Call frosmo.messageApi.requestMessage()");i.requestMessage();this.apis[g]=i;return true};return{apis:c,init:f,display:e}}());frosmo.messageApi=(function(){var l="https://optimizer.frosmo.com/messageApi",p="2.0.0",i=60,c=5000,h=1000,e=/^(https?:\/\/[a-zA-Z0-9:\-]+)\//,r,b=function(t,u){if(u){frosmo.console.log(u+": "+t)}else{frosmo.console.log("frosmo.messageApi: "+t)}},g=function(t,u){if(u){frosmo.console.error(u+": "+t)}else{frosmo.console.error("frosmo.messageApi: "+t)}},m=function(x,y){var A=function(B,C,D){if(B.removeEventListener){return B.removeEventListener(C,D,false)}else{if(B.detachtEvent){return B.detachEvent("on"+C,D)}}},t=function(E,G){if(E.className){if(/(close|fb_button)/i.exec(E.className)){return false}}var D,B,C,H,F=function(I,K,J){J.call(this,K,function(){A(I,"click",H);if(B){window.location.href=B}})};if(/fb_button/i.exec(E.className)){B=null;D=E.parentNode.tagName.toLowerCase()+" > a"}else{B=E.getAttribute("href");D="a[href="+B+"]"}if(E.addEventListener){b("Add click event listener to ("+D+") with element.addEventListener()");H=function(I){b("("+D+") clicked");I.preventDefault();F(this,I,G)};return E.addEventListener("click",H,false)}else{if(E.attachEvent){b("Add click event listener to ("+D+") with element.attachEvent()");H=function(){b("("+D+") clicked");var I=window.event;I.returnValue=false;F(E,I,G)};return E.attachEvent("onclick",H)}}g("Failed to add click event listener");return false},v=function(B,D){var E,C=function(F,H,G){G.call(this,H,function(){A(F,"submit",E);F.submit()})};if(B.addEventListener){b("Add submit event listener to form with element.addEventListener()");E=function(F){F.preventDefault();C(this,F,D)};return B.addEventListener("submit",E,false)}else{if(B.attachEvent){b("Add submit event listener to form with element.attachEvent()");E=function(){var F=window.event;F.returnValue=false;C(B,F,D)};return B.attachEvent("onsubmit",E)}}g("Failed to add submit event listener");return false},z,w,u;z=x.getElementsByTagName("a");for(w=0,u=z.length;w<u;w+=1){t(z[w],y)}z=x.getElementsByTagName("form");for(w=0,u=z.length;w<u;w+=1){v(z[w],y)}if(frosmo.fbWrapper){frosmo.fbWrapper.bindButtonClicks(x,y)}},a=function(y){var w=this,x,u,t,v;if(!frosmo.fbWrapper){b("Method frosmo.fbWrapper not loaded");return false}if(!frosmo.fbWrapper.parseFBMLElements){g("Method frosmo.fbWrapper.parseFBMLElements() not found");return false}if(!frosmo.fbWrapper.removeElementCallback){b("Method frosmo.fbWrapper.removeElementCallback() not found")}t=frosmo.fbWrapper.parseFBMLElements(y.content);if(t.length>0){v=function(z){var A={id:"message_"+y.id,on:{}};if(z.element==="like"){A.on.click=function(B,C){frosmo.utils.callIfDefined(y.on.click,w)}}else{if(z.element==="login-button"){A.on.login=function(B){frosmo.utils.callIfDefined(y.on.login,w,[B])}}else{return}}frosmo.fbWrapper.addElementCallback(z,A);if(frosmo.fbWrapper.removeElementCallback){y.callbacks.on.close.push(function(){frosmo.fbWrapper.removeElementCallback(z,A)})}};b("Add click tracking to XFBML elements");y.fbmlElements=t;for(x=0,u=t.length;x<u;x+=1){if(t[x]){v(t[x])}}return true}else{b("No XFBML elements found");return false}},s=function(u,v){var x=document.createElement("div"),t=document.createDocumentFragment(),w;x.innerHTML=u;if(x.children.length>0){for(w=0;w<x.children.length;w+=1){if(x.childNodes[w]){if(typeof v==="function"){v.call(window,x.childNodes[w])}t.appendChild(x.childNodes[w])}}}else{t=document.createTextNode(x.innerHTML)}return t},k=function(w,v){var t=document.createDocumentFragment(),u;for(u=0;u<w.length;u+=1){if(w[u]){if(typeof v==="function"){v.call(window,w[u])}t.appendChild(w[u])}}return t},f=function(u){if(window.location.origin){return(u.indexOf(window.location.origin)===0)}else{var t=e.exec(window.location);if(t){return(u.indexOf(t[1])===0)}else{return false}}},j=function(v){if(v.length>0){var u="",t;for(t=0;t<v.length;t+=1){if(t>0){u+=","}if(typeof v[t]==="object"){u+=v[t].id}else{u+=v[t]}}return u}else{return null}},q=function(){if(window.XMLHttpRequest){var t=new XMLHttpRequest();if("withCredentials" in t){return true}else{if(window.XDomainRequest){return true}}}return false},n=function(u){if(typeof(u)!=="string"){return false}var t=new RegExp("(\\d+)\\.?(\\d+)?\\.?(\\d+)?"),w=t.exec(u);return{major:parseInt(w[1],10)||0,minor:parseInt(w[2],10)||0,patch:parseInt(w[3],10)||0}},o=function(u,v){var t=n(""+u),w=n(""+v);if(t.major!==w.major){return(w.major>t.major)}else{if(t.minor!==w.minor){return(w.minor>t.minor)}else{if(t.patch!==w.patch){return(w.patch>t.patch)}else{return true}}}},d={POPUP:"popup",INLINE:"inline"};r=function(){var F=arguments[0],H=arguments[1]||null,y=arguments[2]||null,I=arguments[3]||null,B=l,E=null,w=false,C=1,D=0,G=0,A=null,x={},u=null,v=null,t=null,z=null;this.getFacebookFriends=function(){return t};this.setFacebookFriends=function(J){if(frosmo.utils.isArray(J)){t=j(J)}return this};this.setMetadata=function(J){E=J||null;return this};this.addMetadata=function(J){if(J&&frosmo.utils.objectKeys(J).length>0){if(!E){frosmo.console.log("frosmo.messageApi -- creating empty metadata object");E={}}frosmo.console.log("frosmo.messageApi -- extending metadata with "+JSON.stringify(J));E=frosmo.utils.extend(E,J)}return this};this.getAge=function(Q){var N,O,L,K,P,J,M=/^\d{4}-\d{2}-\d{2}$/;if(!Q){return}if(M.test(Q)){P=Q.split("-");N=parseInt(P[0],10);O=parseInt(P[1],10);L=parseInt(P[2],10);frosmo.console.log("year:"+N+", month: "+O+", day: "+L);K=new Date();J=K.getFullYear()-N;if(K.getMonth()<O||(K.getMonth()===O&&K.getDate()<L)){J=J-1}frosmo.console.log("age: "+J);return J}else{frosmo.console.error("Date of Birth "+Q+" is in wrong format! must be in YYYY-MM-DD");return null}};this.getMetadata=function(){var L={},K,J;if(E){for(K in E){if(E.hasOwnProperty(K)){if(K&&K.match(/(product([A-Z][a-z]+)+)/)){L[K]=E[K]}if(K&&K.match(/(segment|state([A-Z][a-z]+)+)/)){L[K]=E[K]}if(K&&K.match(/(gender|language|age|source|referer|userAccount|loginId|facebookId|locale)/)){if(!E[K]){L[K]=""}else{L[K]=E[K]}}if(K&&K==="dob"){J=this.getAge(E[K]);if(J){L.age=J}}}}}return L};this.getOrigin=function(){return F};this.setOrigin=function(J){F=J;return this};this.getOptions=function(){return I};this.setOptions=function(J){I=J;return this};this.getMessageType=function(){return A};this.setMessageType=function(J){A=J;return this};this.getRequestTime=function(){return u};this.setRequestTime=function(J){u=J;return this};this.resetRequestTime=function(){u=null;return this};this.getStartTime=function(){return v};this.resetStartTime=function(){v=this.getTime();return this};this.getMessageCount=function(){return G};this.incrementMessageCount=function(){G+=1};this.getRequestCount=function(){return D};this.incrementRequestCount=function(){D+=1};this.addMessage=function(J){x[J.id]=J;return this};this.getMessage=function(J){if(J in x){return x[J]}else{return null}};this.resetMessages=function(){D=0;G=0;x={};return this};this.getMessageLimit=function(){return C};this.setMessageLimit=function(J){if(typeof C==="number"){C=J||false}else{C=false}return this};this.getPath=function(){return H};this.setPath=function(J){H=J||null;return this};this.getPosition=function(){return z};this.setPosition=function(J){z=J||null;return this};this.getRpc=function(){return B};this.setRpc=function(J){B=J;return this};this.getUser=function(){return y};this.setUser=function(J){y=J||null;return this};this.getInterval=function(){if(w===false){return 0}if(w>0){return(w<h?h:w)}else{return 0}};this.setInterval=function(J){if(typeof J==="boolean"){w=(J?c:false)}else{if(typeof J==="number"){w=J||false}}return this};this.init(I)};r.prototype={timers:{},debug:false,testing:false,afterClick:null,afterClose:null,afterDisplay:null,afterLogin:null,xhr:false,timeout:false,init:function(t){this.resetStartTime();if(t){if(t.metadata){this.setMetadata(t.metadata)}if(t.xhr){this.xhr=t.xhr}if(t.debug){this.debug=t.debug}if(t.testing){this.testing=t.testing}if(typeof t.interval!=="undefined"){this.setInterval(t.interval)}if(typeof t.limit!=="undefined"){this.setMessageLimit(t.limit)}if(typeof t.rpc==="string"||typeof t.rpc==="function"){this.setRpc(t.rpc)}if(t.afterDisplay){this.afterDisplay=function(u){frosmo.console.debug("frosmo.messageApi.afterDisplay() is deprecated, call message.on.display()");t.afterDisplay.call(this,u)}}if(t.afterClose){this.afterClose=function(u){frosmo.console.debug("frosmo.messageApi.afterClose() is deprecated, call message.on.close()");t.afterClose.call(this,u)}}if(t.afterClick){this.afterClick=function(w,v,u){frosmo.console.debug("frosmo.messageApi.afterClick() is deprecated, call message.on.click()");t.afterClick.call(this,w,v,u)}}if(t.afterLogin){this.afterLogin=function(v,u){frosmo.console.debug("frosmo.messageApi.afterLogin() is deprecated, call message.on.login()");t.afterLogin.call(this,v,u)}}if(t.messageType){this.setMessageType(t.messageType)}}if(this.xhr){if(!window.jQuery){g("jQuery is needed to make XHR requests","frosmo.messageApi.init()");this.setRpc(null)}else{if(!this.isXhrRpcAccessible()){g("RPC url and current document origin do not match","frosmo.messageApi.init()");this.setRpc(null)}else{b("Using XHR for making message RPC requests","frosmo.messageApi.init()")}}}if(this.getRpc()){if(typeof this.getRpc()==="function"){b("Message RPC defined as a function","frosmo.messageApi.init()")}else{b("Message RPC URL set to: "+this.getRpc(),"frosmo.messageApi.init()")}}else{b("Message RPC not defined","frosmo.messageApi.init()")}},isXhrRpcAccessible:function(){if(this.xhr){var t=this.getXhrRpcUrl();if(f(t)){return true}if(q()){return true}return false}else{return true}},getVersion:function(){return p},getTime:function(){return new Date().getTime()},getDelay:function(){var t=this.getStartTime();if(t){return this.getTime()-t}else{return null}},fetchMore:function(){var t=this.getMessageLimit();if(t===false){return true}if(this.getMessageCount()<t){return true}return false},inlineHtml:function(t){return'<div class="pmm-message"><h4 class="pmm-title">'+t.title+'</h4><div class="pmm-content">'+t.content+"</div></div>"},inlineHtmlRaw:function(t){return t.content},inlineMessage:function(y,z){var u=this,v=u.getOptions(),x,t,w;if(!v.inline){g("No inline target or callback function defined","frosmo.messageApi.inlineMessage()");return false}if(y.options.displayFormatRaw){x=u.inlineHtmlRaw.call(u,y)}else{if(typeof v.inlineHtml==="function"){x=v.inlineHtml.call(u,y)}else{x=u.inlineHtml.call(u,y)}}if(typeof v.inline==="function"){return v.inline.call(u,y,x)}if(typeof v.inline==="object"){if(typeof v.inline.html==="function"){t=v.inline.get(0)}else{t=v.inline}}else{if(v.inline.match(/^#/)){t=document.getElementById(v.inline.replace(/^#/,""))}else{t=document.getElementById(v.inline)}}if(!t){g("container for inline message missing, can NOT display message!");return false}t.innerHTML=x;if(y.callbacks.on.click.length>0){b("Add click tracking to the message","frosmo.messageApi.inlineMessage()");m(t,y.on.click)}if(window.FB){b("Parse XFBML elements in inline message","frosmo.messageApi.inlineMessage()");window.FB.XFBML.parse(t)}frosmo.utils.callIfDefined(y.on.display,u);return true},popupHtmlRaw:function(t){return t.content},popupMessage:function(A,u){var z=this,B=z.getOptions(),y,t,x,w,v={displayDelay:0};A.callbacks.on.close.push(function(){b("Popup closed, request new messages","frosmo.messageApi.popupMessage()");z.afterRequestMessage.call(z)});if(o("0.2",u.version)){if(A.options.displayDelay>0){x=parseInt(A.options.displayDelay,10);b("Message display delay set to "+x+" second(s)","frosmo.messageApi.popupMessage()");v.displayDelay=x*1000}}if(A.options.promptDoNotShowAgain==="1"){A.content=A.content+'<div style="width:100%;text-align:right;"><input type="checkbox" id="do-not-show-again" style="width:20px" onclick="frosmo.cookies.set(\'do-not-show-again-msg-'+A.id+"',1);\"> Do not show again</div>"}if(A.options.displayFormatRaw){b("Using internal function to display message with raw content","frosmo.messageApi.popupMessage()");y=z.popupHtmlRaw(A);z.displayPopup.call(z,A,y,v);return}if(typeof B.popupHtml==="function"){b("Creating message HTML using custom popupHtml function","frosmo.messageApi.popupMessage()");y=B.popupHtml.call(z,A)}if(typeof B.popup==="function"){b("Using custom function to display message","frosmo.messageApi.popupMessage()");B.popup.call(z,A,y,v)}else{if(B.fancybox){if(window.jQuery&&jQuery.fancybox){b("Using jQuery.fancybox to display message","frosmo.messageApi.popupMessage()");z.displayFancyBox.call(z,A,y,v)}else{g("jQuery.fancybox library not loaded","frosmo.messageApi.popupMessage()")}}else{if(y){b("Using internal function to display message with custom HTML","frosmo.messageApi.popupMessage()");z.displayPopup.call(z,A,y,v)}else{if(window.frosmo.popup){(function(){b("Using frosmo.popup to generate and display message","frosmo.messageApi.popupMessage()");var C=function(){frosmo.utils.callIfDefined(A.on.close,z)},E={afterClose:C},D=function(){var F=frosmo.popup.create(A.content,A.title,null,true,E)};if(A.callbacks.on.display.length>0){E.afterShow=function(){frosmo.utils.callIfDefined(A.on.display,z)}}if(A.callbacks.on.click.length>0){E.afterClick=function(G,F){frosmo.utils.callIfDefined(A.on.click,z,[G,F])}}A.callbacks.on.login.push(function(F){b("Call frosmo.popup.hide() when user has logged in","frosmo.messageApi.popupMessage()");frosmo.popup.hide(E)});if(v.displayDelay>0){z.timers[A.id]=window.setTimeout(function(){D.call(z)},v.displayDelay)}else{D.call(z)}}())}else{g("Can't display message: Popup HTML not defined and frosmo.popup not loaded","frosmo.messageApi.popupMessage()")}}}}},displayFancyBox:function(x,v,z,w){var t=this,u=t.getOptions(),y;if(typeof u.fancybox!=="object"){u.fancybox={}}if(!v){if(x.title){u.fancybox.title=x.title}v=x.content}y=function(){var B=u.fancybox.onClosed||null,C=u.fancybox.onComplete||null,A=u.fancybox;A.onClosed=function(){b("FancyBox closed","frosmo.messageApi.displayFancyBox()");frosmo.utils.callIfDefined(x.on.close,t);frosmo.utils.callIfDefined(B,this)};A.onComplete=function(){b("FancyBox displayed","frosmo.messageApi.displayFancyBox()");var D=document.getElementById("fancybox-content");x.callbacks.on.login.push(function(E){b("Close FancyBox popup when user has logged in","frosmo.messageApi.displayFancyBox()");jQuery.fancybox.close()});if(x.callbacks.on.click.length>0){b("Add click tracking to the message","frosmo.messageApi.displayFancyBox()");m(D,x.on.click)}if(window.FB){b("Parse XFBML elements in inline message","frosmo.messageApi.inlineMessage()");window.FB.XFBML.parse(D)}frosmo.utils.callIfDefined(x.on.display,t);frosmo.utils.callIfDefined(w,t,[x]);frosmo.utils.callIfDefined(C,this)};b("Displaying message with FancyBox","frosmo.messageApi.displayFancyBox()");jQuery.fancybox(v,A)};if(z.displayDelay>0){b("Displaying message with delay","frosmo.messageApi.displayFancyBox()");t.timers[x.id]=window.setTimeout(function(){y()},z.displayDelay)}else{b("Displaying message instantly","frosmo.messageApi.displayFancyBox()");y()}},displayPopup:function(C,w,v,y){var B=this,D=B.getOptions(),x,u,z,A=function(E){if(C.callbacks.on.click.length>0){b("Add click tracking to the message","frosmo.messageApi.displayPopup()");m(E,C.on.click)}},t=function(E){if(window.FB){b("Parse XFBML elements in popup message","frosmo.messageApi.displayPopup()");window.FB.XFBML.parse(E)}};if(typeof w==="string"){b("Creating DOM elements from HTML","frosmo.messageApi.displayPopup()");x=s(w,function(E){A(E);t(E)});u=function(){document.body.appendChild(x)}}else{if(typeof w==="object"){if(frosmo.utils.isArray(w)){b("Appending an array of HTMLElements","frosmo.messageApi.displayPopup()");x=k(w,function(E){A(E);t(E)});u=function(){document.body.appendChild(x)}}else{if(window.jQuery&&typeof w.toArray==="function"){b("Appending elements from jQuery set","frosmo.messageApi.displayPopup()");x=k(w.toArray(),function(E){A(E);t(E)});u=function(){document.body.appendChild(x)}}else{b("Appending single DOM object","frosmo.messageApi.displayPopup()");A(w);t(w);u=function(){document.body.appendChild(w)}}}}}if(typeof u==="function"){z=function(){b("Appending popup elements to the document","frosmo.messageApi.displayPopup()");u();frosmo.utils.callIfDefined(y,B,[C]);frosmo.utils.callIfDefined(C.on.display(),B)};if(frosmo.utils.isFunction(D.closePopup)){C.callbacks.on.login.push(function(E){b("Call closePopup when user has logged in","frosmo.messageApi.displayPopup()");frosmo.utils.callIfDefined(D.closePopup,B)})}if(v.displayDelay>0){b("Appending message with delay","frosmo.messageApi.displayPopup()");B.timers[C.id]=window.setTimeout(function(){z()},v.displayDelay)}else{b("Appending message instantly","frosmo.messageApi.displayPopup()");z()}}},afterRequestMessage:function(){var u=this,t=u.getInterval();if(t>0){if(u.getRequestCount()<i){if(typeof u.timers.interval==="undefined"){b("Check for new messages in "+t+" ms","frosmo.messageApi.afterRequestMessage()");u.timers.interval=window.setTimeout(function(){u.timers.interval=undefined;u.requestMessage()},t)}}else{b("Message request limit ("+i+") reached","frosmo.messageApi.afterRequestMessage()")}}else{b("Message request interval not enabled","frosmo.messageApi.afterRequestMessage()")}},getRequestParams:function(){var t,B=this.getMetadata(),u=this.getRequestTime(),A=this.getMessageType(),x={origin:this.getOrigin(),version:p},C=this.getPath(),y=this.getUser(),z=this.getPosition(),w;if(this.debug){x.debug=1}x.path=C;x.position=z;if(y){x.uid=y}else{x.visitor=1}if(u){x.time=u}if(A){x.messageType=A}if(B){x=frosmo.utils.extend(x,B)}if(frosmo.session){try{if(frosmo.session.hasPersistentId()){x.cid=frosmo.session.getPersistentId()}else{frosmo.error.log("Visitor persistentId not initialized",frosmo.error.MESSAGE_CID_MISSING)}w=frosmo.session.getDuration();if(w!==null){x.duration=frosmo.session.getDuration()}}catch(v){g(v)}}x.interval=this.getInterval();x.delay=this.getDelay();return x},getTestRequestParams:function(){var u=this.getRequestTime(),t=this.getMessageType(),v={path:this.getPath(),origin:this.getOrigin(),test:1,version:p};if(this.debug){v.debug=1}if(u){v.time=u}if(t){v.messageType=t}v.interval=this.getInterval();v.delay=this.getDelay();return v},getRequestData:function(){var u={},t=this.getFacebookFriends();if(t){u.facebookFriends=t}return u},requestMessage:function(){var t=this,x,w,v,y,u;if(!t.fetchMore()){frosmo.console.log("Do not fetch more messages","frosmo.messageApi.requestMessage()");return false}if(window.frosmo.popup&&frosmo.popup.visible()){b("Popup open, do not make request","frosmo.messageApi.requestMessage()");return false}if(!t.getRpc()){g("Message RPC not defined","frosmo.messageApi.requestMessage()");return false}if(t.testing){x=t.getTestRequestParams()}else{x=t.getRequestParams()}if(!x){g("No params for message RPC request","frosmo.messageApi.requestMessage()");return false}if(x.duration){b("Session duration set to "+x.duration+" ms","frosmo.messageApi.requestMessage()")}t.incrementRequestCount();u=t.getRequestData();if(t.xhr){b("Making XHR request","frosmo.messageApi.requestMessage()");return this.xhrRequest(x,u)}else{if(u){x=frosmo.utils.extend(x,u)}if(typeof t.getRpc()==="function"){b("Calling RPC callback function","frosmo.messageApi.requestMessage()");t.handleResponseSuccess.call(t,t.getRpc().call(t,x));return true}else{b("Making JSONP request","frosmo.messageApi.requestMessage()");if(!frosmo.request){g("frosmo.request is not loaded","frosmo.messageApi.requestMessage()");return false}y={params:x,timeout:t.timeout,on:{failure:function(){g("JSONP request failed","frosmo.messageApi.requestMessage()")},timeout:function(){g("JSONP request timed out","frosmo.messageApi.requestMessage()")},success:function(z){b("JSONP request success","frosmo.messageApi.requestMessage()");t.handleResponseSuccess.call(t,z)}}};v=frosmo.request.create(t.getRpc(),y);v.send.apply(v);return true}}},getXhrRpcUrl:function(){var t=this.getRpc();return(typeof t==="function"?t.call(this):t)},xhrRequest:function(x,u){b("Making XHR request","frosmo.messageApi.requestMessage()");var t=this,w=t.getXhrRpcUrl(),v={cache:false,success:function(A,y,z){t.handleResponseSuccess.call(t,A,y,z)},error:function(A,y,z){},dataType:"json"};if(u){v.type="POST";v.url=w+"?"+jQuery.param(x);v.data=u}else{v.type="GET";v.url=w;v.data=x}jQuery.ajax(v);return true},handleResponseSuccess:function(u,w,B){var C=this,t,y,E,v,A,D=C.getOptions(),x=function(F,G,H){if(frosmo.utils.isArray(G)&&G.length>0){frosmo.utils.each(G,function(I){if(frosmo.utils.isFunction(I)){if(H){I.apply(F,H)}else{I.apply(F)}}})}};if(u){if(typeof u.version==="undefined"){u.version="0.1"}b("Message RPC version: "+u.version,"frosmo.messageApi.handleResponseSuccess()");if(u.time){C.setRequestTime(u.time)}if(typeof u.message==="undefined"){b("No messages found","frosmo.messageApi.handleResponseSuccess()");C.afterRequestMessage.call(C);return}E=u.message;v=d.POPUP;if(C.getMessage(E.id)){b("Received duplicate message: "+E.id,"frosmo.messageApi.handleResponseSuccess()");C.afterRequestMessage.call(C);return}if(E.endTime){if(new Date().getTime()>(E.endTime*1000)){b("Message in response had already expired","frosmo.messageApi.handleResponseSuccess()");C.afterRequestMessage.call(C);return}}if(o("2.0.0",u.version)){if(this.getPosition()!==d.POPUP){v=d.INLINE}}else{if(o("0.2",u.version)){if(E.options.displayType){if(E.options.displayType===d.INLINE){v=d.INLINE}}}else{g("Message RPC is not up-to-date with the Javascript library","frosmo.messageApi.handleResponseSuccess()")}}if(o("2.0.0",u.version)){if(typeof E.options.displayFormatRaw==="object"){if(frosmo.utils.isArray(E.options.displayFormatRaw)){E.options.displayFormatRaw=E.options.displayFormatRaw[0]}else{E.options.displayFormatRaw=null}}E.options.displayFormatRaw=(E.options.displayFormatRaw==="yes"||E.options.displayFormatRaw===true)}E.callbacks={on:{click:[],close:[],display:[],login:[]}};if(typeof D.afterDisplay==="function"){E.callbacks.on.display.push(function(){b("Calling afterDisplay() method","frosmo.messageApi.handleResponseSuccess()");D.afterDisplay.call(C,E)})}if(typeof D.afterClose==="function"){E.callbacks.on.close.push(function(){b("Call afterClose() method","frosmo.messageApi.handleResponseSuccess()");D.afterClose.call(C,E)})}if(typeof D.afterClick==="function"){E.callbacks.on.click.push(function(G,F){b("Call afterClick() method","frosmo.messageApi.handleResponseSuccess()");D.afterClick.call(C,E,G,F)})}if(typeof D.afterLogin==="function"){E.callbacks.on.login.push(function(F){b("Call afterLogin() method","frosmo.messageApi.handleResponseSuccess()");D.afterLogin.call(C,E,F)})}E.on={click:function(G,F){b("Run callbacks in message.callbacks.on.click","message.on.click()");x(C,E.callbacks.on.click,[G,F])},close:function(){b("Run callbacks in message.callbacks.on.close","message.on.close()");x(C,E.callbacks.on.close)},display:function(){b("Run callbacks in message.callbacks.on.display","message.on.display()");x(C,E.callbacks.on.display)},login:function(F){b("Run callbacks in message.callbacks.on.login","message.on.login()");x(C,E.callbacks.on.display,[F])}};if(E.template){try{C.parseMessageTemplate(E)}catch(z){g(z,"frosmo.messageApi.handleResponseSuccess()");return}}a(E);C.incrementMessageCount();C.addMessage(E);if(v===d.INLINE){b("Display inline message","frosmo.messageApi.handleResponseSuccess()");C.inlineMessage.call(C,E,u)}else{if(frosmo.cookies.get("do-not-show-again-msg-"+E.id)==="1"){b("Popup message "+E.id+" 'Do not show again' set","frosmo.messageApi.handleResponseSuccess()")}else{b("Display popup message","frosmo.messageApi.handleResponseSuccess()");C.popupMessage.call(C,E,u)}}}else{g("No response from server","frosmo.messageApi.handleResponseSuccess()")}C.afterRequestMessage.call(C)},parseMessageTemplate:function(t){if(typeof frosmo.template==="undefined"){throw new Error("frosmo.template.js not found")}if(t.template&&t.template.name){if(typeof t.originalContent==="undefined"){t.originalContent=t.content}t.content=frosmo.template.parse(t.content,t.template.name)}}};return r}());frosmo.pageContext=(function(){var b={},h="",d=null,g=function(n){return JSON.parse(JSON.stringify(n))},l=function(){return b.productId},m=function(n){b=(function(o){var q=frosmo.validator.validateProductAttribute,p={};frosmo.utils.each(o,function(s,r){var t=q(r,s);if(t){p[r]=t.value}});return p}(n));if(l()){frosmo.api.setProductData(l(),b)}},j=function(){return g(b)},e=function(n){h=n},f=function(n){if(n.match(/[a-z]{2,3}(_[A-Z]{2})?/)){d=n}else{throw new Error("Invalid locale string: "+n)}},k=function(){var n=g(b);n.path=h;if(typeof d!=="undefined"&&d!==null&&d!==""){n.locale=d}return n},c=function(){if(!l()){frosmo.console.error("productId not defined");return}frosmo.api.viewProduct(frosmo.user.getUserId(),null,l())},i=function(o,n,p,q){if(!l()){frosmo.console.error("productId not defined");return}frosmo.api.buyProduct(frosmo.user.getUserId(),null,l(),o,n,p,q)},a=function(){if(!l()){frosmo.console.error("productId not defined");return}frosmo.api.recommendProduct(frosmo.user.getUserId(),null,l())};return{setProductAttributes:m,getProductAttributes:j,setPath:e,getPath:function(){return h},setLocale:f,getLocale:function(){return d},getProductId:l,getContextAttributes:k,viewProduct:c,buyProduct:i,recommendProduct:a}}());(function(){var a,i,j,e=function(p,q){if(q){frosmo.console.log(q+": "+p)}else{frosmo.console.log("frosmo.popup: "+p)}},k=function(p,q){if(q){frosmo.console.error(q+": "+p)}else{frosmo.console.error("frosmo.popup: "+p)}},d=function(){if(a){a=null}},g=function(){if(a&&a.is(":visible")){return true}else{return false}},o=function(r,s){var q=jQuery(window),t,p,v={},u={horizontal:true,vertical:true,margin:frosmo.config.popup.centerIncludeMargins};r=jQuery(r);s=jQuery.extend(u,s);if(s.horizontal){if(s.margin){t=r.outerWidth({margin:true})}else{t=r.width()}v.left=Math.floor(Math.max((q.width()-t)/2,0))}if(s.vertical){if(s.margin){p=r.outerHeight({margin:true})}else{p=r.height()}v.top=Math.floor(Math.max((q.height()-p)/2,0))}if(v){v.position="fixed";r.css(v)}},c=function(q){if(!a){k("No popup found to hide","frosmo.popup.hide()");return}var r={hideBackground:true},p=function(){if(q.hideBackground){e("Hide background","frosmo.popup.hide()");j.hide()}if(q&&typeof q.afterClose==="function"){e("Calling afterClose callback function","frosmo.popup.hide()");q.afterClose.call(window)}};q=jQuery.extend(r,q);e("Hide popup","frosmo.popup.hide()");if(g()){e("Popup is visible, hiding it","frosmo.popup.hide()");if(typeof frosmo.config.popup.hide==="function"){frosmo.config.popup.hide.call(window,a,p)}else{if(frosmo.config.popup.animationSpeed>0){a.hide(frosmo.config.popup.animationSpeed,p)}else{a.hide();p()}}}else{e("Popup is already hidden","frosmo.popup.hide()");p()}},l=function(r){var p=this,q;e("Showing popup","frosmo.popup.show()");a.find(".frosmoPopupClose").click(function(s){s.preventDefault();e("User clicked close button in popup","frosmo.popup.show()");p.hide(r)});if(r&&r.closeOnBgClick){jQuery("#frosmoPopupBackground").bind("click.bg",function(s){s.preventDefault();e("User clicked background in popup","frosmo.popup.show()");p.hide(r);j.unbind("click.bg")})}if(r&&r.closeOnEsc){jQuery(document).bind("keyup.esc",function(s){if(s.keyCode===27){s.preventDefault();e("User pressed esc","frosmo.popup.show()");p.hide(r);jQuery(document).unbind("keyup.esc")}})}if(r&&r.center){e("Center popup","frosmo.popup.show()");frosmo.popup.center(a,r.centerOptions||null);jQuery(window).resize(function(s){frosmo.popup.center(a,r.centerOptions)})}if(r&&typeof r.afterClick==="function"){e("Add afterClick callbacks to popup links and forms","frosmo.popup.show()");a.find("a").not("#frosmoPopupClose").not(".fb_button").bind("click",function(u){u.preventDefault();e("User clicked a link in the popup","frosmo.popup.show()");var t=jQuery(this),s=this.href;r.afterClick.call(window,u,function(){e("Link afterClick complete callback, update window.location","frosmo.popup.show()");t.unbind(u);if(s){window.location.href=s}})});a.find("form").bind("submit",function(t){t.preventDefault();e("User submitted a form in the popup","frosmo.popup.show()");var s=jQuery(this);r.afterClick.call(window,t,function(){e("From afterClick complete callback, submit form data","frosmo.popup.show()");s.unbind(t);s.submit()})});if(frosmo.fbWrapper){e("Add event listeners to Facebook buttons","frosmo.popup.show()");frosmo.fbWrapper.bindButtonClicks(a.get(0),r.afterClick)}}if(window.FB){e("Parse XFBML elements in popup","frosmo.popup.show()");FB.XFBML.parse(a.get(0))}q=function(){if(r&&typeof r.afterShow==="function"){e("Calling afterShow callback function","frosmo.popup.show()");r.afterShow.call(window)}};j.show();if(g()){e("Message is already visible","frosmo.popup.show()");q()}else{e("Displaying message","frosmo.popup.show()");if(typeof frosmo.config.popup.show==="function"){frosmo.config.popup.show.call(window,a,q)}else{if(frosmo.config.popup.animationSpeed>0){a.show(frosmo.config.popup.animationSpeed,q)}else{a.show();q()}}}},m=function(p){if(typeof p!=="string"){p=""}var q=frosmo.config.popup.closeButtonAltText?frosmo.config.popup.closeButtonAltText:frosmo.config.popup.closeButtonText;return'<div id="frosmoPopupHeader">'+p+'<a href="#" id="frosmoPopupClose" class="frosmoPopupClose" title="'+q+'">'+frosmo.config.popup.closeButtonText+"</a></div>"},f=function(p){if(typeof p!=="string"){p=""}return'<div id="frosmoPopupContent">'+p+"</div>"},b=function(p){if(typeof p!=="string"){p=""}return'<div id="frosmoPopupFooter">'+p+"</div>"},h=function(p){a=jQuery(p);if(!i){e("Append popup container to the document","frosmo.popup.set()");i=jQuery('<div id="frosmoPopupContainer"></div>');jQuery("body").append(i)}if(!j){e("Append popup background to the document","frosmo.popup.set()");j=jQuery('<div id="frosmoPopupBackground"></div>');jQuery("body").append(j)}e("Appending popup HTML","frosmo.popup.set()");i.html(a)},n=function(t,s,w,x,z){var y=this,p=y.header(s),u=y.content(t),v=y.footer(w),q='<div id="frosmoPopup">'+p+u+v+"</div>",r={closeExisting:false,center:frosmo.config.popup.center,closeOnBgClick:frosmo.config.popup.closeOnBgClick,closeOnEsc:frosmo.config.popup.closeOnEsc};z=jQuery.extend(r,z);if(x){e("Created popup and displaying it","frosmo.popup.create()");if(z.closeExisting&&g()){e("Hide existing popup before replacing it","frosmo.popup.create()");y.hide({hideBackground:false,afterClose:function(){y.set(q);y.show(z)}})}else{y.set(q);y.show(z)}return a}else{e("Created popup and returned HTML","frosmo.popup.create()");return q}};if(!window.frosmo){window.frosmo={}}if(!window.frosmo.config){window.frosmo.config={}}window.frosmo.popup={header:m,content:f,footer:b,create:n,visible:g,center:o,set:h,show:l,hide:c};window.frosmo.config.popup={animationSpeed:200,closeButtonText:"Close",center:false,closeOnBgClick:false,closeOnEsc:false,centerIncludeMargins:false}}());if(!window.frosmo){window.frosmo={}}frosmo.request=(function(){if(frosmo.request){return frosmo.request}var i,b={},d=0,g={},a="function",j=function(m,k,l){if(typeof m===a){if(l){return m.apply(k,l)}else{return m.apply(k)}}else{return false}},h=function(k){window.setTimeout(function(){document.getElementsByTagName("head")[0].appendChild(k)},10)},c=function(l,m){var k=document.createElement("script");if(m){l=l+(/\?/.exec(l)?"&":"?")+m.join("&").replace(/%20/g,"+")}k.setAttribute("type","text/javascript");k.setAttribute("charset","utf-8");k.setAttribute("src",l);k.setAttribute("async",true);return k},e=function(l,k){g[l.id]=function(m){};if(k){k.removeAttribute("src");k.parentNode.removeChild(k)}},f=function(m){var k=this,l;d+=1;l="req"+d;return l};i=function(){this.init.apply(this,arguments)};i.prototype={init:function(k,m){var l;m=(typeof m===a)?{on:{success:m}}:m||{};this.getUrl=function(){return k};this.getCallback=function(){return m}},send:function(){var m=this,r=this.getCallback(),o=this.getUrl(),q="JSONPRequest.send(): ",l,n,p=[],k=function(s,t){p[p.length]=encodeURIComponent(s)+"="+encodeURIComponent(t)};if(!o){frosmo.console.error(q+"No request URL defined, aborting request.");return this}if(!r.on){frosmo.console.error(q+"No callback methods defined, aborting request.");return this}if(!r.on.success){frosmo.console.error(q+"No success handler method defined, aborting request.");return this}r.id=f(r);k("callback","frosmo.request.callbacks."+r.id);if(r.params){for(n in r.params){if(n){k(n,r.params[n])}}}l=c(o,p);g[r.id]=function(s){e(r,l);if(r.timeout){window.clearTimeout(b[r.id])}r.on.success.call(m,s)};if(r.timeout){b[r.id]=window.setTimeout(function(){e(r,l);j(r.on.timeout,m)},r.timeout)}h(l);return this}};return{callbacks:g,create:function(k,l){return new i(k,l)},jsonp:function(k,m){var l=new i(k,m);return l.send.call(l)}}}());frosmo.session=(function(){var p={cookie_name:"frosmo.session",persistent_cookie_id:"frosmo.id",duration:30},g="session.cid",H=null,A,e=null,o=null,m=function(){if(!frosmo.cookies){throw"frosmo.cookies library is not loaded"}var J,K=frosmo.utils.parseDate;if(H===null){J=frosmo.cookies.get(p.cookie_name);if(J&&J!=="null"){H=JSON.parse(J);if(typeof H.loginTime==="string"){H.loginTime=K(H.loginTime)}if(typeof H.startTime==="string"){H.startTime=K(H.startTime)}if(typeof H.lastActivityTime==="string"){H.lastActivityTime=K(H.lastActivityTime)}}}if(H===null){H={}}},C=function(){if(!frosmo.cookies){throw"frosmo.cookies library is not loaded"}frosmo.cookies.set(p.cookie_name,JSON.stringify(H))},r=function(){m();return H.source},u=function(){m();return H.referer},k=function(J){m();H.source=J;if(!H.referer){H.referer=J}C();return this},v=function(){m();return H.loginTime},y=function(J){if(J instanceof Date){m();H.loginTime=J;C()}else{throw"Invalid argument, setLoginTime expects Date object"}return this},q=function(J){J=J||{};if(J.source&&!r()){k(J.source)}if(!v()){y(new Date())}return this},b=function(){m();return H.lastActivityTime},h=function(J){m();H.lastActivityTime=J;C();return this},d=function(){frosmo.console.log("frosmo.session.updateLastActivityTime(): updating last activity time");m();H.lastActivityTime=new Date();C();return this},F=function(){var J=new Date(),K=b();if(K){return J.getTime()-K.getTime()}else{return null}},B=function(){m();return H.startTime},E=function(){m();if(!H.startTime){frosmo.console.log("frosmo.session.setStartTime(): Set session start time");H.startTime=new Date();C()}},G=function(){var J=new Date(),K=B();if(K){return J.getTime()-K.getTime()}else{return null}},l=function(L){var J=2166136261,K;for(K=0;K<L.length;K+=1){J+=(J<<1)+(J<<4)+(J<<7)+(J<<8)+(J<<24);J^=L.charCodeAt(K)}return J&2147483647},t=function(K){var J=new RegExp("\\w+\\.\\w+");if(typeof K==="undefined"){return false}if(K===null||K===""){return false}return J.test(K)},i=function(){if(!frosmo.cookies){frosmo.console.error("frosmo.session.hasPersistentId(): frosmo.cookies library is not loaded");return false}var J=frosmo.cookies.get(p.persistent_cookie_id);if(J===""||J===null){return false}else{return true}},I=function(J){frosmo.cookies.set(p.persistent_cookie_id,J,null,3650)},z=function(){var J=frosmo.cookies.get(p.persistent_cookie_id);if(t(J)){return J}if(frosmo.jstorage){J=frosmo.jstorage.get(g);if(t(J)){I(J);return J}}return null},s=function(){var J=z();if(J===null){return false}else{return true}},c=function(J){if(t(J)){frosmo.console.log("frosmo.session.setPersistentId(): setting persistentId to "+J);I(J);if(frosmo.jstorage){frosmo.jstorage.set(g,J)}}else{frosmo.error.log("frosmo.session.setPersistentId(): invalid persistentId: "+J,frosmo.error.SESSION_INVALID_CID)}},n=function(){var K,J;if(!frosmo.cookies){frosmo.console.error("frosmo.session.getPersistentId(): frosmo.cookies library is not loaded");return null}K=z();if(K===null){J=B();if(typeof J==="undefined"||J===null){frosmo.error.log("frosmo.session.getPersistentId(): session startTime not defined",frosmo.error.SESSION_UNDEFINED_STARTTIME);J=new Date()}K=l(navigator.userAgent).toString(36)+"."+J.getTime().toString(36);c(K)}return K},D=function(){frosmo.console.log("frosmo.session.js -- Reset persistent cookie");I(null);if(frosmo.jstorage){frosmo.jstorage.set(g,"")}},j=function(K){var L=new RegExp("https?://((?:[\\w\\-]+)(?:\\.[\\w\\-]+)*)/?"),J=L.exec(K);if(J){return J[1]}else{return null}},w=function(K){var L=new RegExp("[\\w\\-]+\\.[\\w\\-]+$"),J=L.exec(K);if(J){return J[0]}else{return null}},a=function(K){var J=new RegExp("\\d+\\.\\d+");if(J.test(K)){return false}return true},f=function(N){frosmo.console.log("frosmo.session.detectSource(): Detecting user source.");if(r()){frosmo.console.log("frosmo.session.detectSource(): Old source present, don't overwrite");return}var P,O,K,J,M,L;if(N){if(typeof N==="string"){frosmo.console.log("frosmo.session.detectSource(): Source supplied, using "+N);k(N);return}else{if(typeof N==="function"){frosmo.console.log("frosmo.session.detectSource(): Getting source from custom function");P=N.call(window);if(P){frosmo.console.log('frosmo.session.detectSource(): Custom function returned "'+P+'", setting source');k(P);return}else{frosmo.console.log("frosmo.session.detectSource(): Custom function returned empty value, autodetecting")}}}}if(frosmo.utils){O=frosmo.utils.getUrlParams();if(O.fssrc){frosmo.console.log('frosmo.session.detectSource(): Using url param "fssrc", setting source to "'+O.fssrc+'"');k(O.fssrc);return}}J=(e!==null?e:document.referrer);L=(o!==null?o:document.location.hostname);if(J){frosmo.console.log("frosmo.session.detectSource(): Checking if referrer is different from current domain.");K=(function(){var Q=j(J),R;if(Q){R=w(Q);if(R){return R}}return null}());M=(function(){var Q=w(L);if(Q){return Q}return null}());if(M&&K&&M!==K){if(a(K)){N=K;if(K.indexOf("google.")===0){N="google"}else{if(K==="facebook.com"){N="fb"}}frosmo.console.log('frosmo.session.detectSource(): Setting source based on referrer to "'+N+'"');k(N);return}}frosmo.console.log('frosmo.session.detectSource(): Ambigous referrer, setting source to "direct"');k("direct")}else{frosmo.console.log('frosmo.session.detectSource(): No referrer, setting source to "direct"');k("direct")}},x=function(L){frosmo.console.log("frosmo.session: Initializing...");if(typeof frosmo.cookies==="undefined"){throw new Error("frosmo.cookies.js not loaded (required by frosmo.session.js)")}if(typeof frosmo.event==="undefined"){throw new Error("frosmo.event.js not loaded (required by frosmo.session.js)")}if(typeof frosmo.jstorage==="undefined"){throw new Error("frosmo.jstorage.js not loaded (required by frosmo.session.js)")}frosmo.console.log("frosmo.session.init(): init");var J=F(),K;E();if(s()){if(J===null){frosmo.console.log("frosmo.session.init(): New session, acquiring source.");k(null);f(L);frosmo.event.returningVisitor(r())}else{if(J>p.duration*60*1000){frosmo.console.log("frosmo.session.init(): User inactive over "+p.duration+"min, acquiring source.");k(null);f(L);frosmo.event.returningVisitor(r())}else{frosmo.console.log("frosmo.session.init(): user has not been inactive over "+p.duration+"min, inactivityTime:"+J)}}}else{K=n();if(K){frosmo.console.log("frosmo.session.init(): Create and send new persistentId to Optimizer API");f(L);frosmo.event.newVisitor(r(),u())}else{frosmo.error.log("frosmo.session.init(): Failed to create new persistentId")}}d()};if(window.frosmo.test){window.frosmo.test.session={configuration:p,setStartTime:function(J){m();H.startTime=J;C()},setReferrer:function(J){e=J},setHostname:function(J){o=J},reset:function(){if(!frosmo.cookies){frosmo.console.error("frosmo.cookies.js not loaded")}H=null;frosmo.cookies.set(p.cookie_name,null);D()}}}A={init:x,login:q,getSource:r,getReferer:u,setSource:k,getDuration:G,getStartTime:B,setLoginTime:y,getLoginTime:v,hasPersistentId:i,getPersistentId:n,resetPersistentId:D,setPersistentId:c,update:d,setLastActivityTime:h};if(window.frosmo.test){A.getHostnameFromUrl=j;A.getDomainFromHostname=w;A.detectSource=f;A.isValidDomain=a}return A}());frosmo.utils=(function(){var e=this,i=e.jQuery,g={},h=/(\d\d\d\d)-(\d\d)-(\d\d)/,f=/(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+\-])(\d\d)(:)?(\d\d))/,b=function(j){return window.unescape(j)},c=function(k){try{return window.decodeURIComponent(k)}catch(j){return k}},d=function(j){return j!==j},a=function(l){var j=new Date(),k;k=l.match(new RegExp(h));j.setUTCDate(1);j.setUTCFullYear(parseInt(k[1],10));j.setUTCMonth(parseInt(k[2],10)-1);j.setUTCDate(parseInt(k[3],10));j.setUTCHours(0);j.setUTCMinutes(0);j.setUTCSeconds(0);j.setUTCMilliseconds(0);return j};g.isDate=function(j){if(j.toString().match(new RegExp(h))){return true}else{return false}};g.isISO8601Date=function(j){if(j.toString().match(new RegExp(f))){return true}else{return false}};g.parseISO8601Date=function(m){var j=new Date(),l,k;l=m.match(new RegExp(f));k=0;j.setUTCDate(1);j.setUTCFullYear(parseInt(l[1],10));j.setUTCMonth(parseInt(l[3],10)-1);j.setUTCDate(parseInt(l[5],10));j.setUTCHours(parseInt(l[7],10));j.setUTCMinutes(parseInt(l[9],10));j.setUTCSeconds(parseInt(l[11],10));if(l[12]){j.setUTCMilliseconds(parseFloat(l[12])*1000)}else{j.setUTCMilliseconds(0)}if(l[13]!=="Z"){k=(l[15]*60)+parseInt(l[17],10);k*=((l[14]==="-")?-1:1);j.setTime(j.getTime()-k*60*1000)}return j};g.parseDate=function(k){var j;if(k instanceof Date){return k}j=new Date(k);if(d(j.getDate())){if(g.isISO8601Date(k)){return g.parseISO8601Date(k)}else{if(g.isDate(k)){return a(k)}else{return null}}}else{return j}};g.formatDate=function(k){k=g.parseDate(k);if(k===null){return null}var l=k.getFullYear(),m=k.getMonth(),j=k.getDate();if(m<10){m="0"+m}if(j<10){j="0"+j}return l+"-"+m+"-"+j};g.formatTime=function(l){l=g.parseDate(l);if(l===null){return null}var j=l.getHours(),m=l.getMinutes(),k=l.getSeconds();if(j<10){j="0"+j}if(m<10){m="0"+m}if(k<10){k="0"+k}return j+":"+m+":"+k};g.formatDatetime=function(j){j=g.parseDate(j);if(j===null){return null}return g.formatDate(j)+" "+g.formatTime(j)};g.getUrlPaths=function(l){var j,k=l||frosmo.site.config.pathname||window.location.pathname;if(typeof k!=="string"){return null}if(k.match(/^\/$/)){return["","home"]}j=k.split("/");return j};g.getUrlParams=function(k){var m=window.location.search.replace(/^\?/,""),n,j={},l,o,q,p;p=function(r){var u=r.split("="),s,t;s=u[0];t=c(u[1]);t=b(t);if(s.indexOf("[]")!==-1){s=s.replace("[]","");if(!j[s]){j[s]=[]}j[s].push(t)}else{j[s]=decodeURIComponent(t)}};if(k){q=k.indexOf("?");if(q!==-1){m=k.substring(q+1)}else{m=null}}if(m){n=m.split("&");for(l in n){if(typeof(n[l])==="string"){p(n[l])}}}return j};g.getUrlParam=function(k,j){var l=g.getUrlParams(j);if(g.keyExists(k,l)){return l[k]}return null};g.getUrlPath=function(j){var k=window.location.pathname;return k.split("/")};g.extend=function(){var l=arguments[0]||{},k=arguments[1]||{},j;for(j in k){if(k.hasOwnProperty(j)){l[j]=k[j]}}return l};g.each=function(k,p,o){var n,j,m;if(typeof k==="undefined"||k===null){return}if(Array.prototype.forEach&&k.forEach===Array.prototype.forEach){k.forEach(p,o)}else{if(k.length===+k.length){for(n=0,j=k.length;n<j;n+=1){if(n in k){p.call(o,k[n],n,k)}}}else{for(m in k){if(Object.prototype.hasOwnProperty.call(k,m)){p.call(o,k[m],m,k)}}}}};g.contains=function(o,n){var m=false,k,j;if(g.isArray(o)){if(Array.prototype.indexOf){return Array.prototype.indexOf.call(o,n)!==-1}for(k=0,j=o.length;k<j;k+=1){if(o[k]===n){return true}}}else{g.each(o,function(l){if(l===n){m=true}})}return m};g.isArray=Array.isArray||function(j){return(Object.prototype.toString.call(j)==="[object Array]")};g.isFunction=function(j){if(typeof j==="function"){return true}else{return false}};g.isRegExp=function(j){return typeof j==="object"&&Object.prototype.toString.call(j)==="[object RegExp]"};g.callIfDefined=function(l,j,k){if(g.isFunction(l)){if(k){return l.apply(j,k)}else{return l.apply(j)}}else{return false}};g.keyExists=function(k,j){if(typeof j!=="object"){return false}if(Object.prototype.hasOwnProperty.call(j,k)){return true}return false};g.objectKeys=Object.keys||function(k){var l=[],j;if(typeof k!=="object"){throw new TypeError("Invalid object")}for(j in k){if(Object.prototype.hasOwnProperty.call(k,j)){l.push(j)}}return l};g.clone=function(k){if(typeof k!=="object"){return k}var j=this.isArray(k)?[]:{},l;for(l in k){if(k.hasOwnProperty(l)){if(k[l]&&typeof k[l]==="object"){j[l]=g.clone(k[l])}else{j[l]=k[l]}}}return j};g.inArray=function(n,m){if(!m||!this.isArray(m)){frosmo.console.error("frosmo.utils.inArray() -- given argument is not an array!");return false}var k,j;for(k=0,j=m.length;k<j;k=k+1){if(m[k]===n){return true}}return false};g.domReady=function(m){var k,j,n,l=false,p;if(document.readyState==="complete"){return setTimeout(m,1)}p=function(){if(!n){n=true;m()}};j=function(){if(n){return}try{document.documentElement.doScroll("left")}catch(q){setTimeout(j,1);return}p()};if(window.jQuery){i(document).ready(m)}else{if(document.addEventListener){k=function(){document.removeEventListener("DOMContentLoaded",k,false);p()};document.addEventListener("DOMContentLoaded",k,false);window.addEventListener("load",p,false)}else{if(document.attachEvent){k=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",k);p()}};document.attachEvent("onreadystatechange",k);window.attachEvent("onload",p);try{l=window.frameElement==null}catch(o){}if(document.documentElement.doScroll&&l){j()}}}}};return g}());frosmo.validator=(function(){var e={user:{userId:["string",32],country:["string",4],language:["string",5],gender:["string",1],email:["string",96],dob:["date",null],source:["string",32],city:["string",16],displayname:["string",20],firstname:["string",16],lastname:["string",16],facebookId:["integer",Math.pow(2,64)-1],linkedinId:["string",10],registrationTime:["datetime",null]},product:{productId:["string",128],productType:["string",32],productName:["string",64],productUrn:["string",32],productCategory:["string",32],productCampaign:["string",32],productArea:["string",32],productCountry:["string",32],productCity:["string",32],productVenue:["string",64],productCompany:["string",32],productManufacturer:["string",32],productModel:["string",32],productSubCategory:["string",32]},segment:{family:["list",["other","family"]],travelType:["list",["flex","charter"]],season:["list",["summer","winter"]]},customUserData:{teamCount:["integer",32767],accountBalance:["decimal",null],tradesLeft:["integer",32767]},apiParameters:{segmentName:["regexp",new RegExp("[a-z][a-zA-Z]{0,63}")],segmentValue:["regexp",new RegExp("[a-zA-Z][a-zA-Z0-9]{0,63}")]}},j=function(l,m){for(var k=0;k<m.length;k+=1){if(m[k]===l){return true}}return false},f=function(l,k){l=l.toString();if(l.length>k){return{value:l.substr(0,k),warning:"too long"}}else{return{value:l,warning:false}}},h=function(m,l){m=m.toString();var k=m.match(l);if(k){return{value:k[0],warning:false}}else{return null}},c=function(l,k){l=parseFloat(l.toString());if(isNaN(l)){return null}else{return{value:l,warning:false}}},g=function(l,k){l=parseInt(l.toString(),10);if(isNaN(l)){return null}else{return{value:l,warning:false}}},i=function(m,l){m=m.toString();var k=m.match(/(19|20)\d{2}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])/);if(k){return{value:k[0],warning:false}}else{return null}},a=function(m,l){m=m.toString();var k=m.match(/(19|20)\d{2}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1]) (0\d|1\d|2[0-3]):(0\d|[1-5]\d):(0\d|[1-5]\d)/);if(k){return{value:k[0],warning:false}}else{return null}},b=function(l,k){l=l.toString();if(!j(l,k)){return null}else{return{value:l,warning:false}}},d=function(n,l,p){var o=n[l],m,k;if(o===undefined){frosmo.console.error("Invalid attribute name: '"+l+"'");return null}if(p===null){frosmo.console.error("attribute value can't be null ("+l+")");return null}m=o[0];k=o[1];switch(m){case"string":return f(p,k);case"decimal":return c(p,k);case"integer":return g(p,k);case"date":return i(p,k);case"datetime":return a(p,k);case"list":return b(p,k);case"regexp":return h(p,k)}};return{validateProductAttribute:function(k,l){return d(e.product,k,l)},validateSegmentAttribute:function(l,n){var k,m;if(l in e.segment){return d(e.segment,l,n)}else{k=d(e.apiParameters,"segmentName",l);if(k===null||k.warning){frosmo.console.error("Segment name validation failed");return null}k=d(e.apiParameters,"segmentValue",n);if(k===null||k.warning){frosmo.console.error("Segment name validation failed");return null}m=frosmo.segment.getValidationDefinition();return d(m,l,n)}},validateUserAttribute:function(k,l){return d(e.user,k,l)},validateApiParameter:function(k,l){return d(e.apiParameters,k,l)},testGetDictionary:function(){return e}}}());frosmo.user=(function(){var j,q=["family","travelType","season"],a="userData",n={id:null,country:null,gender:null,dob:null,city:null,email:null,displayname:null,firstname:null,lastname:null,facebookId:null,linkedinId:null,loginId:null,language:null,registrationTime:null},i=function(s){if(!n.hasOwnProperty(s)){return false}if(typeof n[s]==="undefined"){return false}return true},c=function(s){return"segment"+s.charAt(0).toUpperCase()+s.slice(1)},f=function(t,u){t=c(t);var s=frosmo.jstorage.get("segments",{});s[t]=u;frosmo.jstorage.set("segments",s)},o=false,g=function(){var s;if(o){return n}else{s=frosmo.jstorage.get(a,{});frosmo.utils.each(s,function(u,t){if(t==="source"){return}if(i(t)){n[t]=u}else{frosmo.console.error("trying to set unknown user data from jstorage: "+t+"="+u)}});o=true;return n}},b=function(){var s=g();return s.id},r=function(x){var w=frosmo.jstorage.get("userIdRelations",[]),u,s,t,v;for(u=0,s=w.length;u<s;u=u+1){t=w[u];v=t.facebookId?t.facebookId.toString():null;if(t.id===x||v===x||t.loginId===x){return t.id}}return null},p=function(v){var s=g(),t,u;u=s.facebookId?s.facebookId.toString():null;if(u&&u===v){return s.id}if(s.loginId===v){return s.id}t=r(v);return t||s.id||v},h=function(s){var y=frosmo.jstorage.get("userIdRelations",[]),w,u,x,v,t=false;for(w=0,u=y.length;w<u;w=w+1){v=y[w];x=v.facebookId?v.facebookId.toString():null;if(v.id===s.id||x===s.id||v.loginId===s.id){y[w]=s;t=true}}if(!t){y.push(s)}frosmo.jstorage.set("userIdRelations",y)},e=function(s){frosmo.jstorage.set(a,s);h(s);n=s;o=true;return n},k=function(s,t){if(s==="id"||s==="loginId"){s="userId"}return frosmo.validator.validateUserAttribute(s,t)},d=function(u){var t,s=frosmo.utils.clone(u);delete s.loginId;delete s.id;if(frosmo.config.user.anonymize){delete s.displayname;delete s.firstname;delete s.lastname;delete s.email;if(s.dob){s.dob=s.dob.replace(/-\d{2}/g,"-01")}}frosmo.utils.each(s,function(w,v){if(w===null){delete s[v]}});s.source=frosmo.session?frosmo.session.getSource():null;frosmo.api.setUserData(u.id,s)},l=function(w,t,y){var v=frosmo.utils.clone(n),x,u,s;x=k("userId",w);if(x){v.id=p(x.value)||x.value}frosmo.console.log("user.id from auth:"+p(x.value));s=frosmo.utils.clone(t);if(typeof s.id!=="undefined"){delete s.id}frosmo.utils.each(s,function(A,z){if(i(z)){x=k(z,A);if(x){v[z]=x.value}}else{frosmo.console.error("trying to set unknown user data: "+z+"="+A)}});if(v.id){d(v)}return e(v)},m=function(){var s={};frosmo.utils.each(frosmo.utils.objectKeys(n),function(t){s[t]=null});frosmo.jstorage.set(a,s);n=s;return n};j={setSegment:f,deleteSegment:function(t){var u=c(t),s=frosmo.jstorage.get("segments",{});delete s[u];frosmo.jstorage.set("segments",s);if(frosmo.utils.contains(q,t)){frosmo.api.clearCustomAttribute(b(),t)}else{frosmo.api.clearUserSegment(b(),t)}},setSegments:function(t){var u,v,s={},w=false;for(u in t){if(t.hasOwnProperty(u)){v=t[u];f(u,v);if(frosmo.utils.contains(q,u)){s[u]=v;w=true}else{frosmo.api.setUserSegment(b(),u,v)}}}if(w){frosmo.api.setCustomUserData(b(),s)}},setState:function(t,v){var s=frosmo.jstorage.get("states",{}),u=function(w){return"state"+w.charAt(0).toUpperCase()+w.slice(1)};t=u(t);s[t]=v;frosmo.jstorage.set("states",s)},getSegments:function(){return frosmo.jstorage.get("segments",{})},getStates:function(){return frosmo.jstorage.get("states",{})},setUserData:l,getUserData:g,getUserId:b,deleteUserData:m,getUserIdWithAuthId:p};if(window.frosmo.test){j.reset=function(){m();frosmo.jstorage.set(a,{});o=false};j.saveUserData=e;j.saveUserIdRelations=h;j.getUserIdFromRelations=r}return j}());frosmo.contextIdentifier=(function(){var m={separator:"|"},b=function(n,o){if(o){frosmo.console.log(o+": "+n)}else{frosmo.console.log("frosmo.contextIdentifier: "+n)}},g=function(n,o){if(o){frosmo.console.error(o+": "+n)}else{frosmo.console.error("frosmo.contextIdentifier: "+n)}},e=function(n){if(frosmo.utils.isRegExp(n)){return"regexp"}else{if(frosmo.utils.isArray(n)){return"array"}else{if(typeof n==="object"){return"object"}else{if(typeof n==="string"){return"string"}}}}g("unknown param type!"+typeof n);return null},d={context:{path:function(p){var o=window.location.pathname,n;n=function(t,u){var q=false,y,x,w,z,v,s=[],r=0;switch(e(t)){case"string":return u===t?u:null;case"regexp":return t.test(u)?u||true:null;case"array":for(w=0;w<t.length;w=w+1){z=n(t[w],u);if(z){return z}}return null;case"object":y=frosmo.utils.getUrlPath(t);y.shift();x=y.length;for(w in t){if(t.hasOwnProperty(w)){r=r+1;v=w;if(w==="first"){v=0}else{if(w==="last"){v=x-1}}if(t[w]===true||t[w]===null){q=y[v]||null}else{if(t[w]===false){q=y[v]?null:true}else{q=n(t[w],y[v])}}if(q){s.push(q)}q=false}}if(s.length>0&&s.length===r){return s}return null;default:g("path param type not supported: "+typeof t);return null}};return n(p,o)},urlParam:function(r){var o=frosmo.utils.getUrlParams(),p,q,n;n=function(x,s){var v,u,t,w=false;switch(e(x)){case"string":if(typeof s==="object"){return s[x]||null}return s===x;case"regexp":return x.test(s)?s:null;case"array":for(v=0;v<x.length;v=v+1){q=n(x[v],s);if(q){return q}}return null;case"object":u=[];t=0;for(v in x){if(x.hasOwnProperty(v)){t=t+1;if(x[v]===true){w=s[v]?s[v]:null}else{if(x[v]===false){w=typeof(s[v])!=="undefined"?null:true}else{if(s[v]){w=n(x[v],s[v])}}}if(w){u.push(w)}w=false}}if(u.length>0&&u.length===t){return u}return null;default:g("urlParam param type not supported: "+typeof x);return null}};return n(r,o)||null},hash:function(q){var p=window.location.hash,o=q.length-1,n;if(p.length>0){p=p.substring(1)}n=function(t){var r,s;switch(e(t)){case"string":return(t===p)?p:null;case"regexp":return t.test(p)?(p||true):null;case"array":for(r=0;r<t.length;r=r+1){s=n(t[r]);if(s){return s}}return null;case"object":g("hash param can not be Object!");return null;default:g("path param type not supported: "+typeof t);return null}};return n(q)||null},jquery:function(p){var n,o;if(!window.jQuery){g("jQuery is not loaded. Can not match jquery param!");return null}o=function(w,r){var u,q,t=[],s=0,v=false;switch(e(w)){case"string":if(r&&jQuery(r).length>0){return jQuery.trim(jQuery(r).text())===w||null}return(jQuery(w).length>0)?(jQuery.trim(jQuery(w).text())||true):null;case"regexp":g("jquery param can not be Regular Expression!");return null;case"array":for(u=0;u<w.length;u=u+1){v=o(w[u]);if(v){return v}}return null;case"object":if(typeof w.html==="function"){return(w.length>0)?(jQuery.trim(w.text())||true):null}else{for(q in w){if(w.hasOwnProperty(q)){s=s+1;if(w[q]===true){v=(jQuery(q).length>0)?(jQuery.trim(jQuery(q).text())||true):null}else{if(w[q]===false){v=(jQuery(q).length===0)?true:null}else{v=o(w[q],q)}}if(v){t.push(v)}v=false}}if(t.length>0&&t.length===s){return t}return null}return null;default:g("jquery param type not supported: "+typeof w);return null}};return o(p)||null},meta:function(p){var r=document.getElementsByTagName("meta"),q,o,n;n=function(y,w,x){var v,u=[],t,s;switch(e(y)){case"string":if(!x){x=y.match(/^og/)?"property":"name"}for(q=0;q<w.length;q=q+1){if(w[q][x]===y){return w[q].content}}return null;case"regexp":for(q=0;q<w.length;q=q+1){if(x){if(y.test(w[q][x])){return w[q].content}}else{if(y.test(w[q].name)||y.test(w[q].property)){return w[q].content}}}return null;case"array":for(q=0;q<y.length;q=q+1){v=n(y[q],w,x);if(v){return v}}return null;case"object":u=[];t=0;for(s in y){if(y.hasOwnProperty(s)){t=t+1;x=s.match(/^og/)?"property":"name";for(o=0;o<w.length;o=o+1){if(w[o].getAttribute(x)===s){v=n(y[s],[w[o]],"content");if(v){u.push(v)}}}}}if(u.length>0&&u.length===t){return u}return null;default:g("path param type not supported: "+typeof y);return null}return null};return n(p,r)||null}}},i=function(o,p){var n,q;if(!p.identifier){g("no context identifier for context "+o);return null}n=p.identifier;q=function(r){var x,v,u,t,w,s;if(frosmo.utils.isArray(r)){for(v=0;v<r.length;v=v+1){s=q(r[v]);if(s){return s}}return false}else{if(typeof r==="object"){u=0;t=0;for(x in r){if(r.hasOwnProperty(x)){w=r[x];if(!d.context[x]){g("invalid identifier: "+x);continue}u=u+1;if(d.context[x](w)){t=t+1}}}if(t>0&&u===t){return true}return false}else{g("invalid identifier type: "+typeof r);return false}}};return q(n)||false},j=function(n){return n.shift()},k=function(q){var n,p={},o=[];for(n in q){if(i(n,q[n])){p=q[n];p.name=n;o.push(p)}}if(o.length>0){return j(o)}return null},c=function(n){var o,q=m.separator||"|",p=m.decorateLowerCase||false;o=function(r){var v,t,u,s=[];if(typeof r==="string"){return r}else{if(frosmo.utils.isArray(r)){for(u=0;u<r.length;u=u+1){t=o(u);if(t){return t}}}else{if(typeof r==="object"){for(v in r){if(r.hasOwnProperty(v)){t=r[v];if(v==="text"){s.push(t);continue}if(!d.context[v]){g("invalid identifier: "+v);continue}t=d.context[v](t);if(t){s.push(t)}}}frosmo.utils.each(s,function(y,w,x){if(frosmo.utils.isArray(y)){x[w]=y.join(q)}});if(s.length>0){if(p){return s.join(q).toLowerCase()}return s.join(q)}}}}};return o(n)},a=function(o){if(!o.product){return}var q=o.product,r={},n,p;for(n in q){if(q.hasOwnProperty(n)){q[n]=c(q[n])}}frosmo.pageContext.setProductAttributes(q)},f=function(t){if(!t.events){return}var s=t.events,q,o,n,u,r,p;o=function(w,v){if(typeof w!=="function"){g("Event must be function!");return}w(v)};for(p in s){if(s.hasOwnProperty(p)){n=s[p];if(frosmo.event[p]){u=frosmo.event[p]}else{if(frosmo.site.event&&frosmo.site.event[p]){u=frosmo.site.event[p]}else{g("invalid event called! No event found: "+p);continue}}if(frosmo.utils.isArray(n)){for(r=0;r<n.length;r=r+1){o(u,n[r])}}else{if(typeof n==="object"){o(u,n)}else{g("tried to call event with invalid options type:"+typeof n);continue}}}}},h=function(n){var o;o=n.path?n.path:n.name;frosmo.console.log("setting path:"+o);frosmo.pageContext.setPath(o)},l=function(p,o){var n;if(o){frosmo.utils.extend(m,o)}p=p||frosmo.site.contexts;if(!p){g("no contexts defined!")}n=k(p);if(n){b("found context: "+n.name);h(n);a(n);f(n)}else{b("no context")}return n};return{init:l,getContext:k,handleProductData:a}}());frosmo.product=(function(){var e={version:"0.2"},k={},g=null,d={},h={api:null,origin:null,productCache:true,sessionStorage:false},a=function(){try{return !!sessionStorage.getItem}catch(l){return false}},f,c,b,j=function(l){return(l.substring(0,7)==="product")},i;i=function(m,l){this.id=null;this.attributes={};this.updated=null;this.setId(m);this.setAttributes(l)};i.prototype={setId:function(n){var l=n.toString(),m=frosmo.validator.validateProductAttribute("productId",l);if(m){this.id=l}else{frosmo.console.log("Invalid productId: "+n)}},setAttributes:function(m){var l=this,s=frosmo.validator.validateProductAttribute,q,n,o,p,r;for(n in m){if(m.hasOwnProperty(n)){q=m[n];if(j(n)){p=n;o=n.charAt(7).toLowerCase()+n.slice(8)}else{p="product"+n.charAt(0).toUpperCase()+n.slice(1);o=n}if(q===null){l.attributes[o]=null}else{r=s(p,q);if(r){if(r.warning){frosmo.console.log("Product attribute '"+n+"' validation failed: value '"+q+"' "+r.warning)}l.attributes[o]=r.value}else{frosmo.console.log("Product attribute '"+n+"' validation failed: value '"+q+"' is not valid")}}}}},getAttributes:function(){var m,n,l={};for(m in this.attributes){if(this.attributes.hasOwnProperty(m)){n="product"+m.charAt(0).toUpperCase()+m.slice(1);l[n]=this.attributes[m]}}return l},getAttribute:function(l){if(l in this.attributes){return this.attributes[l]}else{return null}}};f=function(){if(d.sessionStorage){try{g=JSON.parse(sessionStorage.getItem("frosmo.products"))||{}}catch(l){g={}}}else{g={}}};c=function(){if(d.sessionStorage){try{sessionStorage.setItem("frosmo.products",JSON.stringify(g))}catch(l){return}}};b=function(n,m){var l=this;if(!d.api){m.error.call(l,"API configuration missing");return}if(!d.origin){m.error.call(l,"Site origin missing");return}if(typeof d.api==="function"){m.success.call(l,d.api.call(l,{origin:d.origin,productId:n,version:e.version}))}else{frosmo.request.jsonp(d.api,{params:{origin:d.origin,productId:n,version:e.version},on:{success:function(o){if(typeof o==="object"){if(o.error){m.error.call(l,o.error)}else{m.success.call(l,o)}}else{m.error.call(l,"Invalid response")}},timeout:function(){m.error.call(l,"Request timed out")}}})}};e.reset=function(){d=h;k={};g={};try{sessionStorage.removeItem("frosmo.products")}catch(l){}};e.init=function(l){if(typeof l!=="object"){throw new Error("Argument must be valid object")}frosmo.utils.extend(d,h);frosmo.utils.extend(d,l);if(d.sessionStorage){frosmo.console.log("Session storage enabled")}else{frosmo.console.log("Session storage disabled")}if(d.productCache){frosmo.console.log("Product cache enabled");f()}else{frosmo.console.log("Product cache disabled")}};e.fetch=function(n,m){var l=this,o=e.get(n);m=m||{};if(o===null){b(n,{success:function(r){var q,p={};if(r.hasOwnProperty("productId")){delete r.productId}if(r.hasOwnProperty("version")){delete r.version}if(r.productAttributes){p=r.productAttributes;delete r.productAttributes}if(r.productName){p.name=r.productName;delete r.productName}if(r.productType){p.type=r.productType;delete r.productType}for(q in r){if(r.hasOwnProperty(q)){frosmo.console.log("Unknown attribute in product data response: "+q)}}o=new i(n,p);o.updated=new Date();if(o instanceof i){e.add(o);if(m.success){m.success.call(l,o)}}else{if(m.error){m.error.call(l,"Failed to create new product")}}},error:function(p){frosmo.console.error(p);if(m.error){m.error.call(l,p)}}})}else{if(typeof m.success==="function"){m.success.call(l,o)}}};e.get=function(l){var m;if(l in k&&k.hasOwnProperty(l)){return k[l]}else{if(d.productCache&&g){if(l in g&&k.hasOwnProperty(l)){m=new i(l,g[l]);if(m instanceof i){k[l]=m;return m}}}return null}};e.add=function(m){var l=m.id;if(l){k[l]=m;if(d.productCache&&g){g[l]=m.attributes;c()}return true}else{throw new Error("Product ID missing")}};e.create=function(m,l){var n=new i(m,l);if(n.id){k[n.id]=n;return n}else{throw new Error("Product ID missing or not valid")}};e.save=function(l){if(l instanceof i){frosmo.console.log("Save product data for productId "+l.id);frosmo.api.setProductData(l.id,l.getAttributes());l.updated=new Date()}};e.push=function(){var l,m;for(l in k){if(k.hasOwnProperty(l)){m=k[l];if(m.updated===null){e.save(m)}}}};h.sessionStorage=a();frosmo.Product=i;return e}());frosmo.segment=(function(){var c=this,f=c.frosmo,b=f.utils,a,e={},d={};d.reset=function(){e={}};d.init=function(g){g=g||{};if(g.definition){b.each(g.definition,function(h,i){d.addDefinition(i,h)})}};d.addDefinition=function(h,g){if(b.isArray(g)){e[h]=g}else{e[h]=b.objectKeys(g)}};d.getDefinition=function(g){if(g in e){return e[g]}else{return null}};d.getSupportedSegments=function(){return b.objectKeys(e)};d.isSupportedSegment=function(g){if(d.getDefinition(g)===null){return false}else{return true}};d.validate=function(g,h){if(g in e){if(h===null){return"null value for segment '"+g+"' is not allowed"}if(!b.contains(e[g],h)){return"segment '"+g+"' value '"+h+"' not supported"}}else{return"segment '"+g+"' not defined"}};d.getValidationDefinition=function(){var g={};b.each(e,function(h,i){g[i]=["list",h]});return g};d.getSegment=function(h){var g,i;if(!d.isSupportedSegment(h)){throw new Error("Unsupported segment: "+h)}i="segment"+h.charAt(0).toUpperCase()+h.slice(1);g=f.user.getSegments();if(b.keyExists(i,g)){return g[i]}else{return null}};d.setSegment=function(i,g){var j={},h;h=d.validate(i,g);if(h){f.console.error("Validation error: "+h);return false}j[i]=g;f.console.log("setting segment: "+i+": "+g);f.user.setSegments(j)};d.get=d.getSegment;d.set=d.setSegment;return d}());(function(f){if(!f||!(f.toJSON||Object.toJSON||window.JSON)){throw new Error("jQuery, MooTools or Prototype needs to be loaded before jStorage!")}var g={},d={__frosmo:"{}"},h=null,j=0,l=f.toJSON||Object.toJSON||(window.JSON&&(JSON.encode||JSON.stringify)),e=f.evalJSON||(window.JSON&&(JSON.decode||JSON.parse))||function(m){return String(m).evalJSON()},i=false;_XMLService={isXML:function(n){var m=(n?n.ownerDocument||n:0).documentElement;return m?m.nodeName!=="HTML":false},encode:function(n){if(!this.isXML(n)){return false}try{return new XMLSerializer().serializeToString(n)}catch(m){try{return n.xml}catch(o){}}return false},decode:function(n){var m=("DOMParser" in window&&(new DOMParser()).parseFromString)||(window.ActiveXObject&&function(p){var q=new ActiveXObject("Microsoft.XMLDOM");q.async="false";q.loadXML(p);return q}),o;if(!m){return false}o=m.call("DOMParser" in window&&(new DOMParser())||window,n,"text/xml");return this.isXML(o)?o:false}};function k(){if("localStorage" in window){try{if(window.localStorage){d=window.localStorage;i="localStorage"}}catch(p){}}else{if("globalStorage" in window){try{if(window.globalStorage){d=window.globalStorage[window.location.hostname];i="globalStorage"}}catch(o){}}else{h=document.createElement("link");if(h.addBehavior){h.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(h);h.load("__frosmo");var n="{}";try{n=h.getAttribute("__frosmo")}catch(m){}d.__frosmo=n;i="userDataBehavior"}else{h=null;return}}}b()}function b(){if(d.__frosmo){try{g=e(String(d.__frosmo))}catch(m){d.__frosmo="{}"}}else{d.__frosmo="{}"}j=d.__frosmo?String(d.__frosmo).length:0}function c(){try{d.__frosmo=l(g);if(h){h.setAttribute("__frosmo",d.__frosmo);h.save("__frosmo")}j=d.__frosmo?String(d.__frosmo).length:0}catch(m){}}function a(m){if(!m||(typeof m!="string"&&typeof m!="number")){throw new TypeError("Key name must be string or numeric")}return true}frosmo.jstorage={version:"0.1.5.0",set:function(m,n){a(m);if(_XMLService.isXML(n)){n={_is_xml:true,xml:_XMLService.encode(n)}}g[m]=n;c();return n},get:function(m,n){a(m);if(m in g){if(typeof g[m]=="object"&&g[m]._is_xml&&g[m]._is_xml){return _XMLService.decode(g[m].xml)}else{return g[m]}}return typeof(n)=="undefined"?null:n},deleteKey:function(m){a(m);if(m in g){delete g[m];c();return true}return false},flush:function(){g={};c();try{window.localStorage.clear()}catch(m){}return true},storageObj:function(){function m(){}m.prototype=g;return new m()},index:function(){var m=[],n;for(n in g){if(g.hasOwnProperty(n)){m.push(n)}}return m},storageSize:function(){return j},currentBackend:function(){return i},storageAvailable:function(){return !!i},reInit:function(){var m,o;if(h&&h.addBehavior){m=document.createElement("link");h.parentNode.replaceChild(m,h);h=m;h.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(h);h.load("__frosmo");o="{}";try{o=h.getAttribute("__frosmo")}catch(n){}d.__frosmo=o;i="userDataBehavior"}b()}};k()})(window.jQuery||window.$);(function(){var a={origin:"frosmocom",domain:"frosmo.com",apiRpc:"http://optimizer.frosmo.com/optimizerApi?",messageRpc:"http://optimizer.frosmo.com/messageApi",popup:{closeButtonText:"X"},css:"http://optimizer.s3.amazonaws.com/frosmocom/frosmo.frosmocom.css"};window.frosmo.site.config=a}());frosmo.site.auth=(function(){var a=function(){};return{init:a}}());if(!frosmo.site.event){frosmo.site.event={}}frosmo.site.event.setSegment=function(){var a=arguments[0]||{};if(!a||!a.type||!a.segment){frosmo.console.error("Required option(s) missing!")}frosmo.segment.counter.addSegmentCounter(a.segment,a.type)};frosmo.site.event.handleFormSubmit=function(){var a=jQuery("iframe#reservationframe").contents().find("form#form1");a.submit(function(d){var c=a.find("select#iFrameSearchFormUC_Children").val(),f=a.find("select#iFrameSearchFormUC_Infants").val(),b=false;if(parseInt(c,10)>0||parseInt(f,10)>0){frosmo.segment.counter.addSegmentCounter("family","ageGroup",1)}})};frosmo.site.event.handleCreditsFormSubmit=function(){var a=jQuery("iframe").eq(1).contents().find("form#form1");if(a.length===0){frosmo.console.error("Form not found!")}a.submit(function(c){var b=jQuery(this).find("input#iFrameSearchFormUC_ucOptionalUserInput_txtOptionalUserInput").val();frosmo.console.log("value:"+b);if(b.match(/^FI[A-Za-z0-9]{5}$/)){frosmo.segment.counter.addSegmentCounter("credits","customerType",1)}})};frosmo.site.context=(function(){var b={home:{identifier:{path:{last:/^(|home)$/}},events:{provideMessage:{}}},tour:{identifier:{path:{last:"tour"}},events:{provideMessage:[{},{position:"top",inline:"#frosmo-message-top"},{position:"right",inline:"#frosmo-message-right"}]}},customers:{identifier:{path:{last:"customers"}},events:{provideMessage:[{},{position:"top",inline:"#frosmo-message-top"},{position:"right",inline:"#frosmo-message-right"}]}},pricing:{identifier:{path:{last:"pricing"}},events:{provideMessage:[{},{position:"top",inline:"#frosmo-message-top"},{position:"right",inline:"#frosmo-message-right"}]}},about:{identifier:{path:{last:"about"}},events:{provideMessage:[{},{position:"top",inline:"#frosmo-message-top"},{position:"right",inline:"#frosmo-message-right"}]}}},a=function(){return{init:function(){frosmo.contextIdentifier.init(b)}}};return{getCurrentContext:a}}());(function(){var a=function(c){var b=function(){frosmo.console.log("in reInit with path:"+window.location.pathname);if($("#content-left-col h1").length>0){$("#content-left-col h1").after('<div id="frosmo-message-top" />')}if($("#content-right-col").length>0){$("#content-right-col").prepend('<div id="frosmo-message-right" />')}c()};(function(e){if(window.history&&window.history.pushState){var d=e.pushState;e.pushState=function(h,i,f){var g=d.apply(e,arguments);if(typeof e.onpushstate==="function"){e.onpushstate(h,i,f)}return g}}}(window.history));history.onpushstate=function(e,f,d){b()};b()};frosmo.site.init=a}());frosmo.init=(function(){var e=[],c=function(o){var n=this,l="1.4.3",m=document.createElement("script"),k=false;m.type="text/javascript";m.charset="utf-8";m.src=("https:"===document.location.protocol?"https://":"http://")+"ajax.googleapis.com/ajax/libs/jquery/"+l+"/jquery.min.js";m.onload=function(){if(!k){jQuery.noConflict();k=true;o.call(n)}};m.onreadystatechange=function(){if(!k){if(("loaded"===m.readyState||"complete"===m.readyState)){jQuery.noConflict();k=true;o.call(n)}}};document.getElementsByTagName("head")[0].appendChild(m)},d=function(l){var k=window.location.hostname;return k.match(l+"$")},g=function(){if(typeof frosmo.utils==="undefined"){throw new Error("frosmo.utils.js not loaded (required by frosmo.init.js)")}if(typeof frosmo.cookies==="undefined"){throw new Error("frosmo.cookies.js not loaded (required by frosmo.init.js)")}if(typeof frosmo.session==="undefined"){throw new Error("frosmo.session.js not loaded (required by frosmo.init.js)")}if(typeof frosmo.event==="undefined"){throw new Error("frosmo.session.js not loaded (required by frosmo.init.js)")}if(typeof frosmo.site==="undefined"){throw new Error("frosmo.site not defined")}if(typeof frosmo.site.init==="undefined"){throw new Error("frosmo.site.init() not defined")}},a=function(k){if(!k.cookies||!k.cookies.domain){frosmo.console.error("Required site configuration variable domain missing");return false}if(!k.origin){frosmo.console.error("Required site configuration variable origin missing");return false}if(!k.message||!k.message.rpc){frosmo.console.error("Required site configuration variable message.rpc missing");return false}if(!k.api||!k.api.server){frosmo.console.error("Required site configuration variable origin missing");return false}if(!k.api.server.match(/\?$/)){frosmo.console.error("Invalid Optimizer API URL: "+k.api.server);return false}return true},j=function(k){if(typeof k.debug!=="undefined"){frosmo.config.debug=k.debug}if(typeof k.fbLoginTimeout!=="undefined"){frosmo.config.fbWrapper.loginTimeout=k.fbLoginTimeout}if(typeof k.fbUseOAuth!=="undefined"){frosmo.config.fbWrapper.oauth=k.fbUseOAuth}if(typeof k.fbAppId!=="undefined"){frosmo.config.fbWrapper.fbAppId=k.fbAppId}if(typeof k.origin!=="undefined"){frosmo.config.origin=k.origin}if(typeof k.messageRpc!=="undefined"){frosmo.config.message.rpc=k.messageRpc}if(typeof k.apiRpc!=="undefined"){frosmo.config.api.server=k.apiRpc}if(typeof k.domain!=="undefined"){frosmo.config.domain=k.domain;frosmo.config.cookies.domain=k.domain}var l={},m;for(m in frosmo.config){if(k[m]){l[m]=k[m]}}frosmo.utils.extend(frosmo.config,l)},b=function(m,l){var k=[];if(typeof m==="undefined"||m===null){l(k);return}if(frosmo.utils.isArray(m)){frosmo.utils.each(m,function(n){frosmo.addCss(n,function(o){k.push(o);if(k.length===m.length){frosmo.console.log("frosmo.init.js -- all CSS files loaded");if(l){l(k)}}})})}else{frosmo.addCss(m,function(n){k.push(n);frosmo.console.log("frosmo.init.js -- all CSS files loaded");if(l){l(k)}})}},f=function(){frosmo.site.context.getCurrentContext().init();if(e.length>0){frosmo.console.log("afterInitFunctions.length: "+e.length);for(var k=0;k<e.length;k=k+1){e[k].call(window)}}},h=function(){if(!frosmo.site.config){frosmo.console.error("no frosmo.site.config defined!");return}var k=frosmo.site.config;j(k);frosmo.console.log("frosmo.init.js -- load()");if(!a(frosmo.config)){frosmo.console.error("Site configuration check failed");return}if(!d(frosmo.config.cookies.domain)){frosmo.console.error("Site domain check failed.");return}if(typeof jQuery==="undefined"){throw new Error("jQuery not loaded (required by frosmo.init.js)")}try{g()}catch(l){frosmo.console.error("Error required frosmo namespace(s) missing: "+l)}if(k.css){(function(o){frosmo.utils.domReady(function(){b(o,function(p){frosmo.console.log("frosmo.init.js -- "+p.length+" CSS file(s) loaded")})})}(k.css))}k.init=k.init||{};frosmo.config.message={origin:frosmo.config.origin,rpc:frosmo.config.message.rpc};if(frosmo.admin){frosmo.admin.init()}frosmo.event.init();try{frosmo.session.init()}catch(n){frosmo.console.error("frosmo.init.js -- failed to initialize frosmo.session.js: "+n);return}frosmo.api.init(frosmo.config.api.server,frosmo.config.origin);if(frosmo.segment){frosmo.segment.init(k.segment)}if(frosmo.product){frosmo.product.init({api:frosmo.config.product.rpc,origin:frosmo.config.origin})}if(frosmo.message){frosmo.console.log("frosmo.init.js -- initializing frosmo.message library");try{if(k.init.message){if(typeof(k.init.message)==="function"){frosmo.message.init(k.init.message())}else{if(typeof(k.init.message)==="object"){frosmo.message.init(k.init.message)}}}else{frosmo.message.init()}}catch(m){frosmo.console.error("frosmo.init.js -- failed to initialize frosmo.message.js: "+m);return}}else{frosmo.console.log("frosmo.init.js -- frosmo.message is not enabled")}frosmo.site.init(f)},i=function(){if(window.jQuery){h()}else{c(h)}};return{init:i,afterInit:function(k){e.push(k)}}}());frosmo.loader.ready(frosmo.init.init);
