﻿var mboxCopyright="&copy; 2003-2009. Omniture, Inc. All rights reserved.";mboxUrlBuilder=function(c,d){this.a=c;this.b=d;this.c=new Array();this.d=function(a){return a};this.f=null};mboxUrlBuilder.prototype.addParameter=function(a,b){var c=new RegExp("('|\")");if(c.exec(a)){throw"Parameter '"+a+"' contains invalid characters"}for(var d=0;d<this.c.length;d++){var e=this.c[d];if(e.name==a){e.value=b;return this}}var f=new Object();f.name=a;f.value=b;this.c[this.c.length]=f;return this};mboxUrlBuilder.prototype.addParameters=function(a){if(!a){return this}for(var b=0;b<a.length;b++){var d=a[b].indexOf("=");if(d==-1||d==0){continue}this.addParameter(a[b].substring(0,d),a[b].substring(d+1,a[b].length))}return this};mboxUrlBuilder.prototype.setServerType=function(a){this.o=a};mboxUrlBuilder.prototype.setBasePath=function(a){this.f=a};mboxUrlBuilder.prototype.setUrlProcessAction=function(a){this.d=a};mboxUrlBuilder.prototype.buildUrl=function(){var d=this.f?this.f:"/m2/"+this.b+"/mbox/"+this.o;var f=document.location.protocol=="file:"?"http:":document.location.protocol;var a=f+"//"+this.a+d;var g=a.indexOf("?")!=-1?"&":"?";for(var b=0;b<this.c.length;b++){var c=this.c[b];a+=g+encodeURIComponent(c.name)+"="+encodeURIComponent(c.value);g="&"}return this.t(this.d(a))};mboxUrlBuilder.prototype.getParameters=function(){return this.c};mboxUrlBuilder.prototype.setParameters=function(a){this.c=a};mboxUrlBuilder.prototype.clone=function(){var b=new mboxUrlBuilder(this.a,this.b);b.setServerType(this.o);b.setBasePath(this.f);b.setUrlProcessAction(this.d);for(var a=0;a<this.c.length;a++){b.addParameter(this.c[a].name,this.c[a].value)}return b};mboxUrlBuilder.prototype.t=function(a){return a.replace(/\"/g,"&quot;").replace(/>/g,"&gt;")};mboxStandardFetcher=function(){};mboxStandardFetcher.prototype.getType=function(){return"standard"};mboxStandardFetcher.prototype.fetch=function(a){a.setServerType(this.getType());document.write('<script src="'+a.buildUrl()+'" language="JavaScript"></script>')};mboxStandardFetcher.prototype.cancel=function(){};mboxAjaxFetcher=function(){};mboxAjaxFetcher.prototype.getType=function(){return"ajax"};mboxAjaxFetcher.prototype.fetch=function(b){b.setServerType(this.getType());var a=b.buildUrl();this.x=document.createElement("script");this.x.src=a;document.body.appendChild(this.x)};mboxAjaxFetcher.prototype.cancel=function(){};mboxMap=function(){this.y=new Object();this.z=new Array()};mboxMap.prototype.put=function(a,b){if(!this.y[a]){this.z[this.z.length]=a}this.y[a]=b};mboxMap.prototype.get=function(a){return this.y[a]};mboxMap.prototype.remove=function(a){this.y[a]=undefined};mboxMap.prototype.each=function(d){for(var c=0;c<this.z.length;c++){var a=this.z[c];var b=this.y[a];if(b){d(a,b)}}};mboxFactory=function(c,a,d){this.D=false;this.B=c;this.C=d;this.E=new mboxList();mboxFactories.put(d,this);this.F=typeof document.createElement("div").replaceChild!="undefined"&&(function(){return true})()&&typeof document.getElementById!="undefined"&&typeof(window.attachEvent||document.addEventListener||window.addEventListener)!="undefined"&&typeof encodeURIComponent!="undefined";this.G=this.F&&mboxGetPageParameter("mboxDisable")==null;var e=d=="default";this.I=new mboxCookieManager("mbox"+(e?"":("-"+d)),(function(){return mboxCookiePageDomain()})());this.G=this.G&&this.I.isEnabled()&&(this.I.getCookie("disable")==null);if(this.isAdmin()){this.enable()}this.J=mboxGenerateId();this.K=new mboxSession(this.J,"mboxSession","session",31*60,this.I);this.L=new mboxPC("PC",1209600,this.I);this.w=new mboxUrlBuilder(c,a);this.M(this.w,e);this.N=new Date().getTime();this.O=this.N;var f=this;this.addOnLoad(function(){f.O=new Date().getTime()});if(this.F){this.addOnLoad(function(){f.D=true;f.getMboxes().each(function(b){b.setFetcher(new mboxAjaxFetcher());b.finalize()})});this.limitTraffic(100,10368000);if(this.G){this.R();this.S=new mboxSignaler(function(g,b){return f.create(g,b)},this.I)}}};mboxFactory.prototype.isEnabled=function(){return this.G};mboxFactory.prototype.getDisableReason=function(){return this.I.getCookie("disable")};mboxFactory.prototype.isSupported=function(){return this.F};mboxFactory.prototype.disable=function(a,b){if(typeof a=="undefined"){a=60*60}if(typeof b=="undefined"){b="unspecified"}if(!this.isAdmin()){this.G=false;this.I.setCookie("disable",b,a)}};mboxFactory.prototype.enable=function(){this.G=true;this.I.deleteCookie("disable")};mboxFactory.prototype.isAdmin=function(){return document.location.href.indexOf("mboxEnv")!=-1};mboxFactory.prototype.limitTraffic=function(b,a){};mboxFactory.prototype.addOnLoad=function(a){if(window.addEventListener){window.addEventListener("load",a,false)}else{if(document.addEventListener){document.addEventListener("load",a,false)}else{if(document.attachEvent){window.attachEvent("onload",a)}}}};mboxFactory.prototype.getEllapsedTime=function(){return this.O-this.N};mboxFactory.prototype.getEllapsedTimeUntil=function(a){return a-this.N};mboxFactory.prototype.getMboxes=function(){return this.E};mboxFactory.prototype.get=function(a,b){return this.E.get(a).getById(b||0)};mboxFactory.prototype.update=function(b,a){if(!this.isEnabled()){return}if(this.E.get(b).length()==0){throw"Mbox "+b+" is not defined"}this.E.get(b).each(function(c){c.getUrlBuilder().addParameter("mboxPage",mboxGenerateId());c.load(a)})};mboxFactory.prototype.create=function(l,f,n){if(!this.isSupported()){return null}var h=this.w.clone();h.addParameter("mboxCount",this.E.length()+1);h.addParameters(f);var m=this.E.get(l).length();var a=this.C+"-"+l+"-"+m;var b;if(n){b=new mboxLocatorNode(n)}else{if(this.D){throw"The page has already been loaded, can't write marker"}b=new mboxLocatorDefault(a)}try{var j=this;var d="mboxImported-"+a;var k=new mbox(l,m,h,b,d);if(this.G){k.setFetcher(this.D?new mboxAjaxFetcher():new mboxStandardFetcher())}k.setOnError(function(c,e){k.setMessage(c);k.activate();if(!k.isActivated()){j.disable(60*60,c);window.location.reload(false)}});this.E.add(k)}catch(g){this.disable();throw'Failed creating mbox "'+l+'", the error was: '+g}var i=new Date();h.addParameter("mboxTime",i.getTime()-(i.getTimezoneOffset()*60000));return k};mboxFactory.prototype.getCookieManager=function(){return this.I};mboxFactory.prototype.getPageId=function(){return this.J};mboxFactory.prototype.getPCId=function(){return this.L};mboxFactory.prototype.getSessionId=function(){return this.K};mboxFactory.prototype.getSignaler=function(){return this.S};mboxFactory.prototype.getUrlBuilder=function(){return this.w};mboxFactory.prototype.M=function(a,b){a.addParameter("mboxHost",document.location.hostname).addParameter("mboxSession",this.K.getId());if(!b){a.addParameter("mboxFactoryId",this.C)}if(this.L.getId()!=null){a.addParameter("mboxPC",this.L.getId())}a.addParameter("mboxPage",this.J);a.setUrlProcessAction(function(c){c+="&mboxURL="+encodeURIComponent(document.location);var d=encodeURIComponent(document.referrer);if(c.length+d.length<2000){c+="&mboxReferrer="+d}c+="&mboxVersion="+mboxVersion;return c})};mboxFactory.prototype.gb=function(){return""};mboxFactory.prototype.R=function(){document.write("<style>.mboxDefault { visibility:hidden; }</style>")};mboxFactory.prototype.isDomLoaded=function(){return this.D};mboxSignaler=function(a,b){this.I=b;var c=b.getCookieNames("signal-");for(var d=0;d<c.length;d++){var e=c[d];var f=b.getCookie(e).split("&");var g=a(f[0],f);g.load();b.deleteCookie(e)}};mboxSignaler.prototype.signal=function(a,b){this.I.setCookie("signal-"+a,mboxShiftArray(arguments).join("&"),45*60)};mboxList=function(){this.E=new Array()};mboxList.prototype.add=function(a){if(a!=null){this.E[this.E.length]=a}};mboxList.prototype.get=function(d){var b=new mboxList();for(var a=0;a<this.E.length;a++){var c=this.E[a];if(c.getName()==d){b.add(c)}}return b};mboxList.prototype.getById=function(a){return this.E[a]};mboxList.prototype.length=function(){return this.E.length};mboxList.prototype.each=function(b){if(typeof b!="function"){throw"Action must be a function, was: "+typeof(b)}for(var a=0;a<this.E.length;a++){b(this.E[a])}};mboxLocatorDefault=function(a){this.g="mboxMarker-"+a;document.write('<div id="'+this.g+'" style="visibility:hidden;display:none">&nbsp;</div>')};mboxLocatorDefault.prototype.locate=function(){var a=document.getElementById(this.g);while(a!=null){if(a.nodeType==1){if(a.className=="mboxDefault"){return a}}a=a.previousSibling}return null};mboxLocatorDefault.prototype.force=function(){var a=document.createElement("div");a.className="mboxDefault";var b=document.getElementById(this.g);b.parentNode.insertBefore(a,b);return a};mboxLocatorNode=function(a){this.ob=a};mboxLocatorNode.prototype.locate=function(){return typeof this.ob=="string"?document.getElementById(this.ob):this.ob};mboxLocatorNode.prototype.force=function(){return null};mboxCreate=function(b){var a=mboxFactoryDefault.create(b,mboxShiftArray(arguments));if(a){a.load()}return a};mboxDefine=function(c,b){var a=mboxFactoryDefault.create(b,mboxShiftArray(mboxShiftArray(arguments)),c);return a};mboxUpdate=function(a){mboxFactoryDefault.update(a,mboxShiftArray(arguments))};mbox=function(b,c,e,d,a){this.ub=null;this.vb=0;this.ab=d;this.bb=a;this.wb=null;this.xb=new mboxOfferContent();this.pb=null;this.w=e;this.message="";this.yb=new Object();this.zb=0;this.sb=c;this.g=b;this.Ab();e.addParameter("mbox",b).addParameter("mboxId",c);this.Bb=function(){};this.Cb=function(){};this.Db=null};mbox.prototype.getId=function(){return this.sb};mbox.prototype.Ab=function(){if(this.g.length>250){throw"Mbox Name "+this.g+" exceeds max length of 250 characters."}else{if(this.g.match(/^\s+|\s+$/g)){throw"Mbox Name "+this.g+" has leading/trailing whitespace(s)."}}};mbox.prototype.getName=function(){return this.g};mbox.prototype.getParameters=function(){var a=this.w.getParameters();var d=new Array();for(var b=0;b<a.length;b++){if(a[b].name.indexOf("mbox")!=0){d[d.length]=a[b].name+"="+a[b].value}}return d};mbox.prototype.setOnLoad=function(a){this.Cb=a;return this};mbox.prototype.setMessage=function(a){this.message=a;return this};mbox.prototype.setOnError=function(a){this.Bb=a;return this};mbox.prototype.setFetcher=function(a){if(this.wb){this.wb.cancel()}this.wb=a;return this};mbox.prototype.getFetcher=function(){return this.wb};mbox.prototype.load=function(a){if(this.wb==null){return this}this.setEventTime("load.start");this.cancelTimeout();this.vb=0;var d=(a&&a.length>0)?this.w.clone().addParameters(a):this.w;this.wb.fetch(d);var b=this;this.Fb=setTimeout(function(){b.Bb("browser timeout",b.wb.getType())},15000);this.setEventTime("load.end");return this};mbox.prototype.loaded=function(){this.cancelTimeout();if(!this.activate()){var a=this;setTimeout(function(){a.loaded()},100)}};mbox.prototype.activate=function(){if(this.vb){return this.vb}this.setEventTime("activate"+ ++this.zb+".start");if(this.show()){this.cancelTimeout();this.vb=1}this.setEventTime("activate"+this.zb+".end");return this.vb};mbox.prototype.isActivated=function(){return this.vb};mbox.prototype.setOffer=function(a){if(a&&a.show&&a.setOnLoad){this.xb=a}else{throw"Invalid offer"}return this};mbox.prototype.getOffer=function(){return this.xb};mbox.prototype.show=function(){this.setEventTime("show.start");var a=this.xb.show(this);this.setEventTime(a==1?"show.end.ok":"show.end");return a};mbox.prototype.showContent=function(a){if(a==null){return 0}if(this.pb==null||!this.pb.parentNode){this.pb=this.getDefaultDiv();if(this.pb==null){return 0}}if(this.pb!=a){this.Hb(this.pb);this.pb.parentNode.replaceChild(a,this.pb);this.pb=a}this.Ib(a);this.Cb();return 1};mbox.prototype.hide=function(){this.setEventTime("hide.start");var a=this.showContent(this.getDefaultDiv());this.setEventTime(a==1?"hide.end.ok":"hide.end.fail");return a};mbox.prototype.finalize=function(){this.setEventTime("finalize.start");this.cancelTimeout();if(this.getDefaultDiv()==null){if(this.ab.force()!=null){this.setMessage("No default content, an empty one has been added")}else{this.setMessage("Unable to locate mbox")}}if(!this.activate()){this.hide();this.setEventTime("finalize.end.hide")}this.setEventTime("finalize.end.ok")};mbox.prototype.cancelTimeout=function(){if(this.Fb){clearTimeout(this.Fb)}if(this.wb!=null){this.wb.cancel()}};mbox.prototype.getDiv=function(){return this.pb};mbox.prototype.getDefaultDiv=function(){if(this.Db==null){this.Db=this.ab.locate()}return this.Db};mbox.prototype.setEventTime=function(a){this.yb[a]=(new Date()).getTime()};mbox.prototype.getEventTimes=function(){return this.yb};mbox.prototype.getImportName=function(){return this.bb};mbox.prototype.getURL=function(){return this.w.buildUrl()};mbox.prototype.getUrlBuilder=function(){return this.w};mbox.prototype.Kb=function(a){return a.style.display!="none"};mbox.prototype.Ib=function(a){this.Lb(a,true)};mbox.prototype.Hb=function(a){this.Lb(a,false)};mbox.prototype.Lb=function(b,a){b.style.visibility=a?"visible":"hidden";b.style.display=a?"block":"none"};mboxOfferContent=function(){this.Cb=function(){}};mboxOfferContent.prototype.show=function(b){var a=b.showContent(document.getElementById(b.getImportName()));if(a==1){this.Cb()}return a};mboxOfferContent.prototype.setOnLoad=function(a){this.Cb=a};mboxOfferAjax=function(a){this.Gb=a;this.Cb=function(){}};mboxOfferAjax.prototype.setOnLoad=function(a){this.Cb=a};mboxOfferAjax.prototype.show=function(c){var b=document.createElement("div");b.id=c.getImportName();b.innerHTML=this.Gb;var a=c.showContent(b);if(a==1){this.Cb()}return a};mboxOfferDefault=function(){this.Cb=function(){}};mboxOfferDefault.prototype.setOnLoad=function(a){this.Cb=a};mboxOfferDefault.prototype.show=function(b){var a=b.hide();if(a==1){this.Cb()}return a};mboxCookieManager=function mboxCookieManager(a,b){this.g=a;this.Ob=b==""||b.indexOf(".")==-1?"":"; domain="+b;this.Pb=new mboxMap();this.loadCookies()};mboxCookieManager.prototype.isEnabled=function(){this.setCookie("check","true",60);this.loadCookies();return this.getCookie("check")=="true"};mboxCookieManager.prototype.setCookie=function(a,b,d){if(typeof a!="undefined"&&typeof b!="undefined"&&typeof d!="undefined"){var c=new Object();c.name=a;c.value=escape(b);c.expireOn=Math.ceil(d+new Date().getTime()/1000);this.Pb.put(a,c);this.saveCookies()}};mboxCookieManager.prototype.getCookie=function(a){var b=this.Pb.get(a);return b?unescape(b.value):null};mboxCookieManager.prototype.deleteCookie=function(a){this.Pb.remove(a);this.saveCookies()};mboxCookieManager.prototype.getCookieNames=function(a){var b=new Array();this.Pb.each(function(c,d){if(c.indexOf(a)==0){b[b.length]=c}});return b};mboxCookieManager.prototype.saveCookies=function(){var a=new Array();var b=0;this.Pb.each(function(d,e){a[a.length]=d+"#"+e.value+"#"+e.expireOn;if(b<e.expireOn){b=e.expireOn}});var c=new Date(b*1000);document.cookie=this.g+"="+a.join("|")+"; expires="+c.toGMTString()+"; path=/"+this.Ob};mboxCookieManager.prototype.loadCookies=function(){this.Pb=new mboxMap();var d=document.cookie.indexOf(this.g+"=");if(d!=-1){var e=document.cookie.indexOf(";",d);if(e==-1){e=document.cookie.indexOf(",",d);if(e==-1){e=document.cookie.length}}var f=document.cookie.substring(d+this.g.length+1,e).split("|");var g=Math.ceil(new Date().getTime()/1000);for(var b=0;b<f.length;b++){var c=f[b].split("#");if(g<=c[2]){var a=new Object();a.name=c[0];a.value=c[1];a.expireOn=c[2];this.Pb.put(a.name,a)}}}};mboxSession=function(a,b,e,c,d){this.bc=b;this.jb=e;this.cc=c;this.I=d;this.dc=false;this.sb=typeof mboxForceSessionId!="undefined"?mboxForceSessionId:mboxGetPageParameter(this.bc);if(this.sb==null||this.sb.length==0){this.sb=d.getCookie(e);if(this.sb==null||this.sb.length==0){this.sb=a;this.dc=true}}d.setCookie(e,this.sb,c)};mboxSession.prototype.getId=function(){return this.sb};mboxSession.prototype.forceId=function(a){this.sb=a;this.I.setCookie(this.jb,this.sb,this.cc)};mboxPC=function(c,a,b){this.jb=c;this.cc=a;this.I=b;this.sb=typeof mboxForcePCId!="undefined"?mboxForcePCId:b.getCookie(c);if(this.sb!=null){b.setCookie(c,this.sb,a)}};mboxPC.prototype.getId=function(){return this.sb};mboxPC.prototype.forceId=function(a){if(this.sb!=a){this.sb=a;this.I.setCookie(this.jb,this.sb,this.cc);return true}return false};mboxGetPageParameter=function(b){var d=null;var a=new RegExp(b+"=([^&]*)");var c=a.exec(document.location);if(c!=null&&c.length>=2){d=c[1]}return d};mboxSetCookie=function(a,b,c){return mboxFactoryDefault.getCookieManager().setCookie(a,b,c)};mboxGetCookie=function(a){return mboxFactoryDefault.getCookieManager().getCookie(a)};mboxCookiePageDomain=function(){var c=(/([^:]*)(:[0-9]{0,5})?/).exec(document.location.host)[1];var a=/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/;if(!a.exec(c)){var b=(/([^\.]+\.[^\.]{3}|[^\.]+\.[^\.]+\.[^\.]{2})$/).exec(c);if(b){c=b[0]}}return c?c:""};mboxShiftArray=function(b){var c=new Array();for(var a=1;a<b.length;a++){c[c.length]=b[a]}return c};mboxGenerateId=function(){return(new Date()).getTime()+"-"+Math.floor(Math.random()*999999)};if(typeof mboxVersion=="undefined"){var mboxVersion=38;var mboxFactories=new mboxMap();var mboxFactoryDefault=new mboxFactory("stevemadden.tt.omtrdc.net","stevemadden","default")}if(mboxGetPageParameter("mboxDebug")!=null||mboxFactoryDefault.getCookieManager().getCookie("debug")!=null){setTimeout(function(){if(typeof mboxDebugLoaded=="undefined"){alert("Could not load the remote debug.\nPlease check your connection to Test&amp;Target servers")}},60*60);document.write('<script language="Javascript1.2" src="http://admin16.testandtarget.omniture.com/admin/mbox/mbox_debug.jsp?mboxServerHost=stevemadden.tt.omtrdc.net&clientCode=stevemadden"></script>')};function setCookie(a,d,c){var b=new Date();b.setDate(b.getDate()+c);document.cookie=a+"="+escape(d)+((c==null)?"":";expires="+b.toGMTString())}function getCookie(a){var b=document.cookie.match("(^|;) ?"+a+"=([^;]*)(;|$)");if(b){return(unescape(b[2]))}else{return null}}function ShowMaximumPaymentDeclinedExceptionMessage(a){ShowOverlay();$(function(){ShowOverlay()});var d=getPageSize();var b=document.getElementById("checkout-validation");b.innerHTML=a;if($.browser.msie&&$.browser.version=="6.0"){b.style.left=(d.Width/2-395)+"px";b.style.top="197px";replaceDDL()}else{if($.browser.msie&&$.browser.version=="7.0"){b.style.left=(d.Width/2-481)+"px";b.style.top="275px"}else{b.style.left=(d.Width/2-481)+"px"}}b.style.display="block";var c=document.getElementById("checkout-overlay");window.scrollTo(0,0);c.style.height=($(document).height()+"px");c.style.display="block"}function ShowOverlay(){var b=getPageSize();var a=document.getElementById("checkout-overlay");window.scrollTo(0,0);a.style.height=($(document).height()+"px");a.style.display="block";if($.browser.msie&&$.browser.version=="6.0"){replaceDDL()}}function HideMessage(){ddlBillingStateID=$("#ddlBillingStateID").attr("value");ddlBillingCountryID=$("#ddlBillingCountryID").attr("value");ddlShippingStateID=$("#ddlShippingStateID").attr("value");ddlShippingCountryID=$("#ddlShippingCountryID").attr("value");$("#"+ddlBillingStateID).show();$("#"+ddlBillingCountryID).show();$("#"+ddlShippingStateID).show();$("#"+ddlShippingCountryID).show();$("#ie6BillingStateBugFix").hide();$("#ie6BillingCountryBugFix").hide();$("#ie6ShippingStateBugFix").hide();$("#ie6ShippingCountryBugFix").hide();var a=document.getElementById("checkout-validation");a.style.display="none";var b=document.getElementById("checkout-overlay");b.style.display="none"}function getPageSize(){var d,e;if(window.innerHeight&&window.scrollMaxY){d=document.body.scrollWidth;e=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){d=document.body.scrollWidth;e=document.body.scrollHeight}else{d=document.body.offsetWidth;e=document.body.offsetHeight}}var c,b;if(self.innerHeight){c=self.innerWidth;b=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientWidth;b=document.documentElement.clientHeight}else{if(document.body){c=document.body.clientWidth;b=document.body.clientHeight}}}if(e<b){pageHeight=b}else{pageHeight=e}if(d<c){pageWidth=c}else{pageWidth=d}var a={Width:pageWidth,Height:pageHeight,windowWidth:c,windowHeight:b};arrayPageSize=new Array(pageWidth,pageHeight,c,b);return a}function GetProductCount(){var b=getCookie("ProductCount");if(b==null){setCookie("ProductCount","0")}var a=window.location.href.toLowerCase();if(a.indexOf("/item.aspx")>0){b++;setCookie("ProductCount",b)}return getCookie("ProductCount")};var lpMTagConfig={lpServer:"server.iad.liveperson.net",lpNumber:"15578893",lpProtocol:(document.location.toString().indexOf("https:")==0)?"https":"http",lpTagLoaded:false,lpTagSrv:"sr2.liveperson.net",pageStartTime:(new Date()).getTime()};lpMTagConfig.lpLoadScripts=function(){lpAddMonitorTag()};function lpAddMonitorTag(b){if(!lpMTagConfig.lpTagLoaded){if(typeof(b)=="undefined"||typeof(b)=="object"){if(lpMTagConfig.lpMTagSrc){b=lpMTagConfig.lpMTagSrc}else{if(lpMTagConfig.lpTagSrv){b=lpMTagConfig.lpProtocol+"://"+lpMTagConfig.lpTagSrv+"/hcp/html/mTag.js"}else{b="/hcp/html/mTag.js"}}}if(b.indexOf("http")!=0){b=lpMTagConfig.lpProtocol+"://"+lpMTagConfig.lpServer+b+"?site="+lpMTagConfig.lpNumber}else{if(b.indexOf("site=")<0){if(b.indexOf("?")<0){b=b+"?"}else{b=b+"&"}b=b+"site="+lpMTagConfig.lpNumber}}var a=document.createElement("script");a.setAttribute("type","text/javascript");a.setAttribute("charset","iso-8859-1");a.setAttribute("src",b);document.getElementsByTagName("head").item(0).appendChild(a)}}lpMTagConfig.calculateSentPageTime=function(){var a=(new Date()).getTime()-lpMTagConfig.pageStartTime;lpAddVars("page","pageLoadTime",Math.round(a/1000)+" sec")};if(typeof(lpMTagConfig.pageVar)=="undefined"){lpMTagConfig.pageVar=[]}if(typeof(lpMTagConfig.sessionVar)=="undefined"){lpMTagConfig.sessionVar=[]}if(typeof(lpMTagConfig.visitorVar)=="undefined"){lpMTagConfig.visitorVar=[]}if(typeof(lpMTagConfig.onLoadCode)=="undefined"){lpMTagConfig.onLoadCode=[]}if(typeof(lpMTagConfig.dynButton)=="undefined"){lpMTagConfig.dynButton=[]}if(typeof(lpMTagConfig.ifVisitorCode)=="undefined"){lpMTagConfig.ifVisitorCode=[]}function lpAddVars(b,a,c){if(a.indexOf("OrderTotal")!=-1||a.indexOf("OrderNumber")!=-1){if(c==""||c==0){return}else{lpMTagConfig.sendCookies=false}}c=lpTrimSpaces(c.toString());if(a.length>50){a=a.substr(0,50)}if(c.length>50){c=c.substr(0,50)}switch(b){case"page":lpMTagConfig.pageVar[lpMTagConfig.pageVar.length]=escape(a)+"="+escape(c);break;case"session":lpMTagConfig.sessionVar[lpMTagConfig.sessionVar.length]=escape(a)+"="+escape(c);break;case"visitor":lpMTagConfig.visitorVar[lpMTagConfig.visitorVar.length]=escape(a)+"="+escape(c);break}}function onloadEMT(){var a=document.cookie;if(lpMTag.lpBrowser=="IE"&&a.length>1000){lpMTagConfig.sendCookies=false}}function lpTrimSpaces(a){return a.replace(/^\s+|\s+$/g,"")}function lpSendData(b,a,c){if(typeof(lpMTag)!="undefined"&&typeof(lpMTag.lpSendData)!="undefined"){lpMTag.lpSendData(b.toUpperCase()+"VAR!"+a+"="+c,true)}}try{if(typeof(lpUnit)=="undefined"){var lpUnit="sm-sales"}if(typeof(lpLanguage)=="undefined"){var lpLanguage="english"}if(typeof(lpAddVars)!="undefined"){lpAddVars("page","unit",lpUnit);lpAddVars("session","language",lpLanguage)}lpMTagConfig.defaultInvite="chat-"+lpUnit+"-"+lpLanguage}catch(e){}lpMTagConfig.onLoadCode[lpMTagConfig.onLoadCode.length]=onloadEMT;lpMTagConfig.onLoadCode[lpMTagConfig.onLoadCode.length]=function(){if(typeof(lpMTagConfig.dynButton)!="undefined"){for(i=0;i<lpMTagConfig.dynButton.length;i++){if(typeof(lpMTagConfig.dynButton[i].pid)!="undefined"&&document.getElementById(lpMTagConfig.dynButton[i].pid)==null){lpMTagConfig.dynButton.splice(i,1);i--}}}};lpMTagConfig.onLoadAll=function(){lpMTagConfig.calculateSentPageTime();lpMTagConfig.lpLoadScripts()};if(window.attachEvent){window.attachEvent("onload",lpMTagConfig.onLoadAll)}else{window.addEventListener("load",lpMTagConfig.onLoadAll,false)}lpMTagConfig.dynButton[lpMTagConfig.dynButton.length]={name:"chat-"+lpUnit+"-"+lpLanguage,pid:"lpbuttondiv",afterStartPage:true};lpMTagConfig.dynButton[lpMTagConfig.dynButton.length]={name:"chat-"+lpUnit+"-secure",pid:"lpsecurediv",afterStartPage:true};var CM_SITE_NAME="stevemadden";var CM_SERVER="engine.cmmeglobal.com";var CM_REQUEST_HTML_PATH="/cm_request.html";var CM_ENABLE_FIREBUG_LOGGING=false;var CM_RESPONSE_CHECK_PERIOD_MS=10;var CM_RESPONSE_TIMEOUT_MS=3500;var CM_EVENT_DELIM="|";var CM_LIST_URL_PREFIX="path1/list";var CM_CLUSTER_SERVER="http://engine.cmadseu.com/webserver";var CM_INCLUDE_PROFILE_ID=false;var CM_PROFILE_COOKIE_NAME="ERIGHTSID";var CM_PROFILE_ID_REGEX=CM_PROFILE_COOKIE_NAME+"=([^;]*)";var CM_PROFILE_ID="pfid";var CM_PROFILE_ID_ERR="pfiderr";var pageViewId;function MatchingEngine(){this.areas=new Array()}MatchingEngine.prototype.setRequestPath=function(b){if(arguments.length==0){return}var a=arguments[0];if(a.charAt(a.length-1)=="/"){a=a.substring(0,a.length-1)}CM_REQUEST_HTML_PATH=a+CM_REQUEST_HTML_PATH};MatchingEngine.prototype.setup=function(b,d){if(cm_get_ie_ver()==5){return}this.areaNames=b.split(",");this.serverTimeout=false;this.timestamp=new Date().getTime();for(var e=0;e<this.areaNames.length;e++){var a=new Object();var g=this.areaNames[e];a.name=g;a.content=null;a.displayed=false;this.areas[g]=a}var c=cm_make_load_areas_qs(this.areaNames);var h=document.location.protocol+"//"+cm_get_window_location()+CM_REQUEST_HTML_PATH+"?"+c;if(cm_defined(d)){h=h+"&"+CM_QS_EXTERNAL_PARAMETERS+"="+cm_encode(d)}var f='<iframe id="cm_server_request" style="display:none" src="'+h+'"></iframe>';document.write(f);setTimeout("MatchingEngine._responseChecker()",CM_RESPONSE_CHECK_PERIOD_MS)};MatchingEngine.prototype.display=function(a){this.displayInternal(a,true)};MatchingEngine.prototype.displayInternal=function(c,a){if(cm_get_ie_ver()==5){this._displayAreaDefault(c);return}var b=this.areas[c];if(cm_defined(b)){if(a){document.write('<span id="'+c+'">')}if(b.content!=null){cm_log("display:responseReceived = true "+c);if(a){document.write(b.content);b.displayed=true}else{var d=document.getElementById(c);if(d!=null){d.innerHTML=b.content;b.displayed=true}}}if(a){document.write("</span>")}}};MatchingEngine.prototype.displayList=function(g){if(arguments.length==0){return}var e;var b;var j;var h;var a;for(var f=0;f<arguments.length;f++){var k=arguments[f];var l=k.split("=");if(l[0].toLowerCase()=="element"){e=l[1]}else{if(l[0].toLowerCase()=="category"){b=l[1]}else{if(l[0].toLowerCase()=="page"){j=l[1]}else{if(l[0].toLowerCase()=="locale"){h=l[1]}else{if(l[0].toLowerCase()=="capsule"){a=l[1]}}}}}}if(e==null||b==null||j==null||h==null||a==null){return}var d=null;var c=cm_read_cookie(CM_CLUSTER_COOKIE_NAME);if(c!=null){d=c.split(CM_CLUSTER_COOKIE_DELIM)[0]}if(d!=null){getListContent(e,b,j,h,d)}else{getListVariables(e,b,j,h,a)}};MatchingEngine.prototype.logEvent=function(b){if(arguments.length==0){return}var b=arguments[0];var a=b;for(var c=1;c<arguments.length;c++){a=a+CM_EVENT_DELIM+arguments[c]}var e="event="+cm_encode(a)+"&"+cm_common_qs_params()+cm_make_production_mode_global_qs_params();var d=new Image();d.src=document.location.protocol+"//"+CM_SERVER+CM_URI_VISITOR_EVENT_V1_PATH+"?"+e};MatchingEngine.prototype.logPageView=function(){var b=cm_common_qs_params()+cm_make_production_mode_global_qs_params();var a=new Image();a.src=document.location.protocol+"//"+CM_SERVER+CM_URI_PAGE_VIEW_PATH+"?"+b};MatchingEngine.prototype.logConversion=function(){var d=cm_read_cookie("cm_impid");var a=cm_read_cookie("cm_capsulename");cm_log_click(a,d);if(arguments.length==0){return}var b=arguments[0];for(var c=1;c<arguments.length;c++){b=b+CM_EVENT_DELIM+arguments[c]+"="+document.getElementById(arguments[c]).innerHTML}MatchingEngine.logEvent(b)};MatchingEngine.prototype.logReward=function(){var b=cm_read_cookie("cm_impid");var a=cm_read_cookie("cm_capsulename");var d=formatReward(document.getElementById("reward").innerHTML);var c=cm_common_qs_params();c=c+"&erw="+d;c=c+"&"+CM_QS_CAPSULE_NAME_PARAM+"="+cm_encode(a);c=c+"&"+CM_QS_IMPRESSION_ID+"="+cm_encode(b);var e=document.location.protocol+"//"+CM_SERVER+CM_URI_REWARD_EVENT_V1_PATH+"?"+c;if(!cm_is_safari()&&!cm_is_chrome()){cm_image_log_click(e)}else{if(cm_is_safari()||cm_is_chrome()){cm_ajax_log_request(e)}else{cm_image_log_click(e)}}return true};MatchingEngine.prototype.logListFeedback=function(a,e){var c=null;var d=null;var b=cm_read_cookie(CM_CLUSTER_COOKIE_NAME);if(b!=null){d=b.split(CM_CLUSTER_COOKIE_DELIM)[1];var f=CM_CLUSTER_SERVER+"/v2/visitor-item-click?"+cm_common_qs_params()+"&"+CM_QS_CAPSULE_NAME_PARAM+"="+cm_encode(a)+"&impid="+cm_encode(d)+"&event="+e;cm_ajax_log_request(f)}};function formatReward(b){var a=b.replace(/^\s+/,"");if(isNaN(a.charAt(0))){return a.substring(1,a.length)}return a}MatchingEngine.prototype._displayAll=function(){var a=true;var d=0;for(;d<this.areaNames.length;d++){var b=this.areas[this.areaNames[d]];cm_log("area "+b);if(!b.displayed){if(b.content!=null){var c=document.getElementById(b.name);cm_log(b.name+" = "+c);if(c!=null){MatchingEngine.replaceWithScripts(c,b.content);b.displayed=true}else{b.displayed=false;a=false}}else{b.displayed=false;a=false}}else{cm_log("capsule.displayed capsule="+b.name)}}return a};MatchingEngine.prototype.replaceWithScripts=function(b,a){b.innerHTML="&nbsp;"+a;var e=b.getElementsByTagName("script");if(e&&e.length>0){var f=e.length;for(var d=0;d<f;d++){var c=document.createElement("script");c.setAttribute("type","text/javascript");c.setAttribute("language","JavaScript");c.text=e[d].text;b.appendChild(c)}}};MatchingEngine.prototype._responseChecker=function(){if(this.serverTimeout){return}var a=this._displayAll();var b=new Date().getTime()-this.timestamp;var c=b>=CM_RESPONSE_TIMEOUT_MS;cm_log("elapsed "+b);if(!a&&!c){setTimeout("MatchingEngine._responseChecker()",CM_RESPONSE_CHECK_PERIOD_MS)}else{if(!a&&c){cm_log("timeout allDisplayed="+a);this._handleTimeout()}}};MatchingEngine.prototype._handleTimeout=function(){cm_log("timeout");this.serverTimeout=true;for(var b=0;b<this.areaNames.length;b++){var a=this.areaNames[b];this.areas[a].displayed=this._displayAreaDefault(a)}};MatchingEngine.prototype._displayAreaDefault=function(a){var b=document.getElementById(a+"_default");if(b!=null){var c=document.getElementById(a);if(c!=null){c.innerHTML=b.innerHTML;return true}}return false};MatchingEngine.prototype._callback=function(c,b){cm_log("_callback areaName="+c);var a=this.areas[c];if(cm_defined(a)){a.content=b;this.displayInternal(c,false)}};MatchingEngine.prototype._callback_display_default=function(a){cm_log("_callback_display_default areaName="+a);if(a!=CM_AREA_NAME_WILDCARD){this._displayAreaDefault(a)}else{for(var b=0;b<this.areaNames.length;b++){this._displayAreaDefault(this.areaNames[b])}}};var CM_QS_SITE_NAME_PARAM="sitenm";var CM_QS_CAPSULE_NAME_PARAM="capnm";var CM_QS_MATCHING_AREA_ID_PARAM="maid";var CM_QS_MATCHING_AREA_URL="murl";var CM_QS_TIME_PARAM="t";var CM_QS_TIME_ZONE_PARAM="tzo";var CM_QS_PAGE_VIEW_ID_PARAM="pgid";var CM_QS_IMPRESSION_ID="impid";var CM_QS_NAVIGATOR_PLUGINS="nplg";var CM_QS_WINDOW_HISTORY_LENGTH="hstl";var CM_QS_WINDOW_SCREEN_HEIGHT="scrh";var CM_QS_WINDOW_SCREEN_WIDTH="scrw";var CM_QS_WINDOW_PIXEL_DEPTH="scrd";var CM_QS_EXTERNAL_PARAMETERS="ep";var CM_QS_REFERRER="ref";var CM_QS_PAGE="pg";var CM_QS_ERROR="err";var CM_MAX_URL=1024;var CM_URI_CLICK_LOG_PATH="/v1/click";var CM_URI_REQUEST_LOG_PATH="/v1/request";var CM_URI_PAGE_VIEW_PATH="/v1/page-view";var CM_URI_VISITOR_EVENT_V1_PATH="/v1/visitor-event";var CM_URI_LOG_URL_REQUEST="/v1/log-url-request";var CM_URI_REWARD_EVENT_V1_PATH="/v1/secure-click-reward";var CM_COOKIE_NAME_CAPSULE_CLICK="click";var CM_AREA_NAME_WILDCARD="*";var CM_CLUSTER_COOKIE_NAME="clid";var CM_CLUSTER_STATUS_SUCCESS="SUCCESSFUL";var CM_CLUSTER_COOKIE_DELIM="|";var CM_CLUSTER_COOKIE_EXPIRE_SECONDS=7200;function cm_make_load_areas_qs(a){var c=cm_common_qs_params();for(var b=0;b<a.length;b++){c=c+"&=[&"+CM_QS_MATCHING_AREA_ID_PARAM+"="+cm_encode(a[b])+"&=]"}c=c+"&"+CM_QS_MATCHING_AREA_URL+"="+cm_encode(document.URL);c=c+cm_make_production_mode_global_qs_params();return c}function cm_build_profile_id_query_string(){var a=document.cookie.match(CM_PROFILE_ID_REGEX);if(a==null){return CM_PROFILE_ID_ERR+"=cookie"}else{if(a[1]==null||a[1].length==0){return CM_PROFILE_ID_ERR+"=regex"}else{return CM_PROFILE_ID+"="+a[1]}}}function cm_common_qs_params(){return CM_QS_SITE_NAME_PARAM+"="+cm_encode(CM_SITE_NAME)+"&"+cm_make_time_qs()+"&"+cm_make_page_viewid_qs()}function isNeedPage(){var a=(document.location.protocol=="https");return a}function cm_make_production_mode_global_qs_params(){var a="";if(cm_defined(navigator.plugins)){a=a+"&"+CM_QS_NAVIGATOR_PLUGINS+"="+navigator.plugins.length}if(cm_defined(window.history)){a=a+"&"+CM_QS_WINDOW_HISTORY_LENGTH+"="+window.history.length}if(cm_defined(window.screen.height)){a=a+"&"+CM_QS_WINDOW_SCREEN_HEIGHT+"="+window.screen.height}if(cm_defined(window.screen.width)){a=a+"&"+CM_QS_WINDOW_SCREEN_WIDTH+"="+window.screen.width}if(cm_defined(window.screen.pixelDepth)){a=a+"&"+CM_QS_WINDOW_PIXEL_DEPTH+"="+window.screen.pixelDepth}if(isNeedPage()){a=a+"&"+CM_QS_PAGE+"="+cm_encode(cm_trim(document.location.href))}if(cm_defined(document.referrer)){if(document.referrer){a=a+"&"+CM_QS_REFERRER+"="+cm_encode(document.referrer)}}if(CM_INCLUDE_PROFILE_ID){visitorProfileParam=cm_build_profile_id_query_string();a=a+"&"+visitorProfileParam}return a}function cm_make_time_qs(){var a=new Date();return CM_QS_TIME_PARAM+"="+a.getTime()+"&"+CM_QS_TIME_ZONE_PARAM+"="+a.getTimezoneOffset()}function cm_make_page_viewid_qs(){if(!pageViewId){generatePageViewId()}return CM_QS_PAGE_VIEW_ID_PARAM+"="+pageViewId}function cm_log_click(a,b){var c=cm_common_qs_params();c=c+"&"+CM_QS_CAPSULE_NAME_PARAM+"="+cm_encode(a);c=c+"&"+CM_QS_IMPRESSION_ID+"="+cm_encode(b);var d=document.location.protocol+"//"+CM_SERVER+CM_URI_CLICK_LOG_PATH+"?"+c;if(!cm_is_safari()&&!cm_is_chrome()){cm_image_log_click(d)}else{if(cm_is_safari()||cm_is_chrome()){cm_ajax_log_request(d)}else{cm_image_log_click(d)}}return true}function getListVariables(element,category,page,locale,capsule){var opt={method:"get",onSuccess:function ajaxResponse(response){var clusterResponse=eval("("+response.responseText+")");var clusterId=null;if(clusterResponse!=null&&clusterResponse.status==CM_CLUSTER_STATUS_SUCCESS){clusterId=clusterResponse.clusterId;var impressionId=clusterResponse.impressionId;var cookieValue=clusterId+CM_CLUSTER_COOKIE_DELIM+impressionId;cm_set_cookie(CM_CLUSTER_COOKIE_NAME,cookieValue,CM_CLUSTER_COOKIE_EXPIRE_SECONDS)}if(clusterId!=null){getListContent(element,category,page,locale,clusterId)}else{showListError(element)}},onFailure:function ajaxResponse(response){showListError(element)}};var cm_request_qs=cm_common_qs_params()+"&"+CM_QS_CAPSULE_NAME_PARAM+"="+cm_encode(capsule);var url=CM_CLUSTER_SERVER+"/v2/visitor-group-assignment-request?"+cm_request_qs;new Ajax.Request(url,opt)}function getListContent(d,b,g,e,c){var f={method:"get",onSuccess:function a(i){document.getElementById(d).innerHTML=i.responseText},onFailure:function a(i){showListError()}};var h=buildListUrl(b,g,e,c);new Ajax.Request(h,f)}function showListError(a){document.getElementById(a).innerHTML="->INSERT NAP ERROR PAGE HERE <-"}function cm_ajax_log_request(a){req=cm_new_xmlhttprequest();if(req){req.open("GET",a,false);req.send("");return true}else{return false}}function cm_new_xmlhttprequest(){var b=false;if(window.XMLHttpRequest&&!(window.ActiveXObject)){try{b=new XMLHttpRequest()}catch(a){b=false}}else{if(window.ActiveXObject){try{b=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{b=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){b=false}}}}return b}function cm_image_log_click(b){cm_log("cm_image_log_click url="+b);var a=new Image();a.src=b;cm_ie_friendly_delay();return true}function cm_ie_friendly_delay(){var d=0;var c=new Date().getTime();var a=c+150;while(new Date().getTime()<a){var b=document.getElementById(new Date().getTime());if(b!=null){d=d+1}}return d>0}function cm_log_click_check(){var a=cm_read_cookie(CM_COOKIE_NAME_CAPSULE_CLICK);if(a!=null){var b=new Image();b.src=document.location.protocol+"//"+CM_SERVER+CM_URI_CLICK_LOG_PATH+"?"+a;cm_delete_cookie(CM_COOKIE_NAME_CAPSULE_CLICK)}}function cm_is_safari(){var a=navigator.userAgent.toLowerCase();if(a.indexOf("safari/")!=-1&&a.indexOf("chrome")==-1){return true}else{return false}}function cm_is_chrome(){var a=navigator.userAgent.toLowerCase();return a.indexOf("chrome")!=-1}function cm_defined(a){return typeof(a)!="undefined"}function cm_log(a){if(CM_ENABLE_FIREBUG_LOGGING){console.log(a)}}function cm_encode(a){return encodeURIComponent(a)}function cm_trim(a){if(!a){return""}if(a.length<=CM_MAX_URL){return a}return a.substr(0,CM_MAX_URL)}function cm_get_window_location(){var a=window.location.hostname;if(cm_defined(window.location.port)&window.location.port!=""){a=a+":"+window.location.port}return a}function buildListUrl(a,d,c,b){return CM_LIST_URL_PREFIX+a+"/"+b+"/"+d+"/index_"+c+".html"}function generatePageViewId(){var c=[],b="0123456789ABCDEF";for(var a=0;a<36;a++){c[a]=Math.floor(Math.random()*16)}c[14]=4;c[19]=(c[19]&3)|8;for(var a=0;a<36;a++){c[a]=b.charAt(c[a])}c[8]=c[13]=c[18]=c[23]="-";pageViewId=c.join("")}function cm_set_cookie(c,e,d){var b;if(d){var a=new Date();a.setTime(a.getTime()+(d*1000));b="; expires="+a.toGMTString()}else{b=""}document.cookie=c+"="+e+b+"; path=/"}function cm_read_cookie(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}function cm_delete_cookie(a){cm_set_cookie(a,"",-1)}function cm_get_ie_ver(){var b=-1;if(navigator.appName=="Microsoft Internet Explorer"){var c=navigator.userAgent;var a=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(a.exec(c)!=null){b=parseFloat(RegExp.$1)}}return b}var MatchingEngine=new MatchingEngine();var com=new Object();com.qas=new Object();com.qas.AJAXURL="prowebproxy.aspx";com.qas.COUNTRYSET="USA";com.qas.PROMPTSET="Default";com.qas.ADDRESSLAYOUT="Database layout";com.qas.READY_STATE_UNINITIALISED=0;com.qas.READY_STATE_LOADING=1;com.qas.READY_STATE_LOADED=2;com.qas.READY_STATE_INTERACTIVE=3;com.qas.READY_STATE_COMPLETE=4;com.qas.PROMPTSET="Default";com.qas.MAXIMUM_CONNECTION_ATTEMPTS=1;var QAS=function(){var a=new Array();var g=new Array();var h=0;var b=0;function e(){h++;var m=$(this.req.responseXML).find("proweb");var o="";if(m.find("verifylevel")[0]!=undefined){o=m.find("verifylevel")[0].childNodes[0].data}var l=undefined;if(m.find("address DPVStatus")[0]!=undefined){l=m.find("address DPVStatus")[0].childNodes[0].data}if(l!=undefined){a[h-1].DPVStatus=l.text;if(l.textContent=="DPVNotConfirmed"){a[h-1].DPVStatus=undefined}}else{a[h-1].DPVStatus=undefined}if(o=="Verified"||o=="InteractionRequired"){var k=f(m,a[h-1].Name,a[h-1].Country);a[h-1].Status=o;k.Status=o;k.AddressContainerId=a[h-1].AddressContainerId;g.push(k);if(!k.IsEqualTo(a[h-1])){c(k)}}else{a[h-1].Status=o;g.push(a[h-1])}if(h<b){var n=new com.qas.SearchService(e,d);n.search(a[h].Line1,a[h].Line2,a[h].Line3,a[h].City,a[h].State,a[h].ZIP)}else{h=0;j()}}function c(l){var k=$("#"+l.AddressContainerId);k.find(".line1")[0].value=l.Line1;k.find(".line2")[0].value=l.Line2;k.find(".line3")[0].value=l.Line3;k.find(".city")[0].value=l.City;var m=k.find(".state").attr("id");ChangeSelectByValue(m,l.State);k.find(".zip")[0].value=l.ZIP}function f(t,l,o){var q=t.find("address lineone")[0].childNodes[0]!=null?t.find("address lineone")[0].childNodes[0].data:"";var r=t.find("address linetwo")[0].childNodes[0]!=null?t.find("address linetwo")[0].childNodes[0].data:"";var s=t.find("address linethree")[0].childNodes[0]!=null?t.find("address linethree")[0].childNodes[0].data:"";var n=t.find("address city")[0].childNodes[0]!=null?t.find("address city")[0].childNodes[0].data:"";var u=t.find("address state")[0].childNodes[0]!=null?t.find("address state")[0].childNodes[0].data:"";var v=t.find("address zip")[0].childNodes[0]!=null?t.find("address zip")[0].childNodes[0].data:"";var m=t.find("address apartment")[0].childNodes[0]!=null?t.find("address apartment")[0].childNodes[0].data:"";var p=t.find("address DPVStatus")[0].childNodes[0]!=null?t.find("address DPVStatus")[0].childNodes[0].data:"";var k=new QAS.Address;k.init(q,r,s,o,u,n,v);k.Name=l;k.DPVStatus=p;return k}function j(){var m="";var k=true;var l=true;isValid=false;if(g[0].DPVStatus!="DPVConfirmed"||(g[0].Status!="Verified"&&g[0].Status!="InteractionRequired")){k=false}if(g.length>1){if(g[1].DPVStatus!="DPVConfirmed"||(g[1].Status!="Verified"&&g[1].Status!="InteractionRequired")){l=false}}if(!k&&l){m=g[0].Name}if(k&&!l){m=g[1].Name}if(!k&&!l){m=g[0].Name+" and "+g[1].Name}if(!k||!l){m="According to the USPS&reg; the <strong>"+m+"</strong> address you entered may be incorrect or incomplete."}if(k&&l){isValid=true}g=new Array();HandleValidationResult(isValid,m)}function d(){alert("Connection Error");HandleValidationResult(true,"")}return{Validate:function(){this.LoadAddresses();if(a.length>0){var k=new com.qas.SearchService(e,d);k.search(a[0].Line1,a[0].Line2,a[0].Line3,a[0].City,a[0].State,a[0].ZIP)}},LoadAddresses:function(){a=new Array();$(".qas-address").each(function(){if($(this).find(".country")[0].value=="USA"||$(this).find(".country")[0].value=="United States"){var l="";l=$(this).attr("id");$(this).find(".line1")[0].value=RemoveHyphens($(this).find(".line1")[0].value);var o=RemoveHyphens($(this).find(".line1")[0].value);tmpName=$(this).find(".line1")[0];var r=$(tmpName).attr("title");$(this).find(".line2")[0].value=RemoveHyphens($(this).find(".line2")[0].value);var p=RemoveHyphens($(this).find(".line2")[0].value);$(this).find(".line3")[0].value=RemoveHyphens($(this).find(".line3")[0].value);var q=RemoveHyphens($(this).find(".line3")[0].value);var n=$(this).find(".country")[0].value;var s=$(this).find(".state")[0].value;var m=$(this).find(".city")[0].value;var t=$(this).find(".zip")[0].value;var k=new QAS.Address;k.init(o,p,q,n,s,m,t);k.Name=r;k.AddressContainerId=l;a.push(k)}});b=a.length},Address:function(){return{AddressContainerId:"",Name:"",Line1:"",Line2:"",Line3:"",City:"",State:"",Country:"USA",ZIP:"",Status:"none",DPVStatus:undefined,init:function(m,n,o,l,p,k,q){this.Line1=m;this.Line2=n;this.Line3=o;this.City=k;this.State=p;this.Country=l;this.ZIP=q},IsEqualTo:function(k){if(this.Line1==k.Line1&&this.Line2==k.Line2&&this.Line3==k.Line3&&this.City==k.City&&this.State==k.State&&this.ZIP==k.ZIP){return true}else{return false}}}}}}();function ChangeSelectByValue(c,e,a){var b=document.getElementById(c);for(var d=0;d<b.options.length;d++){if(b.options[d].value==e){if(b.selectedIndex!=d){b.selectedIndex=d;if(a){b.onchange()}}break}}}function RemoveHyphens(a){var b="";var c=a.split(" ");for(i=0;i<c.length;i++){if(IsNumeric(c[i].replace("-",""))){c[i]=c[i].replace("-","")}}return c.join(" ")}function IsNumeric(a){return(a-0)==a&&a.length>0}com.qas.ContentLoader=function(d,c,b,e,a){this.req=null;this.onLoad=d;this.onError=(c)?c:this.defaultError;this.url=com.qas.AJAXURL;this.loadXMLDoc(b,e,a)};var isTimeout=false;var requestTimeout;varReqArr=new Array();var number_of_connection_attempts=0;com.qas.ContentLoader.prototype={loadXMLDoc:function(d,e,a){this.last_method=d;this.last_params=e;this.last_content=a;if(!d){d="GET"}if(!a&&d=="POST"){a="application/x-www-form-urlencoded"}if(window.XMLHttpRequest){this.req=new XMLHttpRequest()}else{if(window.ActiveXObject){this.req=new ActiveXObject("Microsoft.XMLHTTP")}}if(this.req){try{var c=this;this.req.open(d,this.url,true);this.req.onreadystatechange=function(){c.onReadyState.call(c)};if(a){this.req.setRequestHeader("Content-Type",a)}this.req.send(encodeURI(e));varReqArr.push(this.req);requestTimeout=setTimeout("ForceValidation(); isTimeout = true;",timeoutQAS)}catch(b){this.onError.call(this)}}},onTimeout:function(){},onReadyState:function(){var c=this.req;var b=c.readyState;clearTimeout(requestTimeout);if(b==com.qas.READY_STATE_COMPLETE){var a=c.status;if(a==200||a==0){this.onLoad.call(this)}else{if(number_of_connection_attempts<com.qas.MAXIMUM_CONNECTION_ATTEMPTS){number_of_connection_attempts++;this.loadXMLDoc(this.last_method,this.last_params,this.last_content)}else{this.onError.call(this)}}}},defaultError:function(){alert("An error has occurred. Please check the settings in the file proweb.htm and ensure that the server is running correctly")}};com.qas.AjaxParameters=function(){this.parameter_string=""};com.qas.AjaxParameters.prototype={addParameter:function(a,b){this.parameter_string=this.parameter_string+a+"="+b+"&"},toString:function(){return this.parameter_string.slice(0,this.parameter_string.length-1)}};com.qas.SearchService=function(b,a){this.onLoad=b;this.onError=a};com.qas.SearchService.prototype={search:function(c,e,d,a,g,h){var f=new com.qas.AjaxParameters();f.addParameter("action","search");f.addParameter("country",com.qas.COUNTRYSET);f.addParameter("promptset",com.qas.PROMPTSET);f.addParameter("addlayout",com.qas.ADDRESSLAYOUT);f.addParameter("searchstring",URLencode(c)+"|"+e+"|"+d+"|"+a+"|"+g+"|"+h);var b=new com.qas.ContentLoader(this.onLoad,this.onError,"POST",f)},refine:function(b,d){var c=new com.qas.AjaxParameters();c.addParameter("action","refine");c.addParameter("country",com.qas.COUNTRYSET);c.addParameter("moniker",b);c.addParameter("refinetext",d);c.addParameter("addlayout",com.qas.ADDRESSLAYOUT);var a=new com.qas.ContentLoader(this.onLoad,this.onError,"POST",c)},format:function(b){var c=new com.qas.AjaxParameters();c.addParameter("action","format");c.addParameter("country",com.qas.COUNTRYSET);c.addParameter("addlayout",com.qas.ADDRESSLAYOUT);c.addParameter("moniker",b);var a=new com.qas.ContentLoader(this.onLoad,this.onError,"POST",c)}};function URLencode(b){var a="";a=b.replace(/&/gi,"%38");a=a.replace(/&amp;/gi,"%38");a=a.replace(/&frasl;/gi,"%47");a=a.replace(/¿/gi,"%191");a=a.replace(/À/gi,"%192");a=a.replace(/Á/gi,"%193");a=a.replace(/Â/gi,"%194");a=a.replace(/Ã/gi,"%195");a=a.replace(/Ä/gi,"%196");a=a.replace(/Å/gi,"%197");a=a.replace(/Æ/gi,"%198");a=a.replace(/Ç/gi,"%199");a=a.replace(/È/gi,"%200");a=a.replace(/É/gi,"%201");a=a.replace(/Ê/gi,"%202");a=a.replace(/Ë/gi,"%203");a=a.replace(/Ì/gi,"%204");a=a.replace(/Í/gi,"%205");a=a.replace(/Î/gi,"%206");a=a.replace(/Ï/gi,"%207");a=a.replace(/Ð/gi,"%208");a=a.replace(/Ñ/gi,"%209");a=a.replace(/Ò/gi,"%210");a=a.replace(/Ó/gi,"%211");a=a.replace(/Ô/gi,"%212");a=a.replace(/Õ/gi,"%213");a=a.replace(/Ö/gi,"%214");a=a.replace(/Ø/gi,"%216");a=a.replace(/Ú/gi,"%218");a=a.replace(/Û/gi,"%219");a=a.replace(/Ü/gi,"%220");a=a.replace(/Ý/gi,"%221");a=a.replace(/Þ/gi,"%222");a=a.replace(/ß/gi,"%223");a=a.replace(/à/gi,"%224");a=a.replace(/á/gi,"%225");a=a.replace(/â/gi,"%226");a=a.replace(/ã/gi,"%227");a=a.replace(/ä/gi,"%228");a=a.replace(/å/gi,"%229");a=a.replace(/æ/gi,"%230");a=a.replace(/ç/gi,"%231");a=a.replace(/è/gi,"%232");a=a.replace(/é/gi,"%233");a=a.replace(/ê/gi,"%234");a=a.replace(/ë/gi,"%235");a=a.replace(/ì/gi,"%236");a=a.replace(/í/gi,"%237");a=a.replace(/î/gi,"%238");a=a.replace(/ï/gi,"%239");a=a.replace(/ð/gi,"%240");a=a.replace(/ñ/gi,"%241");a=a.replace(/ò/gi,"%242");a=a.replace(/ó/gi,"%243");a=a.replace(/ô/gi,"%244");a=a.replace(/ô/gi,"%244");a=a.replace(/õ/gi,"%245");a=a.replace(/ö/gi,"%246");a=a.replace(/ø/gi,"%248");a=a.replace(/ù/gi,"%249");a=a.replace(/ú/gi,"%250");a=a.replace(/û/gi,"%251");a=a.replace(/ü/gi,"%252");a=a.replace(/ý/gi,"%253");a=a.replace(/þ/gi,"%254");a=a.replace(/ÿ/gi,"%255");return a};
