function showAndHide(a,b){hide(b);show(a)}function show(a){$("#"+a).show()}function hide(a){$("#"+a).hide()}function getCookie(a){if(document.cookie.length>0){c_start=document.cookie.indexOf(a+"=");if(c_start!=-1){c_start=c_start+a.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return""}function setCookie(a,d,b){var e=new Date();e.setDate(e.getDate()+b);var c=escape(d)+((b==null)?"":"; expires="+e.toUTCString());document.cookie=a+"="+c}function loadTextBoxDefaults(){$(document).ready(setDefaultInputValues);$("search-nav-form").submit(clearInputDefaultValues)}function setDefaultInputValues(){$(".active").focus(function(a){if($(this).val()==$(this)[0].title){$(this).removeClass("inactive");$(this).val("")}});$(".active").blur(function(){if($(this).val()==""){$(this).addClass("inactive");$(this).val($(this)[0].title)}});$(".active").blur()}function clearInputDefaultValues(){$(".active").each(function(){if($(this).val()==$(this).title){$(this).val("")}})}var loginObserver={};var successCallback;var loginCompleteCallback;function loginPopup(b,a,e){var d=secureURL(b,a);var c=$("#loginEmail").val();$.ajax({url:d,data:$("#loginForm").serialize(),success:function(g){var i=(g.indexOf("incompleteProfile=true")>0);var h=g.indexOf("Logout")>0;var f=e.indexOf("customize.htm")>0;if(h&&(i&&!f)){document.getElementById("loginBlock").innerHTML=g;disablePopup();refreshProductBuilderUser();if(document.getElementById("rememberMeCheckbox").checked){setCookie("lastLoggedInUser",c,365)}else{setCookie("lastLoggedInUser","",365)}window.location=secureURL("/updateInfo.htm",a)}else{if(h){document.getElementById("loginBlock").innerHTML=g;if(g.indexOf("userStoreAddress")>0){$(".site-partner-tagline").html($("#userStoreAddress").html())}disablePopup();refreshProductBuilderUser();if(document.getElementById("rememberMeCheckbox").checked){setCookie("lastLoggedInUser",c,365)}else{setCookie("lastLoggedInUser","",365)}if(typeof successCallback=="function"){successCallback()}$(loginObserver).trigger("success",g);if(typeof loginCompleteCallback=="function"){loginCompleteCallback()}}else{document.getElementById("lrContent").innerHTML=g;$("input#loginEmail").val(c);$("input#loginPassword").focus();loadTextBoxDefaults();$(loginObserver).trigger("failure",g)}}},dataType:"html",type:"POST",xhr:function(){var f=new XMLHttpRequest();f.onreadystatechange=function(){if(f.readyState==1){f.withCredentials="true"}};return f}})}function setLoginCompleteCallback(a){loginCompleteCallback=a}function secureURL(e,a){var d=document.URL;var c=d.toString().replace("http:","https:","g");var b=c.toString().indexOf("/",8);c=c.toString().substring(0,b);c=c.toString().replace("8082","8443","g");c=c+e+";jsessionid="+a;return c}function registerPopup(c,a){var b=secureURL(c,a);$.ajax({url:b,data:$("#customerAccount").serialize(),success:function(d){if(d.indexOf("customerAccount",0)>0){document.getElementById("lrContent").innerHTML=d;loadTextBoxDefaults()}else{if(d.indexOf("registrationRedirect",0)>0){document.location=$(d).attr("href")}else{document.getElementById("loginBlock").innerHTML=d;if(d.indexOf("userStoreAddress")>0){$(".site-partner-tagline").html($("#userStoreAddress").html())}disablePopup();refreshProductBuilderUser();if(typeof successCallback=="function"){successCallback()}}}trackRegisterSuccessful()},dataType:"html",type:"POST",xhr:function(){var d=new XMLHttpRequest();d.onreadystatechange=function(){if(d.readyState==1){d.withCredentials="true"}};return d}})}function registerStorefrontPopup(b,a){if(window.location.toString().indexOf("customize",10)>0){gotoStoreLocator(a)}else{registerPopup(b,a)}}function gotoStoreLocator(a){var b=secureURL("/locationPopup.htm",a);$.ajax({url:b,data:$("#customerAccount").serialize(),success:function(c){if(c.indexOf("customerAccount",0)>0){document.getElementById("lrContent").innerHTML=c;loadTextBoxDefaults()}else{disablePopup();displayPopup("locationPopup");$("#locationContent").html(c);$("#searchLocation").focus()}},dataType:"html",type:"POST",xhr:function(){var c=new XMLHttpRequest();c.onreadystatechange=function(){if(c.readyState==1){c.withCredentials="true"}};return c}})}function selectStorePopup(c,a){var b=secureURL("/selectStorePopup.htm",a);$.ajax({url:b,data:{storeId:c},success:function(d){if(d.indexOf("message-popup-key",0)>0){$("#messagePopup").html(d);disablePopup();displayPopup("messagePopup")}else{document.getElementById("loginBlock").innerHTML=d;if(d.indexOf("userStoreAddress")>0){$(".site-partner-tagline").html($("#userStoreAddress").html())}disablePopup();refreshProductBuilderUser();if(typeof successCallback=="function"){successCallback()}trackRegisterSuccessful()}},dataType:"html",type:"POST",xhr:function(){var d=new XMLHttpRequest();d.onreadystatechange=function(){if(d.readyState==1){d.withCredentials="true"}};return d}})}function gotoRegistration(a){$.ajax({url:"/registerPopup.htm",success:function(b){$("#lrContent").html(b);$("#firstName").focus()},dataType:"html",async:false})}function gotoApprenticeRegistration(a){$.ajax({url:"/apprenticeFormPopup.htm",success:function(b){$("#apprenticeContent").html(b)},dataType:"html",async:false})}function gotoSignin(a){$.ajax({url:"/loginPopup.htm",success:function(b){$("#lrContent").html(b);document.getElementById("loginEmail").value=getCookie("lastLoggedInUser");$("#loginEmail").focus()},dataType:"html",async:false})}function gotoForgotPassword(a){$.ajax({url:"/loginPopup.htm",success:function(b){$("#lrContent").html(b);$("#login").hide();$("#forgotPassword").show();$("#forgotPasswordEmail").focus()},dataType:"html",async:false})}function getUserStatus(a){$.ajax({type:"GET",url:"/userStatus.htm",dataType:"json",async:false,success:function(b){a(b)},error:function(b,d,c){alert("Error getting user status")}})}function sendIdea(){$.post("ideas.htm",$("#ideasForm").serialize(),function(a){document.getElementById("ideas").innerHTML=a},"html")}function subscribeNewsletter(){$.post("subscription/subscribe.htm",$("#subscribe_form").serialize(),function(b){$("#messagePopup").html(b);var a=document.getElementById("message-popup-key").innerHTML;if(a=="subscription.thanks"){trackNewsletterSubscription();displayPopup("messagePopup")}else{displayPopup("messagePopup")}$("#subscribe_form input").blur()},"html")}function showStoreWarning(){$.get("/storeWarning.htm",function(a){$("#messagePopup").html(a);displayPopup("messagePopup")},"html")}function forgotPassword(){$("#errorText").html("");$("#login").hide();$("#forgotPassword").show();$("#forgotPassword").fadeIn("slow");$("#forgotPasswordEmail").focus()}function cancelForgotPw(){$("#errorText").html("");$("#forgotPassword").hide();$("#login").show();$("#login").fadeIn("slow")}function getMovie(a){if(navigator.appName.indexOf("Microsoft")!=-1){return window[a]}else{return document[a]}}function refreshProductBuilderUser(){var a=getMovie("ProductBuilder");if(!a){a=getMovie("LogoBuilderApp")}if(a!=null){a.sendToActionScript()}}function submitenter(c,b){var a;if(window.event){a=window.event.keyCode}else{if(b){a=b.which}else{return true}}if(a==13){c.form.submit();return false}else{return true}}function ajaxenter(b,c,f,g,d){var a;if(window.event){a=window.event.keyCode}else{if(d){a=d.which}else{return true}}if(a==13){b(c,f,g);return false}else{return true}}function getBrowserName(){if($.browser.msie){return"msie"}else{if($.browser.mozilla){return"firefox"}else{if($.browser.safari){if(navigator.userAgent.indexOf("Chrome")>0||navigator.userAgent.indexOf("chrome")>0){return"chrome"}else{return"safari"}}else{if($.browser.opera){return"opera"}else{return"none"}}}}}function interceptCMDZoom(c){var c=window.event||c;var a;var b;if(c.which){a=c.which}else{if(c.keyCode){a=c.keyCode}else{return true}}if(c.metaKey){b=c.metaKey}else{b=c.ctrlKey}if((a==107||a==109)&&b){return false}else{if((a==187||a==189)&&b&&$.browser.safari){return false}else{return true}}}document.onkeydown=interceptCMDZoom;var d_names=new Array("Sun","Mon","Tues","Weds","Thurs","Fri","Sat");var m_names=new Array("January","February","March","April","May","June","July","August","September","October","November","December");function setShippingDetailString(g,p,a,b,j,c){var n=document.getElementById(g);if(b==null||b==0){n.innerHTML="";return}else{var k=b.split("-");var m=parseInt(k[k.length-1]);if(j){a=2}else{a=parseInt(a)}var d=new Date(c);d.setDate(d.getDate()+a);var l=d.getDay();var o=0;var b=0;while(b<m){o++;l++;if(l==6){l=0}else{if(l!=0){b=b+1}}}d.setDate(d.getDate()+o);var i=d.getDate();l=d.getDay();var f=d.getMonth();var e="";if(i==1||i==21||i==31){e="st"}else{if(i==2||i==22){e="nd"}else{if(i==3||i==23){e="rd"}else{e="th"}}}var h="Delivered by "+d_names[l]+" "+m_names[f]+" "+i+e+".";n.innerHTML=h}}function alertFirefox36Users(){if(getCookie("hideFirefoxUpgradeNotice")=="1"){return}var b=function(){$("div#old-mozilla-warning").hide();setCookie("hideFirefoxUpgradeNotice","1",30)};var a=$('<div id="old-mozilla-warning"></div>');$('<div id="old-mozilla-warning-close"></div>').click(function(c){c.preventDefault();b()}).appendTo(a);$('<div id="old-mozilla-warning-msg"></div>').click(function(c){c.preventDefault();window.open("http://getfirefox.com");return false}).appendTo(a);$("div#container-content").prepend(a)}$(document).ready(function(){var a=$.browser;if(a.mozilla&&a.version.slice(0,3)=="1.9"){alertFirefox36Users()}});var createdDropdowns=new Object();function resetCreatedDropdowns(){createdDropdowns=new Object()}function createDropDown(c,b,e,d,g){createdDropdowns[e]=true;var a=$("#"+c);var f=a.find("option[selected]");var i=$("option",a);$("#"+e).empty();$("#"+e).append('<dl id="'+b+'" class="dropdown"></dl>');var h=f.text();if(g){h=g(f)}$("#"+b).append('<dt><a href="javascript:void(0);"><div class="start"></div><div class="arrow"></div><div class="content">'+h+'<span class="value">'+f.val()+"</span></div></a></dt>");if(f.val()==""){$("#"+b+" dt").addClass("prompt")}$("#"+b).append("<dd><ul></ul></dd>");i.each(function(){if($(this).val()!=""){var j=$(this).text();if(d){j=d(this)}$("#"+b+" dd ul").append('<li><a href="javascript:void(0);"><div>'+j+'<span class="value">'+$(this).val()+"</span></div></a></li>")}});if($("#"+c).is(":disabled")){$("#"+b).addClass("disabled")}if($("#"+b+" dd ul").height()>420){$("#"+b+" dd ul").css("height","420px")}$("#"+b+" dt a").click(function(){$(".dropdown:not(#"+b+") dd ul").hide();if(!$("#"+c).is(":disabled")){$("#"+b+" dd ul").toggle()}});$("#"+b+" dd ul li a").click(function(){var j=$("#"+c);j.val($(this).find("span.value").html());var k=j.find("option[selected]");var l=k.text();if(g){l=g(k)}$("#"+b+" dt a div.content").html(l);$("#"+b+" dt a span.value").html(k.val());if($("#"+b+" dt").hasClass("prompt")){$("#"+b+" dt").removeClass("prompt")}$("#"+b+" dd ul").hide();j.trigger("change");if($.browser.msie){j.trigger("click")}})}function createChildDropDown(e,b,f,c,d,a){if(createdDropdowns[c]){return}createDropDown(b,f,c,d,a);if(e){$("#"+c).show()}else{$("#"+c).hide()}$("#"+b).bind("hide",function(){$("#"+c).hide()});$("#"+b).bind("show",function(){$("#"+c).show()})}(function(a){a.fn.hoverIntent=function(k,j){var l={sensitivity:7,interval:100,timeout:0};l=a.extend(l,j?{over:k,out:j}:k);var n,m,h,d;var e=function(f){n=f.pageX;m=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-n)+Math.abs(d-m))<l.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return l.over.apply(f,[g])}else{h=n;d=m;f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return l.out.apply(f,[g])};var b=function(q){var o=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(o&&o!=this){try{o=o.parentNode}catch(q){o=this}}if(o==this){return false}var g=jQuery.extend({},q);var f=this;if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(q.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},l.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery);var popupStatus="";var windowWidth;var windowHeight;var videoUp=false;function openIndustryBizLB(){displayPopup("industryBizPopup")}function openIndustryBizLBWithDesignGroup(b){var a=document.getElementById("popupDesignGroup");a.value=b;openIndustryBizLB()}function openIdeas(){displayPopup("ideasPopup")}function openVideoLB(a){a();videoUp=true;displayPopup("videoPopup")}function openLoginOrRegisterLB(){displayPopup("loginRegistration")}function openApprenticeRegisterLB(){displayPopup("apprenticeRegistration")}function openLoginLB(a){if(msieNonCustomizeAccess()){window.location="/login.htm"}else{gotoSignin(a);openLoginOrRegisterLB();$("#loginEmail").focus()}}function openRegisterLB(a){if(msieNonCustomizeAccess()){window.location="/register.htm"}else{gotoRegistration(a);openLoginOrRegisterLB();$("#registerEmail").focus()}}function openApprenticeLB(a){if(msieNonCustomizeAccess()){window.location="/apprenticeForm.htm"}else{gotoApprenticeRegistration(a);openApprenticeRegisterLB()}}function msieNonCustomizeAccess(){if($.browser.msie){if(document.location.toString().indexOf("customize.htm",0)<0&&document.location.toString().indexOf("customizeLogo.htm",0)<0){return true}else{return false}}else{return false}}function openPubChooserLB(){displayPopup("pub-chooser-lb")}function openEULAAcceptLB(){displayPopup("eulaAcceptPopup")}function openAppleWarning(){displayPopup("iOSXPopup")}function openShareProductViaEmailLB(){displayPopup("shareProductViaEmailPopup")}function displayPopup(a){displayPopup(false)}function displayPopup(a,b){centerPopup(a);loadPopup(a,b);bindCenterPopupListeners(a)}function loadPopup(a){loadPopup(a,false)}function loadPopup(a,b){a=checkPopupId(a);if(popupStatus!=""){disablePopup()}$("#backgroundPopup").unbind("click");if(!b){$("#backgroundPopup").bind("click",function(){disablePopup()})}$("#backgroundPopup").css({opacity:"0.4"});$("#backgroundPopup").fadeIn("fast");$(a).fadeIn("fast");popupStatus=a}function disablePopup(){if(popupStatus!=""){$("#backgroundPopup").fadeOut("fast");$(popupStatus).fadeOut("fast");popupStatus=""}if(videoUp){removeVideoDiv()}if(document.getElementById("popupDesignGroup")){document.getElementById("popupDesignGroup").value=null}}function initializeWindowSize(){windowHeight=$(window).height();windowWidth=$(window).width()}function centerPopup(a){a=checkPopupId(a);initializeWindowSize();var c=$(a).height();var b=$(a).width();$(a).css({top:Math.abs((Math.floor((windowHeight-c)/2))),left:(Math.floor((windowWidth-b)/2))});$("#backgroundPopup").css({height:windowHeight,width:windowWidth})}function bindCenterPopupListeners(a){$(window).bind("resize",function(){centerPopup(a)});$(window).bind("scroll",function(){centerPopup(a)})}function checkPopupId(a){return((a.charAt(0)=="#")?"":"#")+a}$(document).ready(function(){$("#industryBizPopupClose").click(function(){disablePopup()});$("#videoPopupClose").click(function(){disablePopup()});$("#loginRegistrationClose").click(function(){disablePopup();setLoginCompleteCallback(null)});$("#apprenticeRegistrationClose").click(function(){disablePopup()});$("#pub-chooser-close").click(function(){disablePopup()});$("#eulaDeclineAnchor").click(function(){disablePopup()});$("#ideasPopupClose").click(function(){disablePopup()});$("#iOSXPopupClose").click(function(){disablePopup()});$("#shareProductViaEmailPopupClose").click(function(){disablePopup()});$(document).keypress(function(a){if(a.keyCode==27&&popupStatus==1){disablePopup()}})});
