if(typeof dd_domreadycheck=="undefined"){var dd_domreadycheck=false}var ddlevelsmenu={enableshim:false,bUrl:undefined,arrowpointers:{downarrow:["Images/spacer.gif",11,7],rightarrow:["Images/Template/hdrNavArrow.gif",12,12],showarrow:{toplevel:true,sublevel:true}},hideinterval:400,effects:{enableswipe:false,enablefade:false,duration:200},httpsiframesrc:"blank.htm",topmenuids:[],topitems:{},subuls:{},lastactivesubul:{},topitemsindex:-1,ulindex:-1,hidetimers:{},shimadded:false,nonFF:!/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent),getoffset:function(b,a){return(b.offsetParent)?b[a]+this.getoffset(b.offsetParent,a):b[a]},getoffsetof:function(a){a._offsets={left:this.getoffset(a,"offsetLeft"),top:this.getoffset(a,"offsetTop")}},getwindowsize:function(){this.docwidth=window.innerWidth?window.innerWidth-10:this.standardbody.clientWidth-10;this.docheight=window.innerHeight?window.innerHeight-15:this.standardbody.clientHeight-18},gettopitemsdimensions:function(){for(var c=0;c<this.topmenuids.length;c++){var e=this.topmenuids[c];for(var b=0;b<this.topitems[e].length;b++){var a=this.topitems[e][b];var d=document.getElementById(a.getAttribute("rel"));a._dimensions={w:a.offsetWidth,h:a.offsetHeight,submenuw:d.offsetWidth,submenuh:d.offsetHeight}}}},isContained:function(d,b){var b=window.event||b;var a=b.relatedTarget||((b.type=="mouseover")?b.fromElement:b.toElement);while(a&&a!=d){try{a=a.parentNode}catch(b){a=d}}if(a==d){return true}else{return false}},addpointer:function(e,b,c,a){var d=document.createElement("img");d.src=(((this.bUrl!=undefined)?this.bUrl:"")+c[0]);d.style.width=c[1]+"px";d.style.height=c[2]+"px";if(b=="rightarrowpointer"){d.style.left=e.offsetWidth-c[2]-2+"px"}d.className=b;var f=e.childNodes[e.firstChild.nodeType!=1?1:0];if(f&&f.tagName=="SPAN"){e=f}if(a=="before"){e.insertBefore(d,e.firstChild)}else{e.appendChild(d)}},css:function(b,d,a){var c=new RegExp("(^|\\s+)"+d+"($|\\s+)","ig");if(a=="check"){return c.test(b.className)}else{if(a=="remove"){b.className=b.className.replace(c,"")}else{if(a=="add"&&!c.test(b.className)){b.className+=" "+d}}}},addshimmy:function(c){var b=(!window.opera)?document.createElement("iframe"):document.createElement("div");b.className="ddiframeshim";b.setAttribute("src",location.protocol=="https:"?this.httpsiframesrc:"about:blank");b.setAttribute("frameborder","0");c.appendChild(b);try{b.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"}catch(a){}return b},positionshim:function(c,f,b,d,e){if(c._istoplevel){var e=window.pageYOffset?window.pageYOffset:this.standardbody.scrollTop;var g=c._offsets.top-e;var a=e+this.docheight-c._offsets.top-c._dimensions.h;if(g>0){this.shimmy.topshim.style.left=d+"px";this.shimmy.topshim.style.top=e+"px";this.shimmy.topshim.style.width="99%";this.shimmy.topshim.style.height=g+"px"}if(a>0){this.shimmy.bottomshim.style.left=d+"px";this.shimmy.bottomshim.style.top=c._offsets.top+c._dimensions.h+"px";this.shimmy.bottomshim.style.width="99%";this.shimmy.bottomshim.style.height=a+"px"}}},hideshim:function(){this.shimmy.topshim.style.width=this.shimmy.bottomshim.style.width=0;this.shimmy.topshim.style.height=this.shimmy.bottomshim.style.height=0},buildmenu:function(d,b,e,f,c,a){b._master=d;b._pos=f;b._istoplevel=c;if(c){this.addEvent(b,function(g){ddlevelsmenu.hidemenu(ddlevelsmenu.subuls[this._master][parseInt(this._pos)])},"click")}this.subuls[d][f]=e;b._dimensions={w:b.offsetWidth,h:b.offsetHeight,submenuw:e.offsetWidth,submenuh:e.offsetHeight};this.getoffsetof(b);e.style.left=0;e.style.top=0;e.style.visibility="hidden";this.addEvent(b,function(g){if(!ddlevelsmenu.isContained(this,g)){var l=ddlevelsmenu.subuls[this._master][parseInt(this._pos)];if(this._istoplevel){ddlevelsmenu.css(this,"selected","add");clearTimeout(ddlevelsmenu.hidetimers[this._master][this._pos])}ddlevelsmenu.getoffsetof(b);var j=window.pageXOffset?window.pageXOffset:ddlevelsmenu.standardbody.scrollLeft;var k=window.pageYOffset?window.pageYOffset:ddlevelsmenu.standardbody.scrollTop;var n=this._offsets.left+this._dimensions.submenuw+(this._istoplevel&&a=="topbar"?0:this._dimensions.w);var m=this._offsets.top+this._dimensions.submenuh;var h=(this._istoplevel?this._offsets.left+(a=="sidebar"?this._dimensions.w:0):this._dimensions.w);if(n-j>ddlevelsmenu.docwidth){h+=-this._dimensions.submenuw+(this._istoplevel&&a=="topbar"?this._dimensions.w:-this._dimensions.w)}l.style.left=h+"px";var i=(this._istoplevel?this._offsets.top+(a=="sidebar"?0:this._dimensions.h):this.offsetTop);if(m-k>ddlevelsmenu.docheight){if(this._dimensions.submenuh<this._offsets.top+(a=="sidebar"?this._dimensions.h:0)-k){i+=-this._dimensions.submenuh+(this._istoplevel&&a=="topbar"?-this._dimensions.h:this._dimensions.h)}else{i+=-(this._offsets.top-k)+(this._istoplevel&&a=="topbar"?-this._dimensions.h:0)}}l.style.top=i+"px";if(ddlevelsmenu.enableshim&&(ddlevelsmenu.effects.enableswipe==false||ddlevelsmenu.nonFF)){ddlevelsmenu.positionshim(b,l,a,j,k)}else{l.FFscrollInfo={x:j,y:k}}ddlevelsmenu.showmenu(b,l,a)}},"mouseover");this.addEvent(b,function(g){var h=ddlevelsmenu.subuls[this._master][parseInt(this._pos)];if(this._istoplevel){if(!ddlevelsmenu.isContained(this,g)&&!ddlevelsmenu.isContained(h,g)){ddlevelsmenu.hidemenu(h)}}else{if(!this._istoplevel&&!ddlevelsmenu.isContained(this,g)){ddlevelsmenu.hidemenu(h)}}},"mouseout")},setopacity:function(a,b){a.style.opacity=b;if(typeof a.style.opacity!="string"){a.style.MozOpacity=b;if(a.filters){a.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity="+b*100+")"}}},showmenu:function(c,d,a){if(this.effects.enableswipe||this.effects.enablefade){if(this.effects.enableswipe){var b=(c._istoplevel&&a=="topbar")?c._dimensions.submenuh:c._dimensions.submenuw;d.style.width=d.style.height=0;d.style.overflow="hidden"}if(this.effects.enablefade){this.setopacity(d,0)}d._curanimatedegree=0;d.style.visibility="visible";clearInterval(d._animatetimer);d._starttime=new Date().getTime();d._animatetimer=setInterval(function(){ddlevelsmenu.revealmenu(c,d,b,a)},10)}else{d.style.visibility="visible"}},revealmenu:function(d,e,c,a){var b=new Date().getTime()-e._starttime;if(b<this.effects.duration){if(this.effects.enableswipe){if(e._curanimatedegree==0){e.style[d._istoplevel&&a=="topbar"?"width":"height"]="auto"}e.style[d._istoplevel&&a=="topbar"?"height":"width"]=(e._curanimatedegree*c)+"px"}if(this.effects.enablefade){this.setopacity(e,e._curanimatedegree)}}else{clearInterval(e._animatetimer);if(this.effects.enableswipe){e.style.width="auto";e.style.height="auto";e.style.overflow="visible"}if(this.effects.enablefade){this.setopacity(e,1);e.style.filter=""}if(this.enableshim&&e.FFscrollInfo){this.positionshim(d,e,a,e.FFscrollInfo.x,e.FFscrollInfo.y)}}e._curanimatedegree=(1-Math.cos((b/this.effects.duration)*Math.PI))/2},hidemenu:function(a){if(typeof a._pos!="undefined"){this.css(this.topitems[a._master][parseInt(a._pos)],"selected","remove");if(this.enableshim){this.hideshim()}}clearInterval(a._animatetimer);a.style.left=0;a.style.top="-1000px";a.style.visibility="hidden"},addEvent:function(b,a,c){if(b.addEventListener){b.addEventListener(c,a,false)}else{if(b.attachEvent){b.attachEvent("on"+c,function(){return a.call(b,window.event)})}}},domready:function(a){if(dd_domreadycheck){a();return}if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);a();dd_domreadycheck=true},false)}else{if(document.attachEvent){if(document.documentElement.doScroll&&window==window.top){(function(){if(dd_domreadycheck){a();return}try{document.documentElement.doScroll("left")}catch(b){setTimeout(arguments.callee,0);return}a();dd_domreadycheck=true})()}}}if(document.attachEvent&&parent.length>0){this.addEvent(window,function(){a()},"load")}},init:function(k,g,e){this.bUrl=e;this.standardbody=(document.compatMode=="CSS1Compat")?document.documentElement:document.body;this.topitemsindex=-1;this.ulindex=-1;this.topmenuids.push(k);this.topitems[k]=[];this.subuls[k]=[];this.hidetimers[k]=[];if(this.enableshim&&!this.shimadded){this.shimmy={};this.shimmy.topshim=this.addshimmy(document.body);this.shimmy.bottomshim=this.addshimmy(document.body);this.shimadded=true}var l=document.getElementById(k);var a=l.getElementsByTagName("a");this.getwindowsize();for(var j=0;j<a.length;j++){if(a[j].getAttribute("rel")){this.topitemsindex++;this.ulindex++;var m=a[j];this.topitems[k][this.topitemsindex]=m;var h=document.getElementById(m.getAttribute("rel"));document.body.appendChild(h);h.style.zIndex=2000;h._master=k;h._pos=this.topitemsindex;this.addEvent(h,function(){ddlevelsmenu.hidemenu(this)},"click");var b=(g=="sidebar")?"rightarrowpointer":"downarrowpointer";var d=(g=="sidebar")?this.arrowpointers.rightarrow:this.arrowpointers.downarrow;if(this.arrowpointers.showarrow.toplevel){this.addpointer(m,b,d,(g=="sidebar")?"before":"after")}this.buildmenu(k,m,h,this.ulindex,true,g);h.onmouseover=function(){clearTimeout(ddlevelsmenu.hidetimers[this._master][this._pos])};this.addEvent(h,function(i){if(!ddlevelsmenu.isContained(this,i)&&!ddlevelsmenu.isContained(ddlevelsmenu.topitems[this._master][parseInt(this._pos)],i)){var c=this;if(ddlevelsmenu.enableshim){ddlevelsmenu.hideshim()}ddlevelsmenu.hidetimers[this._master][this._pos]=setTimeout(function(){ddlevelsmenu.hidemenu(c)},ddlevelsmenu.hideinterval)}},"mouseout");var o=h.getElementsByTagName("ul");for(var f=0;f<o.length;f++){this.ulindex++;var n=o[f].parentNode;if(this.arrowpointers.showarrow.sublevel){this.addpointer(n.getElementsByTagName("a")[0],"rightarrowpointer",this.arrowpointers.rightarrow,"before")}this.buildmenu(k,n,o[f],this.ulindex,false,g)}}}this.addEvent(window,function(){ddlevelsmenu.getwindowsize();ddlevelsmenu.gettopitemsdimensions()},"resize")},setup:function(c,b,a){this.domready(function(){ddlevelsmenu.init(c,b,a)})}};function logError(c,d,b){try{jQuery.post((sslEnabled?sslUrl:baseUrl)+"Wcf/LogError.ashx",{msg:c,url:d,line:b})}catch(a){}}window.onerror=function(b,c,a){logError(b,c,a)};function rU(){return((basePort=="443")?sslUrl:baseUrl)}function rW(a){return rU()+a}function rD(a){window.location=rW(a)}function rIU(){return((basePort=="443")?sslUrl+"Images/":"http://images.specialtys.com/")}function S4(){return(((1+Math.random())*65536)|0).toString(16).substring(1)}function guid(){return(S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4())}function validateEmail(a){var b=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return b.test(a)}function getFriendlyTime(b){var a=Math.floor(b/60);var c=b-(a*60);if(c<10){c="0"+c}if(a>11){c+="pm"}if(a<=11){c+="am"}if(a>12){a-=12}return a+":"+c}function left(b,a){if(a<=0){return""}else{if(a>String(b).length){return b}else{return String(b).substring(0,a)}}}function right(c,b){if(b<=0){return""}else{if(b>String(c).length){return c}else{var a=String(c).length;return String(c).substring(a,a-b)}}}function displayDateTime(a){alert(a);return a.format("MM/dd/yy")+" "+a.format("h:MMtt")}function displayShortDateTime(a){return a.format("M/d")+" "+a.format("h:MMtt")}function displayDate(a){return a.format("MM/dd/yy")}function displayTime(a){return a.format("h:mmtt")}var depMgr={testScript:function(objToTestAsString){if(objToTestAsString==undefined||objToTestAsString==null||objToTestAsString==""){return true}var objExists=true;try{if(!eval(objToTestAsString+"==undefined")){objExists=true}}catch(e){objExists=false}return objExists},load:function(a){$(document).append(unescape("%3Cscript src='"+a+"' type='text/javascript'%3E%3C/script%3E"))},retryLoadWithCallback:function(f,a,d,b){if(b==undefined){b=0}b++;var c=3;var e=500;if(b<c){setTimeout(function(){depMgr.loadWithCallback(f,a,d,b)},e)}else{logError("Script failed to load after multiple retries.",f,"0");alert("Oops! Something went wrong.")}},loadWithCallback:function(f,a,d,b){var c=$('head script[src="'+f+'"]');if(c.length>0){if(depMgr.testScript(d)){a()}else{depMgr.retryLoadWithCallback(f,a,d,b)}return}var e=$(document.createElement("script"));e.attr("type","text/javascript");e.attr("src",f);if(e[0].readyState){e[0].onreadystatechange=function(){if(e[0].readyState=="loaded"||e[0].readyState=="complete"){e[0].onreadystatechange=null;if(depMgr.testScript(d)){a()}else{depMgr.retryLoadWithCallback(f,a,d,b)}}}}else{e.bind("error",function(){alert("Something went wrong.")});e.bind("load",function(){if(depMgr.testScript(d)){a()}else{depMgr.retryLoadWithCallback(f,a,d,b)}})}$("head")[0].appendChild(e[0])}};function xPost(i,d,a,b){$("#proxyFrame").remove();var g="resultFrame";var h=$("#"+g);h.unbind("load");h.unbind("error");h.load(function(){if(!(a==undefined||a==null)){a.call(this)}});h.error(function(){if(!(b==undefined||b==null)){b.call(this)}});var f=document.createElement("IFRAME");f.id="proxyFrame";f.style.display="none";$("#post").append(f);var e=f.contentWindow.document;e.open();e.write('<form method="POST" action="'+i+'" target="'+g+'">');if(!(d==null||d==undefined)){for(var c in d){if(d.hasOwnProperty(c)){e.write('<input type="hidden" name="'+c+'" value="'+d[c]+'" />')}}}e.write("</form>");e.write("<script>window.onload = function(){document.forms[0].submit();}</script>");e.close()};EventClass=function(){this.eventList=new Array()};EventClass.prototype.eventObject=null;EventClass.prototype.add=function(a){this.eventList.push(a);return this.eventList.length-1};EventClass.prototype.remove=function(a){this.eventList[a]=null};EventClass.prototype.trigger=function(){for(var a=0;a<this.eventList.length;a++){if(!(this.eventList[a]==null)){this.eventList[a].call(this)}}};EventClass.prototype.triggerWithArg=function(a){for(var b=0;b<this.eventList.length;b++){if(!(this.eventList[b]==null)){this.eventList[b].call(this,a)}}};EventClass.prototype.triggerWithArgs=function(a,b){for(var c=0;c<this.eventList.length;c++){if(!(this.eventList[c]==null)){this.eventList[c].call(this,a,b)}}};function EventManagerClass(){this.onscroll=new EventClass();this.onresize=new EventClass();this.onkeydown=new EventClass();this.onaddtocart=new EventClass();this.onremovefromcart=new EventClass();this.onupdateqtyincart=new EventClass();this.onlogin=new EventClass();this.onlogout=new EventClass();this.onregister=new EventClass();this.onloadcart=new EventClass();this.onlocationchange=new EventClass();this.onselecteddatechange=new EventClass();this.onloaduser=new EventClass();this.onpopupopen=new EventClass();this.onpopupclose=new EventClass()}EventManagerClass.prototype.setup=function(){window.onscroll=function(){eventMgr.onscroll.trigger()};window.onresize=function(){eventMgr.onresize.trigger()};document.body.onkeydown=function(a){eventMgr.onkeydown.triggerWithArg(a)}};var eventMgr=new EventManagerClass();var cookieMgr={readCookie:function(e){var f=e+"=";var b=document.cookie.split(";");for(var d=0;d<b.length;d++){var a=b[d];while(a.charAt(0)==" "){a=a.substring(1,a.length)}if(a.indexOf(f)==0){return a.substring(f.length,a.length)}}return null},readCookieKey:function(e,c){var a=this.readCookie(e);if(a==null||a==undefined){return null}var d=a.split("&");for(var b=0;b<d.length;b++){var f=d[b].split("=");if(f[0]==c){return f[1]}}},getKioskTypeFromCookie:function(){return cookieMgr.readCookieKey("Kiosk","KioskTypeId")}};var popupWindowMgr={popupContainerDivId:"",popupWindowDivId:"",popupContentDivId:"",smallCssMod:"",mediumCssMod:"",eventOnScroll:-1,eventOnResize:-1,eventOnKeyDown:-1,eventIndexCollection:Array(),setup:function(c,d,b,e,a){this.popupContainerDivId="#"+c;this.popupWindowDivId="#"+d;this.popupContentDivId="#"+b;this.smallCssMod=e;this.mediumCssMod=a},clear:function(){$(this.popupContentDivId).html("")},showLargeWindow:function(){this.makeLarge();$(this.popupContainerDivId).height($(document).height());$(this.popupContainerDivId).show();$(this.popupWindowDivId).css("margin-top","0px");$(this.popupWindowDivId).show();this.center();if($(window).height()<568){$(window).scroll(0)}this.addHandlers()},showMediumWindow:function(){this.makeMedium();$(this.popupContainerDivId).height($(document).height());$(this.popupContainerDivId).show();$(this.popupWindowDivId).css("margin-top","0px");$(this.popupWindowDivId).show();this.center();if($(window).height()<424){$(window).scroll(0)}this.addHandlers()},showSmallWindow:function(){this.makeSmall();$(this.popupContainerDivId).height($(document).height());$(this.popupContainerDivId).show();$(this.popupWindowDivId).css("margin-top","0px");$(this.popupWindowDivId).show();this.center();if($(window).height()<340){$(window).scroll(0)}this.addHandlers()},makeLarge:function(){$(this.popupWindowDivId).removeClass(this.smallCssMod);$(this.popupWindowDivId).removeClass(this.mediumCssMod)},makeMedium:function(){$(this.popupWindowDivId).addClass(this.mediumCssMod);$(this.popupWindowDivId).removeClass(this.smallCssMod)},makeSmall:function(){$(this.popupWindowDivId).removeClass(this.mediumCssMod);$(this.popupWindowDivId).addClass(this.smallCssMod)},escapeKeyDetector:function(a){var c=(window.event)?event.keyCode:a.keyCode;var b=(window.event)?27:a.DOM_VK_ESCAPE;if(c==b){popupWindowMgr.hide()}},addHandlers:function(){this.eventOnScroll=eventMgr.onscroll.add(function(){popupWindowMgr.center()});eventMgr.onresize.add(function(){popupWindowMgr.center()});eventMgr.onkeydown.add(function(a){popupWindowMgr.escapeKeyDetector(a)})},remHandlers:function(){eventMgr.onscroll.remove(this.eventOnScroll);eventMgr.onscroll.remove(this.eventOnResize);eventMgr.onscroll.remove(this.eventOnKeyDown)},hide:function(){this.remHandlers();$(this.popupContainerDivId).hide();$(this.popupWindowDivId).hide();$(this.popupWindowDivId).css("margin-top","0px");$(this.popupWindowDivId).removeClass(this.smallCssMod);this.clear();eventMgr.onpopupclose.trigger()},content:function(a){$(this.popupContentDivId).html(a)},center:function(){var c=$(this.popupWindowDivId);if(c.is(":visible")){var b=c.outerHeight();var e=$(window).height();var d=0;var a="0px";if(document.documentElement.scrollTop){d=parseInt(document.documentElement.scrollTop)}else{if(document.body.scrollTop){d=parseInt(document.body.scrollTop)}}if(e<(b)){a="0px"}else{a=String(((e-b)/2)+d)+"px"}if(c.css("margin-top")=="0px"){c.css("margin-top",a)}else{c.stop();c.animate({marginTop:a},"fast","linear")}}}};AccordionMenu=function(c,d,a){this.rootDiv=c;if(d!=undefined){this.speed=d}if(a!=undefined){this.collapsePrev=a}var b=this;$("#"+c+" .accordionMenuHeader a").click(function(){b.toggleElementClick(this);return false})};AccordionMenu.prototype.rootDiv=null;AccordionMenu.prototype.collapsePrev=true;AccordionMenu.prototype.speed="";AccordionMenu.prototype.unload=function(){$("#"+this.rootDiv+" .accordionMenuHeader a").unbind()};AccordionMenu.prototype.toggleElementClick=function(a){var b=$(a).attr("target");if(b==""){return}if($(a).parent(".accordionMenuHeader").hasClass("accordionOpenHeader")){$(a).parent(".accordionMenuHeader").removeClass("accordionOpenHeader");if(this.speed==""){$("#"+b).toggle()}else{$("#"+b).slideToggle(this.speed)}}else{if(this.collapsePrev){if(this.speed==""){$("#"+this.rootDiv).children(".accordionCategoryItem").hide()}else{$("#"+this.rootDiv).children(".accordionCategoryItem").slideUp(this.speed)}$("#"+this.rootDiv).children(".accordionMenuHeader").removeClass("accordionOpenHeader")}$(a).parent(".accordionMenuHeader").addClass("accordionOpenHeader");if(this.speed==""){$("#"+b).show()}else{$("#"+b).slideDown(this.speed)}}};AccordionMenu.prototype.toggleElement=function(a){if($("#"+this.rootDiv+" a[target="+a+"]").parent(".accordionMenuHeader").hasClass("accordionOpenHeader")){this.collapseElement(a)}else{this.expandElement(a)}};AccordionMenu.prototype.collapseElement=function(a){if($("#"+this.rootDiv+" a[target="+a+"]").parent(".accordionMenuHeader").hasClass("accordionOpenHeader")){$("#"+this.rootDiv+" a[target="+a+"]").parent(".accordionMenuHeader").removeClass("accordionOpenHeader");if(this.speed==""){$("#"+a).hide()}else{$("#"+a).slideUp(this.speed)}}};AccordionMenu.prototype.expandElement=function(a){if(!$("#"+this.rootDiv+" a[target="+a+"]").parent(".accordionMenuHeader").hasClass("accordionOpenHeader")){if(this.collapsePrev){if(this.speed==""){$("#"+this.rootDiv).children(".accordionCategoryItem").hide()}else{$("#"+this.rootDiv).children(".accordionCategoryItem").slideUp(this.speed)}$("#"+this.rootDiv).children(".accordionMenuHeader").removeClass("accordionOpenHeader")}$("#"+this.rootDiv+" a[target="+a+"]").parent(".accordionMenuHeader").addClass("accordionOpenHeader");if(this.speed==""){$("#"+a).show()}else{$("#"+a).slideDown(this.speed)}}};var gaMgr={track:function(b,a){try{_gaq.push(["_trackEvent",b,a])}catch(c){}}};var gMgr={cb:null,load:function(a){this.cb=a;var b=document.createElement("script");b.src="http://www.google.com/jsapi?key="+gMapApiKey+"&callback=gMgr.callback";b.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(b)},callback:function(){if(gMgr.cb!=null){gMgr.cb.call(this)}gMgr.cb=null},loadWithMaps:function(a){gMgr.cb=a;var b=document.createElement("script");b.src="http://www.google.com/jsapi?key="+gMapApiKey+"&callback=gMgr.loadMaps";b.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(b)},loadMaps:function(){google.load("maps","2",{callback:gMgr.callback})}};var lunchcartMgr={customerId:0,lunchcartId:null,cellId:null,dateRequested:null,pickupFlag:null,itemCount:0,itemList:new Array(),isGroupLunchcart:false,isGrouplunchcartObject:false,dateDeadline:null,budget:null,init:function(a){specialtys.com.SDProxy.LoadLunchcart(function(b){lunchcartMgr.initCallback(b,a)},null,null)},initCallback:function(b,a){lunchcartMgr.customerId=b.CustomerId;lunchcartMgr.lunchcartId=b.LunchcartId;lunchcartMgr.cellId=b.CellId;lunchcartMgr.dateRequested=b.DateRequested;lunchcartMgr.pickupFlag=b.PickupFlag;lunchcartMgr.itemCount=b.ItemCount;lunchcartMgr.isGroupLunchcart=b.IsGroupLunchcart;lunchcartMgr.isGrouplunchcartObject=b.IsGroupLunchcartObject;lunchcartMgr.dateDeadline=b.DateDeadline;lunchcartMgr.budget=b.Budget;eventMgr.onloadcart.trigger();if(a!=undefined&&a!=null){a.call(this)}},showExpressCheckout:function(){userMgr.requireCustomerId(function(){lunchcartMgr.init(function(){if(lunchcartMgr.itemCount>0){if(confirm("WARNING: Upon opening the Express Checkout, your current order will be moved to your list of unfinished orders. Are you sure you want to continue?")){window.location="ExpressCheckout.aspx"}}else{window.location="ExpressCheckout.aspx"}})})},addToCart:function(c,d,a){var b=a;specialtys.com.SDProxy.AddProductToLunchcart(c,d,function(e,f){eventMgr.onaddtocart.triggerWithArgs(e,f);if(b!=undefined&&b!=null){b.call(this)}},null,{Quantity:d})},addToCartWithEdits:function(d,e,a,b){var c=b;specialtys.com.SDProxy.AddProductToLunchcartWithEdits(d,e,a,function(f,g){eventMgr.onaddtocart.triggerWithArgs(f,g);if(c!=undefined&&c!=null){c.call(this)}},null,{Quantity:e})},removeFromCart:function(a,b){specialtys.com.SDProxy.DeleteProductFromLunchcart(a,function(d,c){eventMgr.onremovefromcart.triggerWithArgs(d,c)},null,{ProductId:a,Price:b})},updateCart:function(a){specialtys.com.SDProxy.UpdateProductsInLunchcart(a,function(c,b){eventMgr.onupdateqtyincart.triggerWithArgs(c,b)},null,a)},updateCartEdit:function(a){specialtys.com.SDProxy.UpdateProductsInLunchcartEdit(a,function(c,b){eventMgr.onupdateqtyincart.triggerWithArgs(c,b)},null,a)},setPickupLocation:function(a){specialtys.com.SDProxy.SetPickupLocation(a,function(){eventMgr.onlocationchange.trigger()},null,null)},setDeliveryLocation:function(a){specialtys.com.SDProxy.SetDeliveryLocation(a,function(){eventMgr.onlocationchange.trigger()},null,null)},confirmLocation:function(){specialtys.com.SDProxy.ConfirmLocation()},setDateRequested:function(a,b){specialtys.com.SDProxy.SetDateRequested(new Date(a),parseInt(b),function(){eventMgr.onselecteddatechange.trigger()},null,null)},showUpsellPage:function(){depMgr.loadWithCallback("JScript/lunchcartservices-upsell-0.3.js",function(){jQuery.get(rU()+"Templates/lunchcartservices-upsell.htm","",function(a,b){popupWindowMgr.showLargeWindow();popupWindowMgr.content(a);upsellMgr.init()},"text")},"upsellMgr")},showDateRequestedPage:function(a){depMgr.loadWithCallback("JScript/lunchcartservices-datetime-0.1.js",function(){jQuery.get(rU()+"Templates/lunchcartservices-date-selector.htm","",function(b,c){popupWindowMgr.showSmallWindow();popupWindowMgr.content(b);dateTimeMgr.init(a)},"text")})},showDateRequestedPageForGroupLunchcart:function(a){depMgr.loadWithCallback("JScript/lunchcartservices-datetime-0.1.js",function(){jQuery.get(rU()+"Templates/lunchcartservices-date-selector.htm","",function(b,c){popupWindowMgr.showSmallWindow();popupWindowMgr.content(b);dateTimeMgr.initForGroupLunchcart(a)},"text")})},setProposalLocation:function(){specialtys.com.SDProxy.LoadLunchcartLocationFormatted(function(a){$("#aProposalLocation").html(a)},null,null)},setProposalDateRequested:function(){specialtys.com.SDProxy.LoadLunchcartDateRequestedFormatted(function(a){$("#aProposalDateRequest").html(a)},null,null)}};var grpLunchboxMgr={showDateRequestedPage:function(a){jQuery.get(rU()+"Templates/group-lunchbox-date-selector.htm","",function(b,c){popupWindowMgr.showSmallWindow();popupWindowMgr.content(b);dateTimeGLBMgr.init(a)},"text")},setLocation:function(){specialtys.com.SDProxy.LoadLunchcartLocationFormatted(function(a){$("#aLocation").html(a)},null,null);specialtys.com.SDProxy.LoadLunchcartDateRequestedFormatted(function(a){$("#aDateRequested").html(a)},null,null)},setDateRequested:function(){specialtys.com.SDProxy.LoadLunchcartDateRequestedFormatted(function(a){$("#aDateRequested").html(a)},null,null)}};Type.registerNamespace("Specialtys.Core.SpecialtysDirect.AuthResponseType");Type.registerNamespace("Specialtys.Core.SpecialtysDirect.ChangePasswordResponse");Specialtys.Core.SpecialtysDirect.AuthResponseType={Failed:0,OK:1,FailedEmailVerificationRequired:2,OKPasswordChangeRequired:3,AlreadyRegistered:4};Specialtys.Core.SpecialtysDirect.ChangePasswordResponse={InvalidResponse:-1,OK:0,PasswordDoesNotMatch:1,PasswordBlank:2,PasswordIncorrect:3};var userMgr={authenticated:null,customerId:null,cellId:null,userName:null,firstName:null,locationRequired:null,skipUpsell:false,proposalFeatureEnabled:null,passwordChangeRequired:null,authResponse:null,authCount:0,lastAuthRequestUrl:null,isAuthRedirected:null,isAuthenticating:false,callback:null,onHideEventIndex:null,failCallback:null,sslFrame:null,init:function(a){specialtys.com.SDProxy.GetUser(function(b){userMgr.initCallback(b,a)},function(){alert("Oops! Something went wrong, please try again.")})},initCallback:function(b,a){userMgr.authenticated=b.Authenticated;userMgr.customerId=b.CustomerId;userMgr.userName=b.UserName;userMgr.proposalFeatureEnabled=b.ProposalFeatureEnabled;userMgr.passwordChangeRequired=b.PasswordChangeRequired;userMgr.authResponse=b.AuthResponse;userMgr.lastAuthRequestUrl=b.LastAuthRequestUrl;userMgr.isAuthRedirected=b.IsAuthRedirected;eventMgr.onloaduser.trigger();if(a!=undefined&&a!=null){a.call(this)}},requireLogin:function(a,b){this.callback=a;this.failCallback=b;if(this.authenticated==true){this.triggerCallback();return}this.init(function(){userMgr.requireLoginCallback()})},displayClosestStores:function(){var a=$("#popupWindow_loginOrLocationPrompt_zip").attr("value");var b=true;if(isNaN(a)){b=false}if(a.length!=5){b=false}if(b){$("#popup_LoginOrLocation_storeResults_ul").html('<p class="toolTip">loading...</p>');$("#popup_LoginOrLocation_storeResults").show();specialtys.com.SDProxy.LoadStoresByZip(a,function(c){userMgr.displayClosestStoresCallback(c)},function(){alert("Oops! Something went wrong, please try again.")})}else{alert("The zipcode you entered is invalid.")}},displayClosestStoresCallback:function(a){var f=$("#popup_LoginOrLocation_storeResults_ul");var b="";for(var c=0;c<a.length;c++){var e=a[c];b+='<li class="locationItem"><div class="leftCol"><span class="btnText"><a href="#" onclick="userMgr.selectDefaultStore(\''+e.CellId+'\'); return false;"><span>select</span></a></span></div><div class="midCol"><h4>'+e.FriendlyAddress+"</h4></div></li>"}f.html(b)},selectDefaultStore:function(a){specialtys.com.SDProxy.SetDefaultStore(a,function(){userMgr.triggerCallback()},function(){alert("Oops! Something went wrong, please try again.")});gaMgr.track("Store Pre-selection Window","Store Selected")},showLocation:function(a,b){this.callback=a;this.failCallback=b;jQuery.get(rU()+"Templates/userservices-location.htm","",function(c,d){popupWindowMgr.showLargeWindow();popupWindowMgr.content(c);userMgr.setupOnHideEvent(function(){setTimeout("userMgr.triggerFailCallback()",250)});$("#popupWindow_loginOrLocationPrompt_zip").focus()},"text");gaMgr.track("Store Pre-selection Window","Open Window")},showLoginOrLocation:function(a,b){if(userMgr.userName==null||userMgr.userName==undefined){this.initFromCookie()}this.callback=a;this.failCallback=b;jQuery.get(rU()+"Templates/userservices-login-or-location.htm","",function(c,d){popupWindowMgr.showLargeWindow();popupWindowMgr.content(c);userMgr.setupOnHideEvent(function(){setTimeout("userMgr.triggerFailCallback()",250)});if(userMgr.userName==null||userMgr.userName==undefined||userMgr.userName==""){$("#popupWindow_loginPrompt_username").focus()}else{$("#popupWindow_loginPrompt_username").val(userMgr.userName);$("#popupWindow_loginPrompt_password").focus().focus()}},"text")},requireLoginCallback:function(){if(userMgr.authenticated!=true){userMgr.login(this.callback,this.failCallback);return}this.failCallback=null;this.triggerCallback()},checkCustomerId:function(){this.initFromCookie();return(this.customerId>0)},requireCellId:function(a,b){this.callback=a;this.failCallback=b;if(this.cellId==null){this.initFromCookie()}if(this.cellId==null){if(this.checkCustomerId()){this.showLocation(this.callback,this.failCallback);return}else{this.showLoginOrLocation(this.callback,this.failCallback);return}}else{this.triggerCallback()}},requireCustomerId:function(a,b){this.callback=a;this.failCallback=b;if(this.userName==null||this.userName==undefined){this.initFromCookie()}if(this.userName==null||this.userName==undefined){this.init(function(){userMgr.requireCustomerIdCallback()});return}userMgr.requireCustomerIdCallback();return},requireCustomerIdCallback:function(){if(!(userMgr.customerId>0)){userMgr.login(this.callback,this.failCallback);return}this.failCallback=null;this.triggerCallback()},changePasswordCallback:function(){jQuery.get(rU()+"Templates/userservices-change-password.htm","",function(a,b){productMgr.windowMgr.content(a);productMgr.windowMgr.showSmallWindow()},"text")},changePasswordLogin:function(a){jQuery.get(rU()+"Templates/userservices-change-password.htm","",function(b,c){productMgr.windowMgr.content(b);productMgr.windowMgr.showSmallWindow();if(!(a==null||a==undefined)){$("#popupWindow_passwordchangePrompt_password").attr("value",a)}$("#popupWindow_passwordchangePrompt_response").text("Your temporary password has expired. Please enter and confirm a new password.");$("#popupWindow_passwordchangePrompt_new_password").focus()},"text")},register:function(a,b,e,d,c){this.callback=a;this.locationRequired=c;jQuery.get(rU()+"Templates/userservices-register.htm","",function(f,g){popupWindowMgr.showMediumWindow();popupWindowMgr.content(f);if(e!=undefined){$("#popupWindow_registerPrompt_email").attr("value",e)}if(d!=undefined){$("#popupWindow_registerPrompt_password").attr("value",d)}$("#popupWindow_registerPrompt_email").focus();if(e!=undefined&&e!=""){$("#popupWindow_registerPrompt_password").focus();if(d!=undefined){$("#popupWindow_registerPrompt_passwordconfirm").focus()}}},"text")},emailTemporaryPassword:function(){var a=$("#popupWindow_loginPrompt_username").val();jQuery.get(rU()+"Templates/userservices-forgot-password.htm","",function(b,c){productMgr.windowMgr.content(b);$("#popupWindow_loginPrompt_email_reminder").val(a);$("#popupWindow_loginPrompt_email_reminder").focus();productMgr.windowMgr.showSmallWindow()},"text")},login:function(a,b,c){if(userMgr.userName==null||userMgr.userName==undefined){this.initFromCookie()}if(c!=undefined){userMgr.userName=c}this.callback=a;this.failCallback=b;jQuery.get(rU()+"Templates/userservices-login.htm","",function(d,e){popupWindowMgr.showSmallWindow();popupWindowMgr.content(d);userMgr.setupOnHideEvent(function(){setTimeout("userMgr.triggerFailCallback()",250)});if(userMgr.userName==null||userMgr.userName==undefined||userMgr.userName==""||cookieMgr.getKioskTypeFromCookie()==3){$("#popupWindow_loginPrompt_username").focus()}else{$("#popupWindow_loginPrompt_username").val(userMgr.userName);$("#popupWindow_loginPrompt_password").focus().focus()}},"text")},initFromCookie:function(){this.customerId=cookieMgr.readCookieKey("Customer","CustomerId");this.userName=cookieMgr.readCookieKey("Customer","Email");this.firstName=cookieMgr.readCookieKey("Customer","Firstname");this.cellId=cookieMgr.readCookieKey("Customer","CellId");this.proposalFeatureEnabled=false;if(cookieMgr.readCookieKey("Customer","ProposalFeatureEnabled")=="True"){this.proposalFeatureEnabled=true}},tryLoginNonSecure:function(){var b=$("#popupWindow_loginPrompt_username").val();var a=$("#popupWindow_loginPrompt_password").val();$("#popupWindow_loginPrompt_response").text("Verifying your identity, please wait...");specialtys.com.SDProxy.AuthenticateUser(b,a,function(c){userMgr.tryLoginCallback(c)},function(){alert("Oops! Something went wrong, please try again.")})},tryLoginSSL_IFrameAlt:function(){},tryLoginSSL_IFrame:function(){userMgr.authCount++;var i=$("#popupWindow_loginPrompt_username").val();var f=$("#popupWindow_loginPrompt_password").val();var h=sslUrl+"Wcf/SSLAuth.ashx";var g="?user="+encodeURIComponent(i)+"&pass="+encodeURIComponent(String(f));var d=$("#iframeHelper");var e=$("#iframeHelperResult");var a=window.frames.iframeHelper.document.getElementById("authForm");var c=window.frames.iframeHelper.document.getElementById("popupWindow_loginPrompt_username");var b=window.frames.iframeHelper.document.getElementById("popupWindow_loginPrompt_password");c.value=i;b.value=f;$(e).unbind("load");userMgr.isAuthenticating=true;$(e).bind("load",function(){userMgr.isAuthenticating=false;specialtys.com.SDProxy.GetAuthResponse(function(j){userMgr.tryLoginCallback(j)},function(){alert("Oops! Something went wrong, please try again.")})});setTimeout(function(){if(userMgr.isAuthenticating==true){specialtys.com.SDProxy.GetAuthResponse(function(j){userMgr.tryLoginCallback(j)},function(){alert("Oops! Something went wrong, please try again.")})}},2500);a.action=h;a.submit()},tryLoginSSL_POST:function(){userMgr.authCount++;var b=$("#popupWindow_loginPrompt_username").val();var a=$("#popupWindow_loginPrompt_password").val();userMgr.isAuthenticating=true;xPost(sslUrl+"Wcf/SSLAuth.ashx",{user:b,pass:a},function(){userMgr.isAuthenticating=false;specialtys.com.SDProxy.GetAuthResponse(function(c){userMgr.tryLoginCallback(c)},function(){alert("Oops! Something went wrong, please try again.")})},function(){userMgr.isAuthenticating=false;alert("Oops! Something went wrong, please try again.")})},tryLoginSSL:function(){var c=$("#popupWindow_loginPrompt_username").val();var a=$("#popupWindow_loginPrompt_password").val();var b=sslUrl+"Wcf/SSLAuth.ashx";$.ajax({dataType:"jsonp",data:"user="+encodeURIComponent(c)+"&pass="+encodeURIComponent(a),jsonp:"callback",url:b,success:function(e,f){userMgr.tryLoginCallback(e)},error:function(e,f){$("#popupWindow_loginPrompt_response").text("SSL authentication failed, trying standard connection...");setTimeout("userMgr.tryLoginNonSecure()",1000)}})},sendEmailAuth:function(){var a=$("#popupWindow_loginPrompt_username").attr("value");specialtys.com.SDProxy.SendEmailVerification(a,function(){alert("A copy of the verification email has been sent to your email address. Please click the link shown in the email to complete registration.");popupWindowMgr.hide()},function(){alert("Oops! Something went wrong, please try again.")})},tryLogin:function(){$("#popupWindow_loginPrompt_response").removeClass();$("#popupWindow_loginPrompt_response").addClass("toolTip");if(basePort=="80"||basePort=="443"){$("#popupWindow_loginPrompt_response").text("Verifying your identity using a secure connection, please wait...");userMgr.tryLoginSSL_POST()}else{logError("Logging in via debug mode","userservices::tryLogin","0");$("#popupWindow_loginPrompt_response").text("Verifying your identity in debug mode, please wait...");setTimeout("userMgr.tryLoginNonSecure()",500)}},tryLoginCallback:function(a){$("#popupWindow_loginPrompt_response").removeClass();$("#popupWindow_loginPrompt_response").addClass("toolTip");if(a.AuthResponseType==Specialtys.Core.SpecialtysDirect.AuthResponseType.OK){$("#popupWindow_loginPrompt_response").text("Login successful!");popupWindowMgr.hide();userMgr.triggerCallback();eventMgr.onlogin.triggerWithArg(a);if(typeof(ordersliderMgr)!="undefined"){ordersliderMgr.proposalFeatureEnabled()}}else{if(a.AuthResponseType==Specialtys.Core.SpecialtysDirect.AuthResponseType.OKPasswordChangeRequired){if(typeof(ordersliderMgr)!="undefined"){ordersliderMgr.proposalFeatureEnabled()}userMgr.triggerCallback();eventMgr.onlogin.triggerWithArg(a);var b=$("#popupWindow_loginPrompt_password").attr("value");userMgr.changePasswordLogin(b)}else{if(a.AuthResponseType==Specialtys.Core.SpecialtysDirect.AuthResponseType.Failed){if(userMgr.authCount>1){userMgr.authCount=0;$("#popupWindow_loginPrompt_response").text("Redirecting you to alternate login screen...");$("#popupWindow_loginPrompt_response").addClass("errorText");window.location=sslUrl+"Login.aspx";return}$("#popupWindow_loginPrompt_response").text("The details you provided were not correct. Please try again.");$("#popupWindow_loginPrompt_response").addClass("errorText")}else{if(a.AuthResponseType==Specialtys.Core.SpecialtysDirect.AuthResponseType.FailedEmailVerificationRequired){$("#popupWindow_loginPrompt_response").text("Your email address had not been verified. Please verify your email address and try to login again.");$("#userServices-login-standardBtns").hide();$("#userServices-login-verifyBtns").show();$("#popupWindow_loginPrompt_username").attr("disabled",true);$("#popupWindow_loginPrompt_password").attr("disabled",true);$("#popupWindow_loginPrompt_response").addClass("errorText")}}}}$("#popupWindow_loginPrompt_password").val("");$("#popupWindow_loginPrompt_password").focus()},triggerCallback:function(){this.clearOnHideEvent();userMgr.failCallback=null;if(this.callback!=undefined&&this.callback!=null){this.callback.call(this)}userMgr.callback=null},triggerFailCallback:function(){this.clearOnHideEvent();userMgr.callback=null;if(this.failCallback!=undefined&&this.failCallback!=null){this.failCallback.call(this)}userMgr.failCallback=null},clearOnHideEvent:function(){if(this.onHideEventIndex!=null&&this.onHideEventIndex!=undefined){eventMgr.onpopupclose.remove(this.onHideEventIndex)}},setupOnHideEvent:function(a){if(this.onHideEventIndex!=null&&this.onHideEventIndex!=undefined){eventMgr.onpopupclose.remove(this.onHideEventIndex)}this.onHideEventIndex=eventMgr.onpopupclose.add(a)},tryRegister:function(){var b=$("#popupWindow_registerPrompt_email");var f=$("#popupWindow_registerPrompt_password");var g=$("#popupWindow_registerPrompt_passwordconfirm");var d=$("#popupWindow_registerPrompt_firstname");var e=$("#popupWindow_registerPrompt_lastname");var a=$("#popupWindow_registerPrompt_company");var h=$("#popupWindow_registerPrompt_phone");var i=$("#popupWindow_registerPrompt_promocode");var c=$("#popupWindow_registerPrompt_errormessage");c.text("Please wait...");c.removeClass("errorText");if(b.val()==""){c.text("Please ensure you entered a valid email address before continuing...");c.addClass("errorText");b.focus();return}if(f.val()==""||f.val()!=g.val()){c.text("Please ensure you provided a password and re-typed it correctly in the 'confirm' field before continuing...");c.addClass("errorText");f.focus();return}if(d.val()==""){c.text("Please enter a first name before continuing...");c.addClass("errorText");d.focus();return}if(e.val()==""){c.text("Please enter a last name before continuing...");c.addClass("errorText");e.focus();return}if(h.val()==""){c.text("Please enter a phone number before continuing...");c.addClass("errorText");h.focus();return}xPost(sslUrl+"Wcf/SSLRegister.ashx",{email:b.val(),password:f.val(),firstname:d.val(),lastname:e.val(),company:a.val(),phone:h.val(),promocode:i.val()},function(){specialtys.com.SDProxy.GetAuthResponse(function(j){userMgr.tryRegisterCallback(j)},function(){alert("Oops! Something went wrong, please try again.")})},function(){alert("Oops! Something went wrong, please try again.")})},tryRegisterCallback:function(b){var a=$("#popupWindow_registerPrompt_errormessage");if(b.AuthResponseType==Specialtys.Core.SpecialtysDirect.AuthResponseType.OK){eventMgr.onlogin.triggerWithArg(b);if(userMgr.locationRequired){userMgr.showLocation(userMgr.callback,userMgr.failCallback)}else{userMgr.triggerCallback();popupWindowMgr.hide()}}else{if(b.AuthResponseType==Specialtys.Core.SpecialtysDirect.AuthResponseType.AlreadyRegistered){a.text("Oops! You have previously registered with our system using the email address entered.");a.addClass("errorText")}else{if(b.AuthResponseType==Specialtys.Core.SpecialtysDirect.AuthResponseType.Failed){a.text("ERROR: Internal error, please try again shortly...");a.addClass("errorText")}else{if(b.AuthResponseType==Specialtys.Core.SpecialtysDirect.AuthResponseType.Failed){a.text("ERROR: "+String(b.AuthResponseType));a.addClass("errorText")}}}}},requireHttp:function(b,a){if(sslEnabled!=true){if(b!=undefined&&b!=null){b.call(this)}return true}else{if(a!=undefined&&a!=null){if(confirm("To follow this link this site we need to navigate away from the current page.  If you have not updated product quantities on this page, your changes may not be saved.  Are you sure you want to navigate away from this page?")){window.location.href=baseUrl+a}}return false}},requireHttps:function(b,a){if(sslEnabled==true){if(b!=undefined&&b!=null){b.call(this)}return true}else{if(a!=undefined&&a!=null){if(confirm("To follow this link this site we need to navigate away from the current page.  If you have not updated product quantities on this page, your changes may not be saved.  Are you sure you want to navigate away from this page?")){window.location.href=sslUrl+a}}return false}},logout:function(){specialtys.com.SDProxy.Logout(function(){window.location="Default.aspx"},function(){alert("Oops! Something went wrong, please try again.")})},checkout_checkcart:function(){lunchcartMgr.init(function(){if(lunchcartMgr.itemCount==0){jQuery.get(rU()+"Templates/checkout-empty.htm","",function(a,b){popupWindowMgr.showSmallWindow();popupWindowMgr.content(a)},"text")}else{window.location=sslUrl+"Checkout.aspx"}},function(){alert("Oops! Something went wrong, please try again.")})},checkout:function(a){if(a==true){userMgr.skipUpsell=true}if(userMgr.skipUpsell!=true){userMgr.skipUpsell=true;lunchcartMgr.showUpsellPage()}else{userMgr.init(function(){if(userMgr.authenticated){userMgr.checkout_checkcart()}else{userMgr.login(function(){userMgr.checkout()})}})}},checkoutLite:function(){if(userMgr.skipUpsell!=true){userMgr.skipUpsell=true;lunchcartMgr.showUpsellPage()}else{userMgr.init(function(){if(userMgr.authenticated){window.location=sslUrl+"Checkout.aspx"}else{userMgr.login(function(){userMgr.checkoutLite()})}})}},checkoutproposal_checkcart:function(){lunchcartMgr.init(function(){if(lunchcartMgr.itemCount==0){jQuery.get(rU()+"Templates/checkout-empty.htm","",function(a,b){popupWindowMgr.showSmallWindow();popupWindowMgr.content(a)},"text")}else{window.location="CheckoutProposal.aspx"}})},checkoutproposal:function(){userMgr.init(function(){if(userMgr.authenticated&&userMgr.proposalFeatureEnabled){userMgr.checkoutproposal_checkcart()}else{userMgr.login(function(){userMgr.checkoutproposal()})}})},tryChangePassword:function(){var d=$("#popupWindow_passwordchangePrompt_response");var c=$("#popupWindow_passwordchangePrompt_password");var a=$("#popupWindow_passwordchangePrompt_new_password");var b=$("#popupWindow_passwordchangePrompt_new_password_confirm");if(c.val()==""){d.addClass("errorText");d.text("Oops! Your old password was not entered.");c.focus();return false}if(a.val()==""||b.val()==""){d.addClass("errorText");d.text("Oops! Your new password cannot be blank.");a.focus();return false}if(a.val()!=b.val()){d.addClass("errorText");d.text('Oops! The "new password" and confirm fields did not match. Please re-enter your new password and confirm it.');a.focus();return false}d.removeClass("errorText");d.text("Verifying, please wait...");specialtys.com.SDProxy.ChangeProfilePassword(c.val(),a.val(),b.val(),userMgr.tryChangePasswordCallback,null,null,function(){alert("Oops! Something went wrong, please try again.")})},clearcart:function(){jQuery.get(rU()+"Templates/default-master-empty-cart.htm","",function(a,b){$("#hdrLunchcartP").html(a);$("#lunchcart-header-checkoutBtn").removeClass("btnOrange");$("#lunchcart-header-checkoutBtn").addClass("btnDisabled")},"text")},changePassword:function(){userMgr.requireLogin(userMgr.changePasswordCallback,null)},tryChangePasswordCallback:function(a){var b=$("#popupWindow_passwordchangePrompt_response");switch(a){case Specialtys.Core.SpecialtysDirect.ChangePasswordResponse.InvalidResponse:b.addClass("errorText");b.text("An internal error occured, please try again.");break;case Specialtys.Core.SpecialtysDirect.ChangePasswordResponse.OK:b.removeClass("errorText");b.addClass("successText");b.text("Your password has been changed!");$("#userServicesChangePasswordOkBtn").show();$("#userServicesChangePasswordChangeBtn").hide();$("#userServicesChangePasswordCancelBtn").hide();break;case Specialtys.Core.SpecialtysDirect.ChangePasswordResponse.PasswordDoesNotMatch:b.addClass("errorText");b.text("Your new password must match the confirmed password.");break;case Specialtys.Core.SpecialtysDirect.ChangePasswordResponse.PasswordBlank:b.addClass("errorText");b.text("Your blank passwords are not allowed");break;case Specialtys.Core.SpecialtysDirect.ChangePasswordResponse.PasswordIncorrect:b.addClass("errorText");b.text("Your old password is incorrect");break;default:b.addClass("errorText");b.text("An internal error has occurred, please try again (invalid response).");break}},addBillingAddress:function(){userMgr.requireLogin(function(){userMgr.addBillingAddressCallback()})},updateBillingAddress:function(a){userMgr.requireLogin(function(){userMgr.updateBillingAddressCallback(a)})},addBillingAddressCallback:function(){jQuery.get(rU()+"Templates/userservices-bill-address.htm","",function(a,b){a=a.replace("{header}","Add Billing Address");a=a.replace("{action-onsubmit}","userMgr.tryAddBillingAddress();");a=a.replace("{action-onclick}","userMgr.tryAddBillingAddress();");a=a.replace("{action-name}","Add");a=userMgr.clearBillAddressData(a);popupWindowMgr.content(a);popupWindowMgr.showLargeWindow()},"text")},loadBillingAddressTemplate:function(a){jQuery.get(rU()+"Templates/userservices-bill-address.htm","",function(b,c){b=b.replace("{header}","Edit Billing Address");b=b.replace("{action-onsubmit}","userMgr.tryUpdateBillingAddress();");b=b.replace("{action-onclick}","userMgr.tryUpdateBillingAddress();");b=b.replace("{action-name}","Edit");b=userMgr.bindBillAddressData(b,a);popupWindowMgr.content(b);popupWindowMgr.showLargeWindow()},"text")},updateBillingAddressCallback:function(a){specialtys.com.SDProxy.GetBillingAddress(a,userMgr.loadBillingAddressTemplate,null,null,function(){alert("Oops! Something went wrong, please try again.")})},tryAddBillingAddress:function(){var h=$("#popupWindow_billAddressPrompt_errormessage");var f=$("#popupWindow_billAddressPrompt_address_id");var e=$("#popupWindow_billAddressPrompt_firstname");var g=$("#popupWindow_billAddressPrompt_lastname");var c=$("#popupWindow_billAddressPrompt_email");var i=$("#popupWindow_billAddressPrompt_phone");var j=$("#popupWindow_billAddressPrompt_phoneExt");var b=$("#popupWindow_billAddressPrompt_company");var k=$("#popupWindow_billAddressPrompt_street_address");var m=$("#popupWindow_billAddressPrompt_suite");var d=$("#popupWindow_billAddressPrompt_floor");var a=$("#popupWindow_billAddressPrompt_city");var l=$("#popupWindow_billAddressPrompt_state");var n=$("#popupWindow_billAddressPrompt_zipcode");if(k.val()==""||a.val()==""||k.val()==""||n.val==""){h.text("Street, city, state and zip code are required fields");h.removeClass("hide");return false}if(c.val()!=""){if(!validateEmail(c.val())){h.text("email address is an invalid format");h.removeClass("hide");return false}}specialtys.com.SDProxy.AddBillingAddress(e.val(),g.val(),c.val(),i.val(),j.val(),b.val(),k.val(),d.val(),m.val(),a.val(),l.val(),n.val(),function(){window.location="profile.aspx?view=bill"},null,null,function(){alert("Oops! Something went wrong, please try again.")})},tryUpdateBillingAddress:function(){var g=$("#popupWindow_billAddressPrompt_linkedCC");var i=$("#popupWindow_billAddressPrompt_linkedTA");var j=$("#popupWindow_billAddressPrompt_errormessage");var f=$("#popupWindow_billAddressPrompt_address_id");var e=$("#popupWindow_billAddressPrompt_firstname");var h=$("#popupWindow_billAddressPrompt_lastname");var c=$("#popupWindow_billAddressPrompt_email");var k=$("#popupWindow_billAddressPrompt_phone");var l=$("#popupWindow_billAddressPrompt_phoneExt");var b=$("#popupWindow_billAddressPrompt_company");var m=$("#popupWindow_billAddressPrompt_street_address");var o=$("#popupWindow_billAddressPrompt_suite");var d=$("#popupWindow_billAddressPrompt_floor");var a=$("#popupWindow_billAddressPrompt_city");var n=$("#popupWindow_billAddressPrompt_state");var p=$("#popupWindow_billAddressPrompt_zipcode");if(m.val()==""||a.val()==""||m.val()==""||p.val==""){j.text("Street, city, state and zip code are required fields");j.removeClass("hide");return false}if(c.val()!=""){if(!validateEmail(c.val())){j.text("email address is an invalid format");j.removeClass("hide");return false}}if(i.val()=="true"&&b.val()==""){j.text("Company is required since this bill address is linked to a term account");j.removeClass("hide");return false}specialtys.com.SDProxy.UpdateBillingAddress(parseInt(f.val()),e.val(),h.val(),c.val(),k.val(),l.val(),b.val(),m.val(),d.val(),o.val(),a.val(),n.val(),p.val(),function(){window.location="profile.aspx?view=bill"},null,null,function(){alert("Oops! Something went wrong, please try again.")})},clearBillAddressData:function(a){a=a.replace("{addressid}","");a=a.replace("{first-name}","");a=a.replace("{last-name}","");a=a.replace("{email}","");a=a.replace("{phone}","");a=a.replace("{phone-ext}","");a=a.replace("{company}","");a=a.replace("{street-address}","");a=a.replace("{suite}","");a=a.replace("{floor}","");a=a.replace("{city}","");a=a.replace("{state}","");a=a.replace("{zip}","");a=a.replace("{linkedCC}","");a=a.replace("{linkedTA}","");return a},bindBillAddressData:function(a,b){a=a.replace("{addressid}",b.AddressId);a=a.replace("{first-name}",b.ContactFirstName);a=a.replace("{last-name}",b.ConactLastName);a=a.replace("{email}",b.ContactEmail);a=a.replace("{phone}",b.Telephone);a=a.replace("{phone-ext}",b.TelephoneExt);a=a.replace("{company}",b.ContactCompany);a=a.replace("{street-address}",b.StreetAddress);a=a.replace("{suite}",b.Suite);a=a.replace("{floor}",b.Floor);a=a.replace("{city}",b.City);a=a.replace("{state}",b.State);a=a.replace("{zip}",b.ZipCode);a=a.replace("{linkedCC}",b.LinkedCC);a=a.replace("{linkedTA}",b.LinkedTermAccount);return a},trySendTermAccountCreditIncrease:function(a){specialtys.com.SDProxy.RequestTermAccountIncrease(a,function(){popupWindowMgr.hide()},null,null,function(){alert("Oops! Something went wrong, please try again.")})},sendTermAccountCreditIncrease:function(a){jQuery.get(rU()+"Templates/yesno-confirmation.htm","",function(b,c){b=b.replace("{headerMessage}","Do you want to send a request to increase your limit");b=b.replace("{action-onclick}","userMgr.trySendTermAccountCreditIncrease("+a+");");popupWindowMgr.content(b);popupWindowMgr.showLargeWindow()},"text")},trySendTermAccountStatement:function(a){specialtys.com.SDProxy.SendTermAccountStatement(a,function(b){if(b==false){$("#popupWindow_ConfirmationPrompt_header").text("You do not have access to this account. Please try your request again")}else{popupWindowMgr.hide()}},null,null,function(){alert("Oops! Something went wrong, please try again.")})},sendTermAccountStatment:function(a){jQuery.get(rU()+"Templates/yesno-confirmation.htm","",function(b,c){b=b.replace("{headerMessage}","Do you want request a statment");b=b.replace("{action-onclick}","userMgr.trySendTermAccountStatement("+a+");");popupWindowMgr.content(b);popupWindowMgr.showLargeWindow()},"text")},tryAccountAdd:function(c){var a=$("#popupWindow_addAccountPrompt_response");var b=$("#popupWindow_addAccountPrompt_name");if(b.val()==""){a.addClass("toolTip errorText");a.text("Account name is required");return false}specialtys.com.SDProxy.CreatePrepaidAccount(b.val(),function(d){if(d==0){a.addClass("toolTip errorText");a.text("Your account was not created please try again")}else{window.location=((c==true)?"ProfileAccounts.aspx?command=reloadaccount&account_id="+d:"ProfileAccounts.aspx?view=Prepaid")}},null,null,function(){alert("Oops! Something went wrong, please try again.")})},addAccount:function(){jQuery.get(rU()+"Templates/userservices-add-account.htm","",function(a,b){popupWindowMgr.showSmallWindow();popupWindowMgr.content(a);$("#popupWindow_addAccountPrompt_name").focus()},"text")},tryAddGiftCard:function(){var b=$("#popupWindow_addGiftCardPrompt_response");var d=$("#popupWindow_addGiftCardPrompt_number");var a=$("#popupWindow_addGiftCardPrompt_code");var c=$("#popupWindow_addGiftCardPrompt_name");if(d.val()==""||a.val()==""){b.text("ERROR: Card number and security code required.");b.addClass("toolTip");b.addClass("errorText");return false}specialtys.com.SDProxy.CreateGiftCard(d.val(),a.val(),c.val(),function(e){if(e<=0){b.text("ERROR: Your gift card was not saved. Please check your card details entered and try again.");b.addClass("toolTip");b.addClass("errorText")}else{window.location="ProfileAccounts.aspx?view=GiftCards"}},null,null,function(){alert("Oops! Something went wrong, please try again.")})},addGiftCard:function(){jQuery.get(rU()+"Templates/userservices-add-giftcard.htm","",function(a,b){popupWindowMgr.showMediumWindow();popupWindowMgr.content(a);$("#popupWindow_addAccountPrompt_name").focus()},"text")},tryAddLocation:function(){},addLocation:function(){alert("Comming soon")},tryEditLocation:function(){},editLocation:function(a){alert("Coming soon id:"+a.toString())},tryRequestInvoice:function(){var c=$("#popupWindow_invoiceRequestPrompt_errormessage");var b=$("#popupWindow_invoiceRequestPrompt_lunchbox_id");var a=$("#popupWindow_invoiceRequestPrompt_email");if(b.val()==""){c.text("An internal error has occurred prior to your request. Please close down this window and try it again.");c.addClass("errorText");return false}if(a.val()==""){c.text("Email address cannot be blank.");c.addClass("errorText toolTip");return false}else{if(!validateEmail(a.val())){c.text("Email address is an invalid format.");c.addClass("errorText toolTip");return false}}specialtys.com.SDProxy.RequestInvoice(b.val(),a.val(),function(d){if(d){popupWindowMgr.hide()}else{c.text("An error has occurred, please check your email address and try again.");c.addClass("errorText toolTip")}},null,null,function(){alert("Oops! Something went wrong, please try again.")})},requestInvoice:function(a){jQuery.get(rU()+"Templates/userservices-request-invoice.htm","",function(b,c){b=b.replace("{lunchbox_id}",a);popupWindowMgr.content(b);popupWindowMgr.showSmallWindow()},"text")},changeRequestDateTimeCallBack:function(a,c){$("#popupWindow_changeDatePrompt_DateSelector").append('<option value=""></option>');for(var b=0;b<a.length;b++){if(a[b].IsOpen){$("#popupWindow_changeDatePrompt_DateSelector").append('<option value="'+a[b].DateValue+'">'+a[b].FriendlyDateDescription+"</option>")}}$("#popupWindow_changeDatePrompt_TimeSelector").append('<option value="">-- no times available for this day --</option>')},changeRequestDateTime:function(a){jQuery.get(rU()+"Templates/userservices-change-request-date.htm","",function(b,c){b=b.replace("{lunchbox_id}",a);popupWindowMgr.content(b);popupWindowMgr.showSmallWindow();specialtys.com.SDProxy.LoadStoreOpenDatesByLunchbox(a,userMgr.changeRequestDateTimeCallBack,null,a,function(){alert("Oops! Something went wrong, please try again.")})},"text")},changeRequestDateTime_DateSelectorCallBack:function(b){$("#popupWindow_changeDatePrompt_TimeSelector").children("option").each(function(){$(this).remove()});for(var a=0;a<b.length;a++){$("#popupWindow_changeDatePrompt_TimeSelector").append('<option value="'+b[a].WindowStartMins+'">'+b[a].FriendlyTimeSlotDescription+"</option>")}if($("#popupWindow_changeDatePrompt_TimeSelector").children().length==0){$("#popupWindow_changeDatePrompt_TimeSelector").append('<option value="">-- no times available for this day --</option>')}},changeRequestDateTime_DateSelector:function(){var b=$("#popupWindow_changeDatePrompt_lunchbox_id");var a=$("#popupWindow_changeDatePrompt_DateSelector");if(a.val()!=""){specialtys.com.SDProxy.LoadLunchboxTimes(b.val(),a.val(),userMgr.changeRequestDateTime_DateSelectorCallBack,null,null,function(){alert("Oops! Something went wrong, please try again.")})}},tryChangeRequestDateTimeCallBack:function(b){var a=$("#popupWindow_changeDatePrompt_errormessage");switch(b){case -2:a.text("You do not have access to this feature please login again");a.removeClass("hide");break;case -1:a.text("An internal error has occurred please try again");a.removeClass("hide");break;case 0:popupWindowMgr.hide();window.location="ProfileOrders.aspx?view=Open";break;case 666:a.text("Date and time not updated");break;case 667:a.text("Your order has already printed in our store please contact customer service");break}},tryEmailReminderCallback:function(b){var a=$("#popupWindow_loginPrompt_response");if(b){a.text("An email containing instructions on how to reset your password has been sent to your email address.");$("#popupWindow_loginPrompt_email_reminder").attr("disabled","disabled");$("#resetPasswordBtn").addClass("hide");$("#okPasswordBtn").removeClass("hide")}else{a.text("The email address you entered is not registered with Specialtys.com.")}},tryEmailReminder:function(){var a=$("#popupWindow_loginPrompt_email_reminder");if(a.val()!=""){specialtys.com.SDProxy.SendTemporaryPassword(a.val(),userMgr.tryEmailReminderCallback,null,null,function(){alert("Oops! Something went wrong, please try again.")})}},tryChangeRequestDateTime:function(){var b=$("#popupWindow_changeDatePrompt_lunchbox_id");var a=$("#popupWindow_changeDatePrompt_DateSelector");var c=$("#popupWindow_changeDatePrompt_TimeSelector");if(a.val()!=""&&c.val()!=""&&b.val()!=""){specialtys.com.SDProxy.SetLunchboxTime(b.val(),a.val(),c.val(),userMgr.tryChangeRequestDateTimeCallBack,null,null,function(){alert("Oops! Something went wrong, please try again.")})}},deleteLunchcart:function(b,a){userMgr.requireCustomerId(function(){specialtys.com.SDProxy.DeleteLunchcart(b,function(){if(a!=null&&a!=undefined){a.call(this)}},function(){alert("Oops! Something went wrong, please try again.")})})},copyLunchbox:function(b,a){userMgr.requireCustomerId(function(){specialtys.com.SDProxy.CopyLunchbox(b,function(){if(a!=null&&a!=undefined){a.call(this)}},function(){alert("Oops! Something went wrong, please try again.")})})},resumeLunchcart:function(b,a){userMgr.requireCustomerId(function(){specialtys.com.SDProxy.ResumeLunchcart(b,function(){if(a!=null&&a!=undefined){a.call(this)}},function(){alert("Oops! Something went wrong, please try again.")})})},addProductToFavs:function(b,a){userMgr.requireCustomerId(function(){specialtys.com.SDProxy.AddFavoriteProduct(b,function(){if(a!=null&&a!=undefined){a.call(this)}},function(){alert("Oops! Something went wrong, please try again.")})})},showBetaMsg:function(){jQuery.get(rU()+"Templates/beta-intro.htm","",function(a,b){popupWindowMgr.content(a);popupWindowMgr.showMediumWindow()},"text")},showFeedbackForm:function(){jQuery.get(rU()+"Templates/userservices-feedback-0.1.htm","",function(a,b){popupWindowMgr.content(a);popupWindowMgr.showLargeWindow()},"text")},sendFeedback:function(){var d=$("#userServices-feedback-name").attr("value");var c=$("#userServices-feedback-email").attr("value");var f=$("#userServices-feedback-type").attr("value");var e=$("#userServices-feedback-subject").attr("value");var a=$("#userServices-feedback-comments").attr("value");var b=true;if(c==""){$("#intro").text('Oops! The "name" field is required for feedback.').addClass("errorText");b=false}if(d==""){$("#intro").text('Oops! The "name" field is required for feedback.').addClass("errorText");b=false}if(f==""){$("#intro").text('Oops! The "feedback type" option must be specified.').addClass("errorText");b=false}if(e==""){$("#intro").text('Oops! The "subject" field is required for feedback.').addClass("errorText");b=false}if(a==""){$("#intro").text('Oops! The "comments" field is required for feedback.').addClass("errorText");b=false}if(b){specialtys.com.SDProxy.SendFeedback(d,c,f,e,a,function(){$("#userServices-feedback-form").hide();$("#userServices-feedback-response").show()},function(){alert("Oops! Something went wrong, please try again.")})}},changePagerNumber:function(a){userPagerMgr.init(a)},updatePagerNumber:function(b,a){specialtys.com.SDProxy.UpdateCustomerPagerNumber(b,function(){a()},function(){alert("Oops! Something went wrong, please try again.")})}};var userPagerMgr={callback:null,init:function(a){this.callback=a;jQuery.get(rU()+"Templates/userservices-pager.htm","",function(b,c){popupWindowMgr.content(b);popupWindowMgr.showSmallWindow()},"text")}};var productMgr={windowMgr:null,productId:0,product:null,checkoutEventRef:null,setup:function(a){this.windowMgr=a},getProductType:function(a){var b=a.ProductTypeId;if(b==100||b==101){return"Sandwich"}if(b==110||b==111){return"Salad"}if(b==115||b==116){return"Salad"}if(b==152||b==153){return"Breakfast Sandwich"}return"Item"},getEmailSubject:function(a){return encodeURI("Specialty's "+productMgr.getProductType(a)+': "'+a.Name+'"')},getEmailBody:function(a){return encodeURI("I wanted to share this "+productMgr.getProductType(a).toLowerCase()+" with you: "+baseUrl+"P.aspx?p="+a.ProductRelationHash+'\n\n--- \n\n"'+a.Name+'"\n'+a.Description)},showRename:function(a){jQuery.get(rU()+"Templates/productservices-rename.htm","",function(b,c){productMgr.windowMgr.content(b);productMgr.windowMgr.showSmallWindow();specialtys.com.SDProxy.LoadProduct(a,function(d){productMgr.renderRename(d)})},"text");gaMgr.track("Rename Product Window","Open Window")},renderRename:function(a){this.product=a;$("#productServices-rename-oldName").attr("value",a.Name);$("#productServices-rename-newName").attr("value",a.Name);$("#productServices-rename-newName").focus()},renameProduct:function(){var b=$("#productServices-rename-oldName").attr("value");var a=$("#productServices-rename-newName").attr("value");if(b==a){popupWindowMgr.hide()}else{this.product.Name=a;specialtys.com.SDProxy.RenameProduct(this.product,function(){popupWindowMgr.hide();eventMgr.onloadcart.trigger();gaMgr.track("Rename Product Window","Success")})}},showFavorites:function(){depMgr.loadWithCallback("JScript/productservices-favorites-0.2.js",function(){jQuery.get(rU()+"Templates/productservices-favorites.htm","",function(a,b){productMgr.windowMgr.content(a);productMgr.windowMgr.showLargeWindow();favMgr.initFavorites()},"text");gaMgr.track("My Favorites Window","Open Window")},"favMgr")},showFriendsFavorites:function(){depMgr.loadWithCallback("JScript/productservices-favorites-0.2.js",function(){fbMgr.isConnected(function(){jQuery.get(rU()+"Templates/productservices-favorites.htm","",function(a,b){productMgr.windowMgr.content(a);productMgr.windowMgr.showLargeWindow();favMgr.initFriendsFavorites()},"text")});gaMgr.track("Friend's Favorites Window","Open Window")},"favMgr")},addFavoriteToCart:function(a,b){eventMgr.onaddtocart.add(function(){$("#favorite-checkoutBtn").removeClass();$("#favorite-checkoutBtn").addClass("btnTextLg btnOrangeLg ")});lunchcartMgr.addToCart(a,b)},showInfo:function(a){depMgr.loadWithCallback("JScript/productservices-info-0.3.js",function(){jQuery.get(rU()+"Templates/productservices-info.htm","",function(b,c){productMgr.windowMgr.content(b);productMgr.windowMgr.showMediumWindow();productInfoMgr.init(a)},"text");gaMgr.track("Product Info Window","Open Window")},"productInfoMgr")},showIngredientInfo:function(a){depMgr.loadWithCallback("JScript/productservices-info-0.3.js",function(){jQuery.get(rU()+"Templates/productservices-info.htm","",function(b,c){productMgr.windowMgr.content(b);productMgr.windowMgr.showMediumWindow();productInfoMgr.initForIngredient(a)},"text");gaMgr.track("Ingredient Info Window","Open Window")},"productInfoMgr")},showEditor:function(a,b){depMgr.loadWithCallback("JScript/productservices-editor-0.3.js",function(){productMgr.productId=a;jQuery.get(rU()+"Templates/productservices-editor.htm","",function(c,d){productMgr.windowMgr.content(c);productMgr.windowMgr.showLargeWindow();productMgr.paletteMenuMgr=new AccordionMenu("productServices-editor-palette");productEditorMgr.init(productMgr.productId,b)},"text")},"productEditorMgr");gaMgr.track("Product Editor Window","Open Window")},deleteFavorite:function(a){specialtys.com.SDProxy.DeleteFavoriteProduct(a);$("#listGalleryFavoritesItem_"+a).fadeOut("fast")},addFavorite:function(b,a){specialtys.com.SDProxy.AddFavoriteProduct(b,function(){if(a!=undefined&&a!=null){a.call(this)}})},isSalad:function(a){if(a==110||a==111||a==115||a==116){return true}return false}};var twitMgr={callback:null,isConnected:function(a){specialtys.com.SDProxy.IsTwitterConnected(function(b){if(b==true){a.call(this)}else{twitMgr.connect()}})},connect:function(a){twitMgr.callback=a;jQuery.get(rU()+"Templates/socialservices-connect-twitter.htm","",function(b,c){productMgr.windowMgr.content(b);productMgr.windowMgr.showSmallWindow();twitMgr.connectInit()},"text");gaMgr.track("Twitter Connect Window","Open Window")},connectInit:function(){specialtys.com.SDProxy.GetTwitterConnectUrl(function(a){$("#popupWindow_twitConnectBtn").click(function(){window.open(a,"twitConnectWindow","width=800,height=420,noresize,scrollbars=no")})})},connectCallback:function(){twitMgr.close();if(twitMgr.callback!=null&&this.callback!=undefined){twitMgr.callback.call(this)}gaMgr.track("Twitter Connect Window","Success")},renderShareProduct:function(a){$("#twitShare_userTxt").attr("value","Wanted to share the "+productMgr.getProductType(a).toLowerCase()+' "'+a.Name+'" available from Specialtys.com.');$("#popupWindow_twitShareBtn").attr("href","javascript:twitMgr.shareProductToStream('"+a.ProductRelationHash+"')");$("#popupWindow_twitShareBtn_text").html("share via twitter")},initShareProduct:function(a){specialtys.com.SDProxy.LoadProductUsingRelation(a,function(b){twitMgr.renderShareProduct(b)})},shareProduct:function(a){jQuery.get(rU()+"Templates/twitter-share.htm","",function(b,c){popupWindowMgr.content(b);popupWindowMgr.showSmallWindow();twitMgr.initShareProduct(a)},"text");gaMgr.track("Twitter Share Product Window","Open Window")},shareProductToStream:function(b){var a=$("#twitShare_userTxt").val();$("#popupWindow_twitShareBtn").attr("href","javascript:void(0)");$("#popupWindow_twitShareBtn_text").html("please wait...");specialtys.com.SDProxy.ShareProductViaTwitter(b,a,function(){twitMgr.close();gaMgr.track("Twitter Share Product Window","Success")},function(){alert("ERROR: Something went wrong.");twitMgr.initShareProduct(b);gaMgr.track("Twitter Share Product Window","Failed")})},renderShareGroupLunchbox:function(a){$("#twitShare_userTxt").attr("value","Let's get together at specialtys ");$("#popupWindow_twitShareBtn").attr("href","javascript:twitMgr.shareGrouplunchboxToStream('"+a.GroupLunchboxHash+"')");$("#popupWindow_twitShareBtn_text").html("share via twitter")},initShareGroupLunchbox:function(a){specialtys.com.SDProxy.LoadGroupLunchbox(a,function(b){twitMgr.renderShareGroupLunchbox(b)})},shareGroupLunchbox:function(a){jQuery.get(rU()+"Templates/twitter-share.htm","",function(b,c){popupWindowMgr.content(b);popupWindowMgr.showSmallWindow();twitMgr.initShareGroupLunchbox(a)},"text");gaMgr.track("Twitter Share Group Lunchbox Window","Open Window")},shareGrouplunchboxToStream:function(b){var a=$("#twitShare_userTxt").val();$("#popupWindow_twitShareBtn").attr("href","javascript:void(0)");$("#popupWindow_twitShareBtn_text").html("please wait...");specialtys.com.SDProxy.ShareGroupLunchboxViaTwitter(b,a,function(){twitMgr.close();gaMgr.track("Twitter Share Group Lunchbox Window","Success")},function(){alert("ERROR: Something went wrong.");twitMgr.initShareProduct(b);gaMgr.track("Twitter Share Group Lunchbox Window","Failed")})},renderShareFavorite:function(a){$("#twitShare_userTxt").attr("value","Wanted to share a "+productMgr.getProductType(a).toLowerCase()+' masterpiece "'+a.Name+'" created at Specialtys.com.');$("#popupWindow_twitShareBtn").attr("href","javascript:twitMgr.shareFavoriteToStream('"+a.FavoriteHash+"')")},shareFavorite:function(a){jQuery.get(rU()+"Templates/twitter-share.htm","",function(b,c){popupWindowMgr.content(b);popupWindowMgr.showSmallWindow();twitMgr.initShareFavorite(a)},"text");gaMgr.track("Twitter Share Favorite Window","Open Window")},initShareFavorite:function(a){specialtys.com.SDProxy.LoadFavorite(a,function(b){twitMgr.renderShareFavorite(b)})},shareFavoriteToStream:function(b){var a=$("#twitShare_userTxt").val();$("#popupWindow_twitShareBtn").attr("href","javascript:void(0)");$("#popupWindow_twitShareBtn_text").html("please wait...");specialtys.com.SDProxy.ShareFavoriteViaTwitter(b,a,function(){twitMgr.close();gaMgr.track("Twitter Share Favorite Window","Success")},function(){alert("ERROR: Something went wrong.");twitMgr.initShareFavorite(b);gaMgr.track("Twitter Share Favorite Window","Failed")})},close:function(){popupWindowMgr.hide()}};var fbMgr={callback:null,ifConnected:function(a){specialtys.com.SDProxy.IsFacebookConnected(function(b){if(b==true){a.call(this)}})},isConnected:function(a){specialtys.com.SDProxy.IsFacebookConnected(function(b){if(b==true){a.call(this)}else{fbMgr.connect(a)}})},isConnectedVerified:function(a){specialtys.com.SDProxy.IsFacebookConnectedVerified(function(b){if(b==true){a.call(this)}else{fbMgr.connect(a)}})},connect:function(a){fbMgr.callback=a;jQuery.get(rU()+"Templates/socialservices-connect-facebook.htm","",function(b,c){productMgr.windowMgr.content(b);productMgr.windowMgr.showSmallWindow();fbMgr.connectInit()},"text");gaMgr.track("Facebook Connect Window","Open Window")},connectInit:function(){specialtys.com.SDProxy.GetFacebookConnectUrl(function(a){$("#popupWindow_fbConnectBtn").click(function(){window.open(a,"fbConnectWindow","width=500,height=450,noresize,scrollbars=no")})})},connectCallback:function(){fbMgr.close();if(fbMgr.callback!=null&&this.callback!=undefined){fbMgr.callback.call(this)}gaMgr.track("Facebook Connect Window","Success")},renderShareProduct:function(a){$("#fbShare_streamTitle").html("Specialty's "+productMgr.getProductType(a)+': "'+a.Name+'"');$("#fbShare_streamCaption").html(userMgr.firstName+" wanted to share a "+productMgr.getProductType(a).toLowerCase()+" available from Specialtys.com");$("#fbShare_streamDesc").html(a.Description);$("#fbShare_streamExtraTxt").hide();$("#fbShare_streamImg").attr("src","Images/ProdImg/80x80/"+a.ImageId+".jpg");$("#popupWindow_fbShareBtn").attr("href","javascript:fbMgr.shareProductToStream('"+a.ProductRelationId+"')");$("#popupWindow_fbShareBtn_text").html("share via facebook")},initShareProduct:function(a){specialtys.com.SDProxy.LoadProductUsingRelation(a,function(b){fbMgr.renderShareProduct(b)})},shareProduct:function(a){jQuery.get(rU()+"Templates/facebook-share.htm","",function(b,c){popupWindowMgr.content(b);popupWindowMgr.showMediumWindow();fbMgr.initShareProduct(a)},"text");gaMgr.track("Facebook Share Product Window","Open Window")},shareProductToStream:function(b){var a=$("#fbShare_userTxt").val();$("#popupWindow_fbShareBtn").attr("href","javascript:void(0)");$("#popupWindow_fbShareBtn_text").html("please wait...");specialtys.com.SDProxy.ShareProductViaFacebook(b,a,function(){fbMgr.close();gaMgr.track("Facebook Share Product Window","Success")},function(){alert("ERROR: Something went wrong.");fbMgr.initShareProduct(b);gaMgr.track("Facebook Share Product Window","Failed")})},renderShareFavorite:function(a){$("#fbShare_streamTitle").html("Favorite "+productMgr.getProductType(a)+': "'+a.Name+'"');$("#fbShare_streamCaption").html(userMgr.firstName+" wanted to share a "+productMgr.getProductType(a).toLowerCase()+" masterpiece created at Specialtys.com");$("#fbShare_streamDesc").html('"'+(a.IsReadOnly?a.Description:a.FriendlyIngredientDescription)+'"');$("#fbShare_streamExtraTxt").hide();$("#fbShare_streamImg").attr("src","ProdImg.ashx?w=80&f="+a.FavoriteHash);$("#popupWindow_fbShareBtn").attr("href","javascript:fbMgr.shareFavoriteToStream('"+a.FavoriteHash+"')")},shareFavorite:function(a){jQuery.get(rU()+"Templates/facebook-share.htm","",function(b,c){popupWindowMgr.content(b);popupWindowMgr.showMediumWindow();fbMgr.initShareFavorite(a)},"text");gaMgr.track("Facebook Share Favorite Window","Open Window")},initShareFavorite:function(a){specialtys.com.SDProxy.LoadFavorite(a,function(b){fbMgr.renderShareFavorite(b)})},shareFavoriteToStream:function(b){var a=$("#fbShare_userTxt").val();$("#popupWindow_fbShareBtn").attr("href","javascript:void(0)");$("#popupWindow_fbShareBtn_text").html("please wait...");specialtys.com.SDProxy.ShareFavoriteViaFacebook(b,a,function(){fbMgr.close();gaMgr.track("Facebook Share Favorite Window","Success")},function(){alert("ERROR: Something went wrong.");fbMgr.initShareFavorite(b);gaMgr.track("Facebook Share Favorite Window","Failed")})},renderShareGroupLunchbox:function(a){$("#fbShare_streamTitle").html("Let's get togther at Specialtys");$("#fbShare_streamCaption").html('"'+userMgr.firstName+' would like to arange a get together"');$("#fbShare_streamDesc").html("on:"+a.DateRequested+"at "+a.Location);if(a.descritption!=null){$("#fbShare_streamExtraTxt").html(a.descritption)}else{$("#fbShare_streamExtraTxt").hide()}$("#popupWindow_fbShareBtn").attr("href","javascript:fbMgr.shareGrouplunchboxToStream('"+a.GroupLunchboxHash+"')")},shareGroupLunchbox:function(a){jQuery.get(rU()+"Templates/facebook-share-group-lunchbox.htm","",function(b,c){popupWindowMgr.content(b);popupWindowMgr.showMediumWindow();fbMgr.initShareGroupLunchbox(a)},"text");gaMgr.track("Facebook Share Group Lunchbox Window","Open Window")},initShareGroupLunchbox:function(a){specialtys.com.SDProxy.LoadGroupLunchbox(a,function(b){fbMgr.renderShareGroupLunchbox(b)})},shareGrouplunchboxToStream:function(b){var a=$("#fbShare_userTxt").val();$("#popupWindow_fbShareBtn").attr("href","javascript:void(0)");$("#popupWindow_fbShareBtn_text").html("please wait...");specialtys.com.SDProxy.ShareGroupLunchboxViaFacebook(b,a,function(){fbMgr.close();gaMgr.track("Facebook Share Group Lunchbox  Window","Success")},function(){alert("ERROR: Something went wrong.");fbMgr.initShareGroupLunchbox(b);gaMgr.track("Facebook Share Group Lunchbox Window","Failed")})},lbName:function(a){if(a==0){return"Overall"}if(a==1){return"Sandwich"}if(a==2){return"Salad"}if(a==3){return"Soup"}if(a==4){return"Cookie"}},lbTitle:function(a){if(a==0){return"Overall Specialty's Best Fan"}if(a==1){return"Specialty's Best Sandwich Fan"}if(a==2){return"Specialty's Best Salad Fan"}if(a==3){return"Specialty's Best Soup Fan"}if(a==4){return"Specialty's Best Cookie Fan"}},renderShareBestFanScore:function(c,f,b){userMgr.initFromCookie();var a=new Date();var e=new Array(12);e[0]="January";e[1]="February";e[2]="March";e[3]="April";e[4]="May";e[5]="June";e[6]="July";e[7]="August";e[8]="September";e[9]="October";e[10]="November";e[11]="December";$("#fbShare_streamTitle").html(fbMgr.lbTitle(c));$("#fbShare_streamCaption").html(userMgr.firstName+" wanted to share (brag) about their Specialty's Fan Score...");if(f=="lifetime"){$("#fbShare_streamDesc").html(fbMgr.lbTitle(c)+" Score: "+b.Score+" lifetime points")}else{$("#fbShare_streamDesc").html(fbMgr.lbTitle(c)+" Score: "+b.CurrentPeriodScore+" points accumulated so far for the month of "+e[a.getMonth()]+", "+a.getFullYear()+".")}$("#fbShare_streamExtraTxt").hide();$("#fbShare_streamImg").attr("src","Images/BestFan/position_"+b.LeaderboardPosition+".jpg");$("#popupWindow_fbShareBtn").attr("href","javascript:fbMgr.shareBestFanScoreToStream("+c+", '"+f+"')");$("#fbShare_linkTitle").html("Calculate & Compare Your Score");$("#popupWindow_fbShareBtn_text").html("share via facebook")},shareBestFanScore:function(a,b){jQuery.get(rU()+"Templates/facebook-share.htm","",function(c,d){popupWindowMgr.content(c);popupWindowMgr.showMediumWindow();fbMgr.initShareBestFanScore(a,b)},"text");gaMgr.track("Facebook Share Fan Score Window","Open Window")},initShareBestFanScore:function(a,b){specialtys.com.SDProxy.LoadBestFanScore(a,function(c){fbMgr.renderShareBestFanScore(a,b,c)})},shareBestFanScoreToStream:function(b,d){var a=$("#fbShare_userTxt").val();$("#popupWindow_fbShareBtn").attr("href","javascript:void(0)");$("#popupWindow_fbShareBtn_text").html("please wait...");specialtys.com.SDProxy.ShareBestFanScoreViaFacebook(b,d,a,function(){fbMgr.close();gaMgr.track("Facebook Share Fan Score Window","Success")},function(){alert("ERROR: Something went wrong.");fbMgr.shareBestFanScore();gaMgr.track("Facebook Share Fan Score Window","Failed")})},close:function(){popupWindowMgr.hide()}};var beetMgr={windowMgr:popupWindowMgr,map:null,cellId:null,mapDivId:null,pageMapDivId:null,setup:function(a){this.windowMgr=a},showSSLError:function(a){alert("Sorry, this function is not available in SSL mode."+((a==undefined)?"":" "+a))},showDeliveryZoneMap:function(){gMgr.loadWithMaps(function(){depMgr.loadWithCallback("JScript/beetservices-gmap-0.2.js",function(){if(!GBrowserIsCompatible()){beetMgr.showSSLError("showDeliveryZoneMap()");return}beetMgr.windowMgr.showLargeWindow();jQuery.get(rU()+"Templates/beetservices-delivery-zones.htm","",function(a,b){beetMgr.windowMgr.content(a);beetMgr.initGMap("beetServices-delivery-zones-gMap");beetMgr.map.setSize("medium");beetMgr.initDeliveryZoneMap();beetMgr.map.map.setCenter(new GLatLng(37.583766,-121.959229),9)},"text")},"BeetGMap")})},initDeliveryZoneMap:function(){specialtys.com.SDProxy.LoadDeliveryRegionCoordStream(function(b){var d=new Array();var c=null;var a=0;d.push(new BeetDeliveryRegion());for(var e=0;e<b.length;e++){if(d[a].id!=b[e].DeliveryRegionId&&e>0){d.push(new BeetDeliveryRegion());a++}d[a].id=b[e].DeliveryRegionId;d[a].deliveryFeeModelId=b[e].DeliveryFeeModelId;d[a].pointArr.push([b[e].GpsLat,b[e].GpsLong]);d[a].active=true}beetMgr.map.addDeliveryRegionArrayToMap(d,true)})},showLocationSelector:function(b,a){depMgr.loadWithCallback("JScript/beetservices-location-selector-0.4.js",function(){jQuery.get(rU()+"Templates/beetservices-location-selector-0.0.htm","",function(c,d){beetMgr.windowMgr.content(c);beetMgr.windowMgr.showMediumWindow();beetLocMgr.init(b,a)},"text")},"beetLocMgr");gaMgr.track("Location Selector Window","Open Window")},showAddDeliveryLocation:function(a,b){depMgr.loadWithCallback("JScript/beetservices-add-delivery-location-0.4.js",function(){jQuery.get(rU()+"Templates/beetservices-add-delivery-location-0.3.htm","",function(c,d){beetMgr.windowMgr.content(c);beetMgr.windowMgr.showMediumWindow();beetAddDelLocMgr.init(a,b)},"text")},"beetAddDelLocMgr");gaMgr.track("Add Delivery Location Window","Open Window")},showCookieAlert:function(){depMgr.loadWithCallback("JScript/beetservices-cookiealert-0.1.js",function(){productMgr.windowMgr.showLargeWindow();jQuery.get(rU()+"Templates/beetservices-cookiealert.htm","",function(a,b){beetMgr.windowMgr.content(a);cookieAlertMgr.init()},"text")},"cookieAlertMgr");gaMgr.track("CookieAlert Window","Open Window")},showCookieRadar:function(){if(!userMgr.requireHttp(null,"CookieRadar.aspx")){return}gMgr.loadWithMaps(function(){depMgr.loadWithCallback("JScript/beetservices-gmap-0.2.js",function(){depMgr.loadWithCallback("JScript/beetservices-cookieradar-0.2.js",function(){if(!GBrowserIsCompatible()){beetMgr.showSSLError("showCookieRadar()");return}beetMgr.windowMgr.showLargeWindow();jQuery.get(rU()+"Templates/beetservices-cookieradar.htm","",function(a,b){beetMgr.windowMgr.content(a);cookieRadarMgr.init()},"text")},"cookieRadarMgr")},"BeetGMap")});gaMgr.track("CookieRadar Window","Open Window")},showStore:function(a){if(!userMgr.requireHttp(null,"Stores.aspx")){return}gMgr.loadWithMaps(function(){depMgr.loadWithCallback("JScript/beetservices-gmap-0.2.js",function(){if(!GBrowserIsCompatible()){beetMgr.showSSLError("showStore()");return}beetMgr.cellId=a;beetMgr.windowMgr.showLargeWindow();jQuery.get(rU()+"Templates/beetservices-gmap.htm","",function(b,c){beetMgr.windowMgr.content(b);beetMgr.initGMap("beetServices-gMap-window");beetMgr.map.setSize("medium");specialtys.com.SDProxy.LoadStores(beetMgr.renderStores,null,{highlightedCellId:a,autoOpenHighlightedWindow:true})},"text")},"BeetGMap")});gaMgr.track("Show Store Window","Open Window")},renderStores:function(b,a){var d=(cookieMgr.getKioskTypeFromCookie()==3);for(var c=0;c<b.length;c++){var e=new BeetStore();e.id=b[c].CellId;e.buildingId=b[c].BuildingId;e.streetName=b[c].StreetName;e.streetNumber=b[c].StreetNumber;e.latitude=b[c].GpsLat;e.longitude=b[c].GpsLong;e.city=b[c].City;e.state=b[c].State;e.zip=b[c].Zip;e.openTimesHTML=b[c].FriendlyOpenTimesHtml;if(d){e.pickupFlag=0;e.favBtnFlag=false}else{e.pickupFlag=b[c].PickupFlag}e.priorityPickupStatus=b[c].PriorityPickupStatus;e.highlighted=false;if(b[c].CellId==beetMgr.cellId){e.active=false;e.highlighted=true}beetMgr.map.addStoreToMap(e)}for(var c=0;c<beetMgr.map.storeArr.length;c++){if(beetMgr.map.storeArr[c].highlighted==true){beetMgr.map.storeArr[c].centerOnMap(beetMgr.map);var e=beetMgr.map.storeArr[c]}}},initGMap:function(a){this.mapDivId=a;this.map=new BeetGMap(document.getElementById(this.mapDivId))},renderStore:function(b,a){var c=new BeetStore();c.id=b.CellId;c.streetName=b.StreetName;c.streetNumber=b.StreetNumber;c.latitude=b.GpsLat;c.longitude=b.GpsLong;c.city=b.City;c.state=b.State;c.zip=b.Zip;c.highlighted=false;beetMgr.map.addStoreToMap(c);beetMgr.map.zoomToFit()},addFavoritePickupLocation:function(a,b){specialtys.com.SDProxy.AddFavoritePickupLocation(a,function(){b.call(this)})},selectPickupLocation:function(a,b){specialtys.com.SDProxy.SetPickupLocation(a,function(){if(b!=undefined){b.call(this)}})},addFavoritePickupLocation:function(a,b){specialtys.com.SDProxy.AddFavoritePickupLocation(a,function(){if(b!=undefined){b.call(this)}})}};eventMgr.onlogin.add(function(a){if(a.AuthResponseType==Specialtys.Core.SpecialtysDirect.AuthResponseType.OK||a.AuthResponseType==Specialtys.Core.SpecialtysDirect.AuthResponseType.OKPasswordChangeRequired){jQuery.get(rU()+"Templates/default-master-login.htm","",function(b,d){var e=new Date();var c=e.getHours()<12?"Good Morning, ":e.getHours()<17?"Good Afternoon, ":"Good Evening, ";c=c+" "+a.FirstName+".";b=b.replace("{greeting}",c);$("#hdrLogin").html(b)},"text")}});eventMgr.onaddtocart.add(function(a,b){var c=$("#header_items");var d=$("#header_total");if(c.length==0){jQuery.get(rU()+"Templates/default-master-nonempty-cart.htm","",function(e,f){e=e.replace("{items}",b.Quantity);e=e.replace("{total}","$"+(parseFloat(b.Quantity)*a.Price).toFixed(2));$("#hdrLunchcartP").html(e);$("#lunchcart-header-checkoutBtn").removeClass("btnDisabled");$("#lunchcart-header-checkoutBtn").addClass("btnOrange")},"text")}else{c.text(parseInt(c.text())+parseInt(b.Quantity));d.text("$"+(parseFloat(String(d.text()).replace("$",""))+(parseFloat(b.Quantity)*a.Price)).toFixed(2))}});eventMgr.onremovefromcart.add(function(b,a){var c=$("#header_items");var d=$("#header_total");c.text(parseInt(c.text())-parseInt(b));d.text("$"+(parseFloat(String(d.text()).replace("$",""))-(parseFloat(b)*a.Price)).toFixed(2));if(parseInt(c.text())==0){userMgr.clearcart()}});eventMgr.onupdateqtyincart.add(function(c,b){var d=$("#header_items");var e=$("#header_total");d.text("0");e.text("0.00");for(var a=0;a<b.length;a++){d.text(parseInt(d.text())+parseInt(b[a].Quantity));e.text((parseFloat(e.text())+(parseFloat(b[a].Quantity)*b[a].Price)).toFixed(2))}});
