var BaynoteJSVersion="Version: V1141-04";var BaynoteIgnored=false;var BN_READY_SIGNAL="ReadySignal";var Strategy={"ScriptDOMInject":2,"OnLoadInject":3};if(typeof(baynote_globals)=="undefined")var baynote_globals=new Object();baynote_globals.CommonResourceURL="/baynote/tags3/common";baynote_globals.CommonResourceID="Common";baynote_globals.PolicyResourceID="Policy";baynote_globals.CustomerStatus="/baynote/customerstatus2";baynote_globals.CommonScriptId="commonScriptId";if(typeof(baynote_inject_strategy)!="undefined"){baynote_globals.DefaultInjectStrategy=baynote_inject_strategy;}else{baynote_globals.DefaultInjectStrategy=Strategy.ScriptDOMInject;} if(typeof(baynote_server_timeout)!="undefined"){baynote_globals.ServerTimeout=baynote_server_timeout;}else{baynote_globals.ServerTimeout=undefined;} if(typeof(baynote_use_window_name)!="undefined"){baynote_globals.UseWindowName=baynote_use_window_name;}else{baynote_globals.UseWindowName=false;} baynote_globals.waitForReady=false;baynote_globals.checkStatus=false;baynote_globals.keepTrail=false;baynote_globals.trailLength=5;bnIsOpera=(navigator.userAgent.indexOf("Opera")>=0);bnIsSafari=(navigator.userAgent.indexOf("AppleWebKit")>=0);bnIsKonqueror=(navigator.userAgent.indexOf("Konqueror")>=0);bnIsKHTML=(bnIsSafari||bnIsKonqueror||navigator.userAgent.indexOf("KHTML")>=0);bnIsIE=(navigator.userAgent.indexOf("compatible")>=0&&navigator.userAgent.indexOf("MSIE")>=0&&!bnIsOpera);bnIsMozilla=(navigator.userAgent.indexOf("Gecko")>=0&&!bnIsKHTML);function BNLog(){this.timeBase=new Date().getTime();this.lines=new Array();this.lastLine="";this.repCount=0;} BNLog.prototype.log=function(str){if(str==this.lastLine){++this.repCount;return;} if(this.repCount>0){this.lines.push("___ ABOVE REPEATED "+this.repCount+" TIME"+((this.repCount>1)?"S":""));} this.lastLine=str;this.repCount=0;var elapsed=new Date().getTime()-this.timeBase;this.lines.push(elapsed+": "+str);};BNLog.prototype.toString=function(){if(this.repCount>0){this.lines.push("___ ABOVE REPEATED "+this.repCount+" TIME"+((this.repCount>1)?"S":""));this.lastLine="";this.repCount=0;} return this.lines.join("\n");};if(typeof(bnLog)=="undefined"){var bnLog=new BNLog();} function BNCriticalSectionQueue(){this.waitList=new Object();this.lastId=0;} BNCriticalSectionQueue.prototype.issueId=function(){return++this.lastId;};BNCriticalSectionQueue.prototype.enqueue=function(id,item){this.waitList[id]=item;};BNCriticalSectionQueue.prototype.getWaiter=function(id){return(id==null)?null:this.waitList[id];};BNCriticalSectionQueue.prototype.firstWaiter=function(){return this.getWaiter(this.nextWaiterKeyAfter(null));};BNCriticalSectionQueue.prototype.nextWaiterAfter=function(id){return this.getWaiter(this.nextWaiterKeyAfter(id));};BNCriticalSectionQueue.prototype.nextWaiterKeyAfter=function(id){for(var currKey in this.waitList){if(typeof(this.waitList[currKey])!="object")continue;if(id==null)return currKey;if(id==currKey)id=null;} return null;};BNCriticalSectionQueue.prototype.nextPredecessor=function(target,start){for(var currWaiter=start;currWaiter!=null;currWaiter=this.nextWaiterAfter(currWaiter.id)){if(currWaiter.enter||(currWaiter.number!=0&&(currWaiter.number4096)return false;document.cookie=cookieStr;return true;};BNSystem.prototype.removeCookie=function(cookieName,cookieDomain){this.setCookie(cookieName,"","/","Mon, 1 Jan 1990 00:00:00",cookieDomain);};BNSystem.prototype.getURLParam=function(name,url){if(!url)var url=window.location.href;var regex=new RegExp("[\\?&]"+name+"=([^&#]*)");var match=regex.exec(url);if(!match)return null;else return match[1];};BNSystem.prototype.getTestServer=function(){if(this.testServer!=null)return this.testServer;var testServer=this.getCookieValue("bn_test");if(!testServer)testServer="";this.testServer=testServer;return testServer;};if(typeof(bnSystem)=="undefined"){var bnSystem=new BNSystem();} function BNTag(previousTag){if(previousTag){this.id=previousTag.id+1;this.server=previousTag.server;this.customerId=previousTag.customerId;this.code=previousTag.code;}else this.id=0;this.attrs=new Object();this.docAttrs=new Object();this.css=new Object();} BNTag.prototype.getCommonResourceId=function(){return baynote_globals.CommonResourceID;};BNTag.prototype.getCommonResourceAddress=function(obj){var urlParams='?';for(var i in obj){if(i!='server'){urlParams+=i+'='+encodeURIComponent(obj[i])+'&';}} var cutLastAmp=urlParams.substring(0,urlParams.length-1);var commonURL=this.server+baynote_globals.CommonResourceURL+cutLastAmp;return commonURL;};BNTag.prototype.getFailsafeResourceId=function(){return"Failsafe";};BNTag.prototype.getFailsafeResourceAddress=function(){var v=BaynoteJSVersion.split(" ")[1];var u=bnSystem.getCookieValue("bn_u");return(this.server+baynote_globals.CustomerStatus+"?customerId="+this.customerId+"&code="+this.code+"&v="+v+"&u="+u);};BNTag.prototype.getParam=function(name,defaultValue){var value=this[name];if(typeof(value)=="undefined"||value==null)return defaultValue;else return value;};if(typeof(baynote_tag)=="undefined"){window["bn_tags"]=new Array();var baynote_tag=new BNTag(null);} function bnReadySignal(){bnResourceManager.registerResource(BN_READY_SIGNAL);} function bnCall(resName,methodName,methodArg){var resource=bnResourceManager.getResource(resName);if(!resource){bnResourceManager.waitForResource(resName,function(){bnCall(resName,methodName,methodArg);});return;} if(typeof(resource)!="object"){return;} var method=resource[methodName];if(typeof(method)!="function"){return;} method.call(resource,methodArg);} function bnWaitForCustomerStatus(callBack){if(!bnCheckCustomerStatus()){var failsafeId=baynote_tag.getFailsafeResourceId();bnResourceManager.waitForResource(failsafeId,function(){bnWaitForCustomerStatus(callBack);},baynote_tag.getFailsafeResourceAddress(),"img");return;} bnResourceManager.runCallback(callBack);} function bnCheckCustomerStatus(){var failsafeId=baynote_tag.getFailsafeResourceId();if(bnResourceManager.getResource(failsafeId))return true;else return false;} var BaynoteAPI={};BaynoteAPI.getURLParam=function(paramName,url){return bnSystem.getURLParam(paramName,url);};BaynoteAPI.init=function(params){if(!params||!params.server||!params.customerId||!params.code){bnLog.log("ERROR: init called with insufficient arguments - needs server, customerId, code");return;} if(!params.timeout){params.timeout=baynote_globals.ServerTimeout;} if(!params.onFailure){params.onFailure=baynote_globals.onFailure;} var testServer=bnSystem.getTestServer();if(testServer){var reValidTestServer=new RegExp("^https?://[^/]*\\.baynote\\.(com|net):?\\d*(/.*)?$");if(reValidTestServer.test(testServer))params.server=testServer;else bnLog.log("Ignoring invalid test server \""+testServer+"\"");} if(params.server)baynote_tag.server=params.server;if(params.customerId)baynote_tag.customerId=params.customerId;if(params.code)baynote_tag.code=params.code;var commonId=baynote_tag.getCommonResourceId();if(!bnResourceManager.getResource(commonId)){bnResourceManager.waitForResource(commonId,function(){BaynoteAPI.init(params)},baynote_tag.getCommonResourceAddress(params),"script",params.timeout,params.onFailure);}else{if(!BaynoteIgnored){bnCommon.completePreload(params);}}};BaynoteAPI.execute=function(handlerName,handlerparams){var commonId=baynote_tag.getCommonResourceId();if(typeof(bnResourceManager.getResource(commonId))=='undefined'){bnLog.log("WARN: common not loaded - exiting execute; consider calling init first");return;}else if(typeof bnCommon=='undefined'){bnResourceManager.waitForResource(commonId,function(){BaynoteAPI.execute(handlerName,handlerparams);});return;} bnCommon.waitAndExecute(handlerName,handlerparams);};BaynoteAPI.executeAll=function(handlerparams){var commonId=baynote_tag.getCommonResourceId();if(typeof(bnResourceManager.getResource(commonId))=='undefined'){bnLog.log("WARN: common not loaded - exiting executeAll; consider calling init first");return;}else if(typeof bnCommon=='undefined'){bnResourceManager.waitForResource(commonId,function(){BaynoteAPI.executeAll(handlerparams);});return;} bnCommon.waitAndExecuteAll(handlerparams);};BaynoteAPI.call=function(handlerName,method,methodArgs,scopeObj){var commonId=baynote_tag.getCommonResourceId();if(typeof(bnResourceManager.getResource(commonId))=='undefined'){bnLog.log("WARN: common not loaded - exiting call; consider calling init first");return;}else if(typeof bnCommon=='undefined'){bnResourceManager.waitForResource(commonId,function(){BaynoteAPI.call(handlerName,method,methodArgs,scopeObj);});return;} bnCommon.finishCall(handlerName,method,methodArgs,scopeObj);};BaynoteAPI.isBaynoteIgnored=function(){return BaynoteIgnored;};BaynoteAPI.getCookieDomain=function(){var cDomain="";var bn_locHref=window.location.href;var i=bn_locHref.indexOf('//');var s1=bn_locHref.substring(i+2);var j=s1.indexOf('/');if(j<0) var s2=s1;else var s2=s1.substring(0,j);var k=s2.indexOf('.');var s3=s2.substring(k+1);s3;return cDomain=s3;} baynote_globals.cookieDomain=BaynoteAPI.getCookieDomain();var preLoadObj={};var bn_locHref=window.location.href;if(bn_locHref.indexOf("https://")==0){preLoadObj.server="https://madewell-www.baynote.net";}else{preLoadObj.server="http://madewell-www.baynote.net";} preLoadObj.customerId="madewell";preLoadObj.code="www";BaynoteAPI.init(preLoadObj);if(typeof(baynoteObserver)=="undefined"||typeof(baynoteObserver)!="boolean"||baynoteObserver){BaynoteAPI.execute("observer");} if(typeof(baynoteGuide)=="undefined"||typeof(baynoteGuide)!="boolean"||baynoteGuide){BaynoteAPI.execute("recommendation");} if(typeof(baynoteDisableAjax)!="undefined"&&typeof(baynoteDisableAjax)=="boolean"&&!baynoteDisableAjax){BaynoteAPI.execute("ajax");}