if(!dojo._hasResource["lemmy.brand_globals"]){dojo._hasResource["lemmy.brand_globals"]=true;dojo.provide("lemmy.brand_globals");var DEFAULT_CATEGORY_NAME="Lemonade";var PAGE_LOADING_MESSAGE="<div style=\"padding-top:100px;text-align:center;\"><img src=\"/images/lemmy/global/loading.gif\"></div>";var PRODUCT_RATING_TEXT={0:"OK",1:"Good",2:"Great",3:"Greater",4:"Greatest"};}var BRAND_NAME="Lemonade";var ARTICLE_AND_BRAND_NAME="a Lemonade";var MINIMUM_AGE=13;var Gigya;var gigyaUser={};dojo.addOnLoad(function(){Gigya=Gigya||new Lemon_Gigya();if((typeof (badtoken)!="undefined")&&(badtoken==true)){dojo.byId("messageDlgMsg").innerHTML=dojo.byId("badtokenTpl").innerHTML;dijit.byId("messageDlg").show();}if((typeof (resetPwToken)!="undefined")&&(resetPwToken.length>0)){dijit.byId("resetPwDlg").show();}updateTemplate();var _1=dojo.byId("loginEmail");var _2=dojo.byId("loginPassword");var _3=dojo.byId("loginForgotEmail");setEnterCallback(_2,validateUser);setEnterCallback(_3,validateResetPw);dojo.connect(_2,"onkeypress",clearLoginError);dojo.connect(_3,"onkeypress",clearLoginError);dojo.connect(_1,"onkeypress",clearLoginError);var _4=dojo.byId("newUserBirthYear");var _5=dojo.byId("newUserBirthMonth");var _6=dojo.byId("newUserBirthDay");var _7=function(){setDaysInMonth(_4,_5,_6);};dojo.connect(_5,"onchange",_7);dojo.connect(_5,"onkeypress",_7);dojo.connect(_4,"onchange",_7);dojo.connect(_4,"onkeypress",_7);if(dojo.byId("resetPwDlg")!=null){dojo.connect(dojo.byId("resetPwButton"),"onclick",setNewPassword);setEnterCallback(dojo.byId("resetPwConfirm"),setNewPassword);}if(Gigya.isEnabled()){gigya.services.socialize.addEventHandlers(Gigya.config,{onLogin:_gigyaLoginHandler,onLogout:Gigya.logEvent});}});function clearLoginError(ev){dojo.byId("forgotPassError").innerHTML="";dojo.byId("loginError").innerHTML="";dojo.byId("registrationError").innerHTML="";};function resetDialog(){if((devMode==true)&&Gigya.isEnabled()){dojo.byId("loginUnlinkAccts").style.display="inline";dojo.byId("joinUnlinkAccts").style.display="block";}clearLoginError();dojo.byId("gigyaLoginWidget").style.display="";dojo.byId("initialLoginPanel").style.display="";dojo.byId("joinButton").style.display="";dojo.byId("loginButton").style.display="";dojo.byId("loginNormalPrompt").style.display="";dojo.byId("registerUnlinkedAccount").style.display="";dojo.byId("facebookConfirmation").style.display="none";dojo.byId("joinAndLinkButton").style.display="none";dojo.byId("loginAndLinkButton").style.display="none";dojo.byId("loginLinkAccountsPrompt").style.display="none";dojo.byId("loginLinkAccountsExplanation").style.display="none";dojo.byId("loginRegistrationPanel").style.display="none";dojo.byId("registerAndLinkAccounts").style.display="none";dojo.byId("socialNetLoggedInNotLinked").style.display="none";dojo.byId("socialNetLoginBar").style.display="none";};function displayRegErrors(_9){var _a=dojo.byId("invalidEntriesText").innerHTML;dojo.byId("newUserNicknameLabel").style.color="black";dojo.byId("newUserPasswordLabel").style.color="black";dojo.byId("newUserConfirmPasswordLabel").style.color="black";dojo.byId("newUserEmailLabel").style.color="black";dojo.byId("newUserBirthdateLabel").style.color="black";dojo.byId("newUserOperatorAgreementLabel").style.color="black";dojo.byId("newUserPrivacyPolicyLabel").style.color="black";for(var _b in _9){switch(_9[_b]){case "nickname":dojo.byId("newUserNicknameLabel").style.color="red";break;case "passwordInvalid":_a=dojo.byId("passwordLengthText").innerHTML;dojo.byId("newUserPasswordLabel").style.color="red";dojo.byId("newUserConfirmPasswordLabel").style.color="red";break;case "passwordMismatch":_a=dojo.byId("passwordsDontMatchText").innerHTML;dojo.byId("newUserPasswordLabel").style.color="red";dojo.byId("newUserConfirmPasswordLabel").style.color="red";break;case "emailInvalid":case "emailempty":dojo.byId("newUserEmailLabel").style.color="red";break;case "nodate":dojo.byId("newUserBirthdateLabel").style.color="red";break;case "invaliddate":_a=dojo.byId("invalidBirthdateText").innerHTML;dojo.byId("newUserBirthdateLabel").style.color="red";break;case "tooyoung":_a=dojo.byId("notOldEnoughText").innerHTML;dojo.byId("newUserBirthdateLabel").style.color="red";break;case "operatorterms":dojo.byId("newUserOperatorAgreementLabel").style.color="red";break;case "privacyterms":dojo.byId("newUserPrivacyPolicyLabel").style.color="red";break;}}dojo.byId("registrationError").innerHTML=_a;};function _gigyaLoginHandler(_c){gigyaUser=_c.user;if(gigyaUser==undefined){devError("Gigya Socialize returned no user object");return;}if(gigyaUser.isSiteUID){var _d=dojox.dtl.filter.strings.addslashes(currentDestination);Lemon_Authorize.gigyaValidateLogin({eventObj:_c,destination:_d},function(_e){if(_e.status="OK"){currentDestination="";dijit.byId("mainLoginDialog").hide();window.top.location=_d;}else{var _f;if(_e.status=="bad_sig"){_f=dojo.byId("gigyaBrokenText").innerHTML.replace(/__SOCIAL_NET__/g,Gigya.getProviderName(_c.provider));}else{if(_e.status=="suspended"){_f=dojo.byId("accountSuspendedText").innerHTML;}else{_f=dojo.byId("invalidLoginText").innerHTML;}}dojo.byId("loginError").innerHTML=_f;}});return;}dojo.byId("socialNetPleaseLogIn").style.display="none";dojo.byId("gigyaLoginWidget").style.display="none";dojo.byId("socialNetOrBreak").style.display="none";dojo.byId("loginLinkAccountsPrompt").style.display="";dojo.byId("loginLinkAccountsExplanation").style.display="";var _10="<b>"+Gigya.getProviderName(_c.provider)+"</b>";setSocialNetName(_10);var _11=dojo.byId("mainLoginDialogContent");_11.innerHTML=_11.innerHTML.replace(/__SOCIAL_NET_NAME__/g,_10);dojo.byId("socialNetLoggedInNotLinked").style.display="";dojo.byId("registerAndLinkAccounts").style.display="";dojo.byId("registerUnlinkedAccount").style.display="none";dojo.byId("loginEmail").focus();if(_c.provider=="facebook"){showFacebookConfirmation();dojo.byId("facebookConfirmation").style.display="";}else{populateRegistrationFields();}dojo.byId("loginButton").style.display="none";dojo.byId("loginAndLinkButton").style.display="";dojo.byId("joinButton").style.display="none";dojo.byId("joinAndLinkButton").style.display="";};function populateRegistrationFields(_12){if(_12==true){dojo.byId("newUserNickname").value="";dojo.byId("newUserEmail").value="";dojo.byId("newUserBirthMonth").selectedIndex=0;dojo.byId("newUserBirthDay").selectedIndex=0;dojo.byId("newUserBirthYear").selectedIndex=0;dojo.byId("newUserGenderMale").checked=false;dojo.byId("newUserGenderFemale").checked=false;return;}dojo.byId("newUserNickname").value=gigyaUser.nickname.trim();if(gigyaUser.email.length>0){dojo.byId("newUserEmail").value=gigyaUser.email.trim();}dojo.byId("newUserBirthMonth").selectedIndex=gigyaUser.birthMonth;dojo.byId("newUserBirthDay").selectedIndex=gigyaUser.birthDay;dojo.byId("newUserBirthYear").value=gigyaUser.birthYear;switch(gigyaUser.gender){case "m":dojo.byId("newUserGenderMale").checked=true;break;case "f":dojo.byId("newUserGenderFemale").checked=true;break;}};function setNewPassword(){var _13="";var pw1=dojo.byId("resetPw").value.trim();var pw2=dojo.byId("resetPwConfirm").value.trim();if(pw1!==pw2){_13=dojo.byId("passwordsDontMatchText").innerHTML;}else{if((pw1.length<Lemon_Authorize.PASSWORD_MIN_LENGTH)||(pw1.length>Lemon_Authorize.PASSWORD_MAX_LENGTH)){_13=dojo.byId("passwordLengthText").innerHTML;}else{Lemon_Authorize.setNewPassword(resetPwToken,pw1,function(){if(Lemon_Authorize.status=="OK"){location.href="/setup/index/passwordchanged/1";}else{_13=dojo.byId("couldntSetPasswordText").innerHTML;}});}}if(_13.length>0){dojo.byId("pwResetErrorMsg").style.display="block";dojo.byId("pwResetErrorMsg").innerHTML=_13;}};function setSocialNetName(_16){dojo.query(".loginSocialNetNameSpan").forEach(function(_17){_17.innerHTML=_16;});};function showFacebookConfirmation(){var _18=function(id,_1a){var _1b=dojo.byId(id);var div=dojo.byId(id+"Div");if((_1b==null)||(div==null)){devError("span '"+id+"' or div '"+id+"Div' not found.");return;}_1b.innerHTML=_1a;div.style.display="";};if(gigyaUser.nickname.trim().length>0){_18("fbNickname",gigyaUser.nickname);}if(gigyaUser.email.trim().length>0){_18("fbEmail",gigyaUser.email);}var _1d="";if((gigyaUser.birthMonth>0)&&(gigyaUser.birthDay>0)){_1d+=gigyaUser.birthMonth+"-"+gigyaUser.birthDay;if(gigyaUser.birthYear>0){_1d+="-";}}if(gigyaUser.birthYear>0){_1d+=gigyaUser.birthYear;}if(_1d.length>0){_18("fbBirthdate",_1d);}var _1e=null;switch(gigyaUser.gender){case "m":_1e="Male";break;case "f":_1e="Female";break;}if(_1e!=null){_18("fbGender",_1e);}var _1f=dojo.byId("fbFillForm");if(_1f!=null){var _20=false;dojo.connect(_1f,"onclick",function(){populateRegistrationFields(_20);_20=!_20;});}};function showLoginDialog(){resetDialog();if(Gigya.isEnabled()){dojo.byId("socialNetLoginBar").style.display="";gigya.services.socialize.showLoginUI(Gigya.config,{containerID:"gigyaLoginWidget",border:0,width:550,height:50,showTermsLink:false,hideGigyaLink:true,onLoad:function(_21){Gigya.logCallback(_21);},onClose:Gigya.logCallback,onError:function(_22){Gigya.logCallback(_22);}});}dijit.byId("mainLoginDialog").show();};function showRegistrationPage(){dojo.byId("initialLoginPanel").style.display="none";dojo.byId("loginRegistrationPanel").style.display="";dojo.byId("newUserNickname").focus();};function unlinkAccounts(){if((devMode!=true)||!Gigya.isEnabled()){return;}Gigya.unlinkAccounts();};function updateTemplate(){var _23=dojo.byId("mainLoginDialogContent");var _24=_23.innerHTML.replace(/__BRAND_NAME__/g,BRAND_NAME).replace(/__ARTICLE_AND_BRAND_NAME__/g,ARTICLE_AND_BRAND_NAME).replace(/__MINIMUM_AGE__/g,MINIMUM_AGE).replace(/__PASSWORD_MIN_LENGTH__/g,Lemon_Authorize.PASSWORD_MIN_LENGTH).replace(/__PASSWORD_MAX_LENGTH__/g,Lemon_Authorize.PASSWORD_MAX_LENGTH);_23.innerHTML=_24;};function validateNewUser(_25){var _26=new Array();var _27=dojo.byId("newUserNickname").value.trim();var _28=dojo.byId("newUserPassword").value.trim();var _29=dojo.byId("newUserConfirmPassword").value.trim();var _2a=dojo.byId("newUserEmail").value.trim();var _2b=Number(dojo.byId("newUserBirthYear").value);var _2c=Number(dojo.byId("newUserBirthMonth").value);var day=Number(dojo.byId("newUserBirthDay").value);var _2e=dojo.date.getDaysInMonth(new Date(_2b,_2c-1,1));if((_2b==0)||(_2c==0)||(day==0)){_26.push("nodate");}else{if(day>_2e){_26.push("invaliddate");}else{var age=getAge(_2c,day,_2b);if(age<MINIMUM_AGE){_26.push("tooyoung");}}}if(!dojo.byId("newUserOperatorAgreement").checked){_26.push("operatorterms");}if(!dojo.byId("newUserPrivacyPolicy").checked){_26.push("privacyterms");}if(_27==""){_26.push("nickname");}if(_28!==_29){_26.push("passwordMismatch");}else{if(_28.length<Lemon_Authorize.PASSWORD_MIN_LENGTH||_28.length>Lemon_Authorize.PASSWORD_MAX_LENGTH){_26.push("passwordInvalid");}}if(_2a==""){_26.push("emailempty");}else{if(isValidEmail(_2a)==false){_26.push("emailInvalid");}}if(_26.length>0){displayRegErrors(_26);return false;}var _30=null;if(dojo.byId("newUserGenderMale").checked){_30="male";}else{if(dojo.byId("newUserGenderFemale").checked){_30="female";}}var _31={dest:dojox.dtl.filter.strings.addslashes(currentDestination),nickname:_27,password:_28,email:_2a,gender:_30,birthdate:_2b+"-"+_2c+"-"+day};if((_25===true)&&(gigyaUser!=undefined)){if(gigyaUser.isSiteUID==false){if(devMode==true){console.info("Will attempt to link gigya UID '"+gigyaUser.UID+"' to our new user object");}_31.gigyaUID=gigyaUser.UID;}else{if(devMode==true){console.warn("Not linking accounts via Gigya, because accounts are already linked");}}}Lemon_Authorize.createUser(_31,function(_32){switch(_32.status){case "OK":dojo.cookie("newuser",_32.uid);var _33=true;if(_32.warning){switch(_32.warning[0]){case "cannotlogin":_33=false;showLoginDialog();dojo.byId("loginError").innerHTML=dojo.byId("newUserCannotLogInText").innerHTML;break;}}if(Gigya.isEnabled()&&(_32.signature!=undefined)){var _34={timestamp:_32.timestamp,signature:_32.signature,siteUID:_32.uid,callback:Gigya.logCallback};gigya.services.socialize.notifyLogin(Gigya.config,_34);}if(_33){currentDestination="";dijit.byId("mainLoginDialog").hide();window.top.location=_32.url;}break;case "email_in_use":dojo.byId("registrationError").innerHTML=dojo.byId("emailAlreadyUsedText").innerHTML;break;case "badvalues":var _35=new Array();for(var _36 in _32.errorFields){switch(_36){case "birthdate":_35.push("invaliddate");break;case "email":_35.push("emailInvalid");break;case "nickname":_35.push("nickname");break;case "password":_35.push("passwordInvalid");break;}}displayRegErrors(_35);break;default:dojo.byId("registrationError").innerHTML=dojo.byId("cannotCreateAccountText").innerHTML;break;}});};function validateUser(_37){var _38=dojo.byId("loginEmail").value.trim();var _39=dojo.byId("loginPassword").value.trim();var _3a=new Array();if(_38.value==""){_3a.push("emailempty");}else{if(isValidEmail(_38)==false){_3a.push("email");}}if(_39==""){_3a.push("pw");}if(_3a.length>0){dojo.byId("loginError").innerHTML=dojo.byId("invalidLoginText").innerHTML;return false;}var _3b=dojox.dtl.filter.strings.addslashes(currentDestination);var _3c={email:_38,password:_39,dest:_3b};if((_37===true)&&(gigyaUser!=undefined)){if(gigyaUser.isSiteUID==false){if(devMode==true){console.info("Will attempt to link gigya UID "+gigyaUser.UID+" to our user");}_3c.gigyaUID=gigyaUser.UID;}else{if(devMode==true){console.info("Not linking accounts via Gigya, because accounts are already linked");}}}Lemon_Authorize.validateLogin(_3c,function(_3d){if(_3d.status=="OK"){currentDestination="";dijit.byId("mainLoginDialog").hide();if(Gigya.isEnabled()&&(_3d.signature!=undefined)){var _3e={timestamp:_3d.timestamp,signature:_3d.signature,siteUID:_3d.uid,callback:Gigya.logCallback};gigya.services.socialize.notifyLogin(Gigya.config,_3e);}window.top.location=_3d.url;}else{var _3f="invalidLoginText";if(_3d.status=="suspended"){_3f="accountSuspendedText";}dojo.byId("loginError").innerHTML=dojo.byId(_3f).innerHTML;}});};function validateResetPw(){var _40=dojo.byId("loginForgotEmail").value;if((_40=="")||(isValidEmail(_40)==false)){dojo.byId("forgotPassError").innerHTML=dojo.byId("invalidResetPasswordEmailText").innerHTML;return false;}dojo.byId("loginForgotEmail").value="";dijit.byId("mainLoginDialog").hide();Lemon_Authorize.forgotPassword(_40,function(){if(Lemon_Authorize.validated){showMessage("An email was sent to "+_40+".");}else{showMessage("Unable to reset password at this time.");}});};if(!dojo._hasResource["lemon.model.wall"]){dojo._hasResource["lemon.model.wall"]=true;dojo.provide("lemon.model.wall");function Lemon_Wall(_41,_42,_43){this.enabled=false;this.messages=[];this.standid=null;if(!isNaN(_41)){this.standid=_41;}if(typeof (_42)=="boolean"){this.enabled=_42;}if(typeof (_43)=="object"){this.messages=_43;}};Lemon_Wall.prototype={setWall:function(_44,_45,_46){if(typeof (_44)=="number"){this.standid=_44;}if(typeof (_45)=="boolean"){this.enabled=_45;}if(typeof (_46)=="object"){this.messages=_46;}},setEnabled:function(_47,_48){if(typeof (_47)!="boolean"){if(devMode){console.error("'enabled' must be a boolean");}return;}if(this.enabled!==_47){lemonAjax({url:"/stand/setwallstate",content:{wallstate:_47?"1":"0",standid:this.standid},load:function(_49){_48(_49);}});}this.enabled=_47;},getMessages:function(_4a){if(!this.enabled){if(devMode){console.warn("Wall not enabled");}return;}var _4b=new Object();lemonAjax({url:"/stand/getwallmessages/stand/"+this.standid,load:function(_4c){_4b.enabled=_4c.wallstate;_4b.messages=_4c.messages;_4a(_4b);}});},getMessageCount:function(){return this.messages.length;},saveMessage:function(msg,_4e){if(!this.enabled||typeof (msg)!="string"||msg.length<1){return null;}var me=this;lemonAjax({url:"/stand/postwallmessage",content:{message:msg,stand:this.standid},load:function(_50){if(_50.status=="OK"){me.messages.splice(0,0,_50.data.message);}_4e(_50);}});},deleteMessage:function(_51,_52){if(!this.enabled||isNaN(_51)){return null;}var me=this;lemonAjax({url:"/stand/removewallmessage",content:{messagepid:_51,stand:this.standid},load:function(_54){if(_54.standwallmessageremove==true){for(var i in me.messages){var _56=me.messages[i].id;if(_56==_51){me.messages.splice(i,1);break;}}}_52(_54);}});}};}if(!dojo._hasResource["lemon.model.shop"]){dojo._hasResource["lemon.model.shop"]=true;dojo.provide("lemon.model.shop");function Lemon_Shop_Type(){};Lemon_Shop_Type.prototype={getStands:function(_57,_58,_59,qry,_5b){lemonAjax({url:"/shop/get-stands",content:{searchtext:_57,limit:_58,offset:_59,qry:qry},load:_5b});},getPeople:function(_5c,_5d,_5e,qry,_60){lemonAjax({url:"/shop/get-people",content:{searchtext:_5c,limit:_5d,offset:_5e,qry:qry},load:_60});},getProducts:function(_61,_62,_63,_64,_65,_66){lemonAjax({url:"/shop/get-products",content:{searchtxt:_61,limit:_62,offset:_63,catpath:_64,collection:_65},load:_66});}};var Lemon_Shop=new Lemon_Shop_Type();}if(!dojo._hasResource["lemon.model.stand"]){dojo._hasResource["lemon.model.stand"]=true;dojo.provide("lemon.model.stand");function Lemon_Stand_Type(){};Lemon_Stand_Type.prototype={standid:null,name:null,ownerId:null,themeback:null,themefore:null,themebgimage:null,themename:null,tags:null,description:null,offerId:null,readiness:null,emailsSent:null,url:null,promoId:null,availablePromotions:[],availableProducts:[],totalAvailableProducts:0,currentProducts:[],totalCurrentProducts:0,promos:[],getAvailableProducts:function(_67,_68,_69,_6a,_6b,_6c){var _6d=new Object();_6d.products=[];lemonAjax({url:"/setup/get-products",content:{searchtxt:_67,limit:_68,offset:_69,catpath:_6a,collection:_6b},load:_6c});},getAvailableProductsCount:function(){return this.availableProducts.length;},getCurrentProducts:function(_6e,_6f,_70){var _71=new Object();_71.currentProducts=[];lemonAjax({url:"/setup/get-product-list",content:{stand:this.standid,limit:_6e,offset:_6f},load:function(_72){if(!isNaN(_72.total)){_71.totalCurrentProducts=_72.total;}for(var key in _72){if(!isNaN(key)&&typeof (_72[key])=="object"){_71.currentProducts.push(_72[key]);}}_70(_71);}});},getCurrentProductsCount:function(){return this.currentProducts.length;},getAllProducts:function(_74){var _75=new Object();_75.products=[];lemonAjax({url:"/setup/get-all-products-in-stand",content:{standid:this.standid},load:_74});},addProducts:function(_76,_77,_78){lemonAjax({url:"/setup/add-products",content:{standpid:this.standid,productpids:_76,merchantpids:_77,timeout:30000},load:_78});},setProductSequence:function(_79,_7a){var tmp=new Array();for(var i in _79){if(_79[i].match(/^[0-9]+:[0-9]+$/)){tmp.push(_79[i]);}}var _7d=tmp.join("|");lemonAjax({url:"/setup/set-product-sequence",content:{standpid:this.standid,productseqs:_7d},load:function(_7e){_7a(_7e);}});},rateProduct:function(_7f,_80,_81,_82){lemonAjax({url:"/setup/set-stand-product-rating",content:{standpid:this.standid,productpid:_7f,merchantpid:_80,rating:_81},load:function(_83){_82(_83);}});},removeProduct:function(_84,_85,_86){lemonAjax({url:"/setup/delete-product",content:{standpid:this.standid,productpid:_84,merchantpid:_85},load:function(_87){if(_87.status=="OK"){_86(_87.productCount);}else{devError("Product could not be deleted");}}});},setTheme:function(_88,_89,_8a,_8b,_8c){var _8d=new Object();lemonAjax({url:"/setup/set-stand-theme",content:{standpid:this.standid,fore:_88,back:_89,theme:_8a,themebg:_8b},load:function(_8e){if(_8e=="1"){_8d.themeback=_89;_8d.themefore=_88;_8d.themename=_8a;_8d.themebgimage=_8b;}_8c(_8d);}});},setTags:function(_8f,_90){var _91=new Object();lemonAjax({url:"/setup/posttags",content:{stand:this.standid,tags:_8f},load:_90});},getAvailablePromos:function(_92){var _93=new Object();_93.availablePromotions=[];lemonAjax({url:"/promotion/getavailablepromos",load:function(_94){for(var _95 in _94.data.promotions){_93.availablePromotions.push(_94.data.promotions[_95]);}_92(_93);}});},setPromos:function(_96,_97,_98){var _99=new Object();lemonAjax({url:"/setup/savestandpromo",content:{standid:this.standid,promo_add:_96.join(":"),promo_del:_97.join(":")},load:function(_9a){_98(_9a);}});},setDescription:function(_9b,_9c){var _9d=new Object();lemonAjax({url:"/setup/postdescription",content:{statepid:this.standid,statedesc:_9b},load:_9c});},setName:function(_9e,_9f){var _a0=new Object();lemonAjax({url:"/setup/poststandname",content:{statepid:this.standid,statename:_9e},load:_9f});},create:function(_a1,_a2){lemonAjax({url:"/setup/create-stand",content:{standname:_a1},load:function(_a3){_a2(_a3);}});},remove:function(_a4){lemonAjax({url:"/setup/delete-stand",content:{standpid:this.standid},load:function(_a5){_a4(_a5);}});},setReadiness:function(_a6,_a7){lemonAjax({url:"/setup/set-readiness",content:{standpid:this.standpid,level:_a6},load:function(_a8){_a7(_a8);}});},getReviews:function(_a9,_aa){},postReview:function(_ab,_ac,_ad){},getWebmailContacts:function(_ae,_af,_b0,_b1){var ret=[];lemonAjax({url:"/setup/getwebmailcontacts",content:{mailcarrier:_ae,username:_af,password:_b0},load:function(_b3){if(_b3.errorfields&&_b3.errorfields.length>0){ret["error"]=_b3.errorfields;}if(_b3.webmailsessionid&&_b3.webmailsessionid.length>0){ret["webmailsessionid"]=_b3.webmailsessionid;}if(_b3.addresses){ret["addresses"]=_b3.addresses;}_b1(ret);}});},validateEmailContent:function(_b4,_b5){lemonAjax({url:"/setup/validate-webmail-content",content:{content:_b4},load:function(_b6){_b5(_b6);}});},sendPromoEmail:function(_b7,_b8,to,_ba,_bb,_bc){lemonAjax({url:"/setup/send-promo-email",content:{message:_b7,subject:_b8,to:to,standid:_ba,standurl:_bb},load:_bc});}};var Lemon_Stand=new Lemon_Stand_Type();}if(!dojo._hasResource["lemon.model.user"]){dojo._hasResource["lemon.model.user"]=true;dojo.provide("lemon.model.user");function Lemon_User_Type(){};Lemon_User_Type.prototype={saveBasic:function(_bd,_be){lemonAjax({url:"/myaccount/savebasic",content:_bd,load:_be,error:function(err){response.status="savefailed";}});},saveProfilePrefs:function(_c0,_c1){lemonAjax({url:"/myaccount/saveprofileprefs",content:_c0,load:_c1});},saveCommPrefs:function(_c2,_c3){lemonAjax({url:"/myaccount/savecommunicationprefs",content:_c2,load:_c3});},savePassword:function(_c4,_c5,_c6){lemonAjax({url:"/myaccount/savepassword",content:{oldpassword:_c4,password:_c5},load:_c6});},saveDescription:function(_c7,_c8){lemonAjax({url:"/myaccount/savedescription",content:{selfdescription:_c7},load:_c8});},savePaypal:function(_c9,_ca){lemonAjax({url:"/myaccount/save-paypal",content:{paypal:_c9},load:_ca});},savePointAwardsId:function(_cb,_cc){lemonAjax({url:"/myaccount/save-point-awards-id",content:{pointawardsid:_cb},load:_cc});},stageBioPic:function(_cd,_ce){dojo.io.iframe.send({form:"bioUploadForm",contentType:"multipart/form-data",url:"/myaccount/stagebiopic",handleAs:"json",timeout:15000,load:_ce});},commitBioPic:function(x,y,w,h,_d3){lemonAjax({url:"/myaccount/uploadbiopic",content:{x:x,y:y,w:w,h:h},load:_d3});},getDashboardStands:function(_d4){_d4.getawards=_d4.getawards||false;_d4.offset=_d4.offset||0;_d4.userid=_d4.userid||0;lemonAjax({url:"/myaccount/get-dashboard-stands",content:{userpid:_d4.userid,limit:_d4.limit,offset:_d4.offset,getawards:_d4.getawards},load:function(_d5){var _d6=new Object();_d6.dashboardStands=[];if(_d5.total){_d6.totalDashboardStands=_d5.total;}for(var s in _d5){if(!isNaN(s)){_d6.dashboardStands.push(_d5[s]);}}_d4.callback(_d6);}});},getStands:function(_d8,_d9,_da,_db){if(isNaN(_da)){_da=0;}lemonAjax({url:"/user/get-stands",content:{id:_d8,limit:_d9,offset:_da},load:_db});},getSales:function(_dc){lemonAjax({url:"/myaccount/get-sales",content:{},load:function(_dd){_dc(_dd);}});}};var Lemon_User=new Lemon_User_Type();}if(!dojo._hasResource["lemon.model.authorize"]){dojo._hasResource["lemon.model.authorize"]=true;dojo.provide("lemon.model.authorize");function Lemon_Authorize_Type(){};Lemon_Authorize_Type.prototype={PASSWORD_MIN_LENGTH:4,PASSWORD_MAX_LENGTH:32,status:null,validated:false,url:"",standpid:null,warning:null,errorFields:null,gigyaValidateLogin:function(_de,_df){if(!Lemon_Gigya.prototype.isEnabled()){if(devMode==true){console.warn("gigya API key undefined");}return;}var me=this;var _e1=_de.eventObj;var _e2={dest:_de.destination,provider:_e1.provider,signature:_e1.signature,timestamp:_e1.timestamp,uid:_e1.UID};lemonAjax({url:"/authorize/gigya-verify-user",content:_e2,load:function(_e3){if(devMode==true){console.log("gigyaValidateLogin response="+dumpArray(_e3,true));}if(_e3.status=="OK"){me.validated=true;me.url=_e3.url;me.standpid=_e3.standpid;}if(_df){_df(_e3);}}});},validateLogin:function(_e4,_e5){var me=this;this.validated=false;lemonAjax({url:"/authorize/verify-user",content:_e4,load:function(_e7){me.status=_e7.status;if(_e7.status=="OK"){me.validated=true;me.url=_e7.url;me.standpid=_e7.standpid;}_e5(_e7);}});},validateSession:function(_e8){this.validated=false;var me=this;lemonAjax({url:"/authorize/is-logged-in",content:{},load:function(_ea){if(_ea.status=="OK"){me.validated=true;}_e8();}});},createUser:function(_eb,_ec){this.validated=false;var me=this;lemonAjax({url:"/authorize/create-user",content:_eb,load:function(_ee){ret=_ee;if(_ee.status=="OK"){me.validated=true;me.url=_ee.url;me.standpid=_ee.standpid;if(_ee.warning){me.warning=_ee.warning;}else{me.warning=null;}}if(_ee.errorFields){me.errorFields=_ee.errorFields;}else{me.errorFields=null;}me.status=_ee.status;_ec(_ee);}});},forgotPassword:function(_ef,_f0){this.validated=false;var me=this;lemonAjax({url:"/authorize/forgot-password",content:{email:_ef},load:function(_f2){if(_f2.status=="OK"){me.validated=true;}_f0();}});},setNewPassword:function(_f3,_f4,_f5){var me=this;lemonAjax({url:"/authorize/set-new-password",content:{token:_f3,newPw:_f4},load:function(_f7){me.status=_f7.status;_f5();}});}};var Lemon_Authorize=new Lemon_Authorize_Type();}if(!dojo._hasResource["lemon.model.product"]){dojo._hasResource["lemon.model.product"]=true;dojo.provide("lemon.model.product");function Lemon_Product_Type(){};Lemon_Product_Type.prototype={getStands:function(_f8,_f9,_fa,_fb){lemonAjax({url:"/product/get-stands",content:{productid:_f8,limit:_f9,offset:_fa},load:_fb});}};var Lemon_Product=new Lemon_Product_Type();}if(!dojo._hasResource["lemon.model.facebook"]){dojo._hasResource["lemon.model.facebook"]=true;dojo.provide("lemon.model.facebook");function Lemon_Facebook_Type(){};Lemon_Facebook_Type.prototype={activateStand:function(_fc,_fd,_fe){lemonAjax({url:"/setup/activate-fb-stand",content:{standpid:_fc,facebookuid:_fd},load:function(_ff){_fe(_ff);}});},getOwnerFriendStands:function(_100,_101,_102){lemonAjax({url:"/facebook/get-owner-friend-stands",content:{limit:_100,offset:_101},load:_102});},getPublicFriendStands:function(_103){lemonAjax({url:"/facebook/get-public-friend-stands",content:{},load:_103});},getProducts:function(_104,_105,_106,_107,_108){var _109=new Object();_109.products=[];lemonAjax({url:"/facebook/get-stand-products",content:{standId:_104,limit:_105,offset:_106,activeOnly:_107},load:function(_10a){if(!isNaN(_10a.total)){_109.totalProducts=_10a.total;}for(var key in _10a){if(!isNaN(key)&&typeof (_10a[key])=="object"){_109.products.push(_10a[key]);}}_108(_109);}});},createOwnerPage:function(_10c){lemonAjax({url:"/facebook/create",content:{},load:function(_10d){_10c(_10d);}});},createPublicPage:function(_10e){lemonAjax({url:"/facebook/public-create",content:{},load:function(_10f){_10e(_10f);}});},shopAdded:function(_110){lemonAjax({url:"/facebook/shopadded",content:{},load:function(_111){_110(_111);}});},productAdded:function(_112){lemonAjax({url:"/facebook/productadded",content:{},load:function(_113){_112(_113);}});}};var Lemon_Facebook=new Lemon_Facebook_Type();}if(!dojo._hasResource["lemon.model.gigya"]){dojo._hasResource["lemon.model.gigya"]=true;dojo.provide("lemon.model.gigya");var Gigya;dojo.addOnLoad(function(){Gigya=Gigya||new Lemon_Gigya();});function Lemon_Gigya(){this.config={signIDs:true,shortURLs:(devMode==true)?"never":"always",APIKey:gigyaAPIKey};if(devMode==true){if(!this.isEnabled()){console.warn("gigya API key undefined");return;}gigya.services.socialize.addEventHandlers(this.config,{onConnect:this.logEvent,onDisconnect:this.logEvent,onLogin:this.logEvent,onLogout:this.logEvent});}};Lemon_Gigya.prototype={PRODUCT_SHARED:"product_shared",PRODUCT_SHARED_FROM_STAND:"stand_product_shared",STAND_SHARED:"stand_shared",defaultProductTemplate:"{actor} wants you to check out this product!",defaultProductActionName:"",defaultProductUserMessage:"",defaultStandTemplate:"{actor} wants you to check out this stand!",defaultStandActionName:"",defaultStandUserMessage:"",hostAddress:location.protocol+"//"+location.host,_absoluteURL:function(_114){return _114.replace(/%SERVER%/g,this.hostAddress);},_recordShare:function(_115,_116){var _117=_116.context;if(_117!=undefined){var _118=_116.providers.split(",");var _119=_118.length;var _11a={sharetype:_115};for(var prop in _117){_11a[prop.toLowerCase()]=_117[prop];}if(_119>0){lemonAjax({url:"/stat/record-share",content:_11a,load:function(_11c){if(_11c!="OK"){devError("Problem recording share; gigyaResponse="+dumpArray(_116,true));}}});}}else{devError("_recordShare: context expected");}},_share:function(_11d,_11e){_11e.linkBackURL=this._absoluteURL(_11e.linkBackURL);var act=new gigya.services.socialize.UserAction();act.setTitle(_11e.name);act.setDescription(_11e.description);act.setLinkBack(_11e.linkBackURL);act.setTemplate(_11e.template);act.setActionName(_11e.actionName);act.setUserMessage(_11e.userMessage);if(_11e.actionLinkTitle!=undefined){if(_11e.actionLink==undefined){_11e.actionLink=_11e.linkBackURL;}else{_11e.actionLink=this._absoluteURL(_11e.actionLink);}act.addActionLink(_11e.actionLinkTitle,_11e.actionLink);}if(_11e.imageURL!=undefined){act.addMediaItem({type:"image",src:this._absoluteURL(_11e.imageURL),href:_11e.linkBackURL});}if(_11e.flashURL!=undefined){act.addMediaItem({type:"flash",src:this._absoluteURL(_11e.flashURL),width:_11e.width,height:_11e.height,previewImageURL:this._absoluteURL(_11e.previewImageURL),previewImageWidth:_11e.previewImageWidth,previewImageHeight:_11e.previewImageHeight});}var self=this;var _121=new Object();if(_11e.containerID){_121.containerID=_11e.containerID;}_121.context=_11e.context;_121.onError=_11e.onError||this.logEvent;_121.onSend=_11e.onSend||this.logCallback;_121.onSendDone=function(_122){self.logCallback(_122);if(_122.context!=undefined){self._recordShare(_11d,_122);}if(_11e.onSendDone){_11e.onSendDone(_122);}};_121.userAction=act;gigya.services.socialize.showShareUI(this.config,_121);},getProviderName:function(_123){return _123.substring(0,1).toUpperCase()+_123.substring(1);},isEnabled:function(){return (gigyaAPIKey!=undefined)&&(gigyaAPIKey.length>0);},logCallback:function(_124){if(devMode==true){console.log("GIGYA callback: "+dumpArray(_124,true)+(_124.context?"; context: "+dumpArray(_124.context,true):""));}},logEvent:function(_125){if(devMode!=true){return;}console.log("GIGYA EVENT: \""+_125.eventName+"\""+(_125.context?", context: "+dumpArray(_125.context,true):""));if(_125.eventName){switch(_125.eventName.toLowerCase()){case "error":if(_125.status){console.error("  status: "+_125.status+", msg: "+_125.statusMessage);}if(_125.errorCode){console.error("  errorCode: "+_125.errorCode+", errorMsg: "+_125.errorMessage);}break;}}var user=_125.user;if(user!=undefined){console.info("user = {"+dumpArray(user,true)+"}");console.info("capabilities = {"+dumpArray(user.capabilities,true)+"}");var _127="";for(var _128 in user.identities){if(_127.length>0){_127+=", ";}_127+="["+_128+" -- "+dumpArray(user.identities[_128],true)+"]";}console.info("identities = {"+_127+"}");}},shareProduct:function(_129){_129.linkBackURL=_129.linkBackURL||"%SERVER%/product/index/id/"+_129.productId;_129.template=_129.template||this.defaultProductTemplate;_129.actionName=_129.actionName||this.defaultProductActionName;_129.userMessage=_129.userMessage||this.defaultProductUserMessage;_129.actionLinkTitle=_129.actionLinkTitle||this.defaultProductActionLinkTitle;_129.actionLink=_129.actionLink||this.defaultProductActionLink;var _12a=this.PRODUCT_SHARED;var _12b=_129.context;if(_12b&&_12b.standId){_12a=this.PRODUCT_SHARED_FROM_STAND;}this._share(_12a,_129);},shareStand:function(_12c){_12c.linkBackURL=_12c.linkBackURL||"%SERVER%/stand/index/id/"+_12c.standId;_12c.template=_12c.template||this.defaultStandTemplate;_12c.actionName=_12c.actionName||this.defaultStandActionName;_12c.userMessage=_12c.userMessage||this.defaultStandUserMessage;_12c.actionLinkTitle=_12c.actionLinkTitle||this.defaultStandActionLinkTitle;_12c.actionLink=_12c.actionLink||this.defaultStandActionLink;this._share(this.STAND_SHARED,_12c);},unlinkAccounts:function(){gigya.services.socialize.unlinkAccounts(this.config,{callback:this.logCallback});}};}
