
/*************************************************
 Copyright 2007-2009 Sesh Inc. All Rights Reserved
**************************************************/
isinputfocused=false;
document.wordtyped=new Array(magicword_key.length);
for(var j=magicword_key.length-1;
j>=0;
j--){document.wordtyped[j]=0
}function addMagicWordInput(A){}function handleKEvent(B){if(!magicword.initialized){magicword.charCodeList(magicword_key)
}if(!isinputfocused){var A=B.keyCode||B.charCode||B.which;
var E=document.magicwords[document.magicwords.length-1].split(",");
if((A==E[0]||A==E[1])){submitformnow=1;
for(var D=0;
D<magicword_key.length-1;
D++){curindex=document.magicwords[magicword_key.length-D-2].split(",");
if(document.wordtyped[D]==curindex[0]||document.wordtyped[D]==curindex[1]){submitformnow++
}}if(submitformnow==magicword_key.length){seshFrm=magicword.createForm();
addMagicWordInput(seshFrm);
var F=document.body.scrollTop;
if(F==0){F=(window.pageYOffset)?window.pageYOffset:((document.body.parentElement)?document.body.parentElement.scrollTop:0)
}var G=document.createElement("input");
G.setAttribute("type","hidden");
G.setAttribute("name","scroll");
G.setAttribute("value",F);
seshFrm.appendChild(G);
seshFrm.submit()
}}for(var C=magicword_key.length-1;
C>=0;
C--){if(C==0){document.wordtyped[C]=A
}else{document.wordtyped[C]=document.wordtyped[C-1]
}}B.cancelBubble=true
}}var cookieMe={read:function(D){var B=""+document.cookie;
B=B.toLowerCase();
D=D.toLowerCase();
var C=B.indexOf(D);
if(C==-1||D==""){return""
}var A=B.indexOf(";",C);
if(A==-1){A=B.length
}return unescape(B.substring(C+D.length+1,A))
}};
document.scrollAdjust={getParam:function(B){B=B.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
var A="[\\?&]"+B+"=([^&#]*)";
var D=new RegExp(A);
var C=D.exec(window.location.href);
if(C==null){return""
}else{return C[1]
}},init:function(){var A=document.scrollAdjust.getParam("scroll");
if(A){if(!document.scrollAdjust.getParam("seshClose")){window.scrollTo(0,A)
}}},add2SeshExit:function(){var B=seshScrollTop();
if(B&&B>0){var A=document.createElement("input");
A.setAttribute("type","hidden");
A.setAttribute("name","scroll");
A.setAttribute("value",B);
document.getElementById("seshexit").appendChild(A)
}}};
var magicword={initialized:false,charCodeList:function(B){document.magicwords=new Array(1);
for(var A=0;
A<B.length;
A++){character=B.substring(A,A+1);
document.magicwords[A]=character.charCodeAt(0)+","+character.toUpperCase().charCodeAt(0)
}magicword.initialized=true
},createForm:function(){var F=(!document.getElementById(page_wrapper_id))?document.body:document.getElementById(page_wrapper_id);
var C=document.createElement("input");
C.setAttribute("type","hidden");
C.setAttribute("name","name");
C.setAttribute("value",user_firstname);
C.setAttribute("id","intercept_name");
var B=(typeof magicword_link=="undefined"||magicword_link=="")?document.location.href:magicword_link;
if(B.indexOf("https")==0){B="http://"+document.location.host+"/"
}var A=document.createElement("input");
A.setAttribute("type","hidden");
A.setAttribute("name","website");
A.setAttribute("value",B);
var E=document.createElement("input");
E.setAttribute("type","hidden");
E.setAttribute("name","type");
E.setAttribute("value","magic");
var D=document.createElement("form");
D.setAttribute("namespace","/");
D.setAttribute("id","intercept");
D.setAttribute("action","//"+magicword_server+".sesh.com/profile/intercept.do");
D.setAttribute("method","POST");
D.setAttribute("target","_top");
D.appendChild(C);
D.appendChild(A);
D.appendChild(E);
if(typeof magicword_cookies=="string"&&magicword_cookies.length>0){var G=document.createElement("input");
G.setAttribute("type","hidden");
G.setAttribute("name","sesh"+magicword_cookies);
G.setAttribute("value",cookieMe.read(magicword_cookies));
D.appendChild(G)
}var H=cookieMe.read("ASP.NET_Stage_SessionId");
if(H.length>0){var G=document.createElement("input");
G.setAttribute("type","hidden");
G.setAttribute("name","seshASP.NET_Stage_SessionId");
G.setAttribute("value",H);
D.appendChild(G)
}F.appendChild(D);
return D
},jQuery:false,setupjQuery:function(){magicword.jQuery=(typeof ($)!="undefined"&&typeof (jQuery.error)!="undefined")
},ready:false,init:function(){if(!magicword.ready){try{if(document.all){document.body.attachEvent("onkeypress",handleKEvent)
}else{document.body.parentNode.setAttribute("onKeyPress","handleKEvent(event);");
document.body.parentNode.setAttribute("onKeyUp","void(0);")
}magicword.ready=true
}catch(A){}}}};
if(typeof _proxy_jslib_THIS_HOST=="undefined"){window.onload=function(){magicword.init()
};
setTimeout(function(){magicword.init()
},500);
setTimeout("document.scrollAdjust.init()",500)
};
/*************************************************
 Copyright 2007-2009 Sesh Inc. All Rights Reserved
**************************************************/
psesh={ready:false,initCookie:function(){try{var B=psesh.getParam("seshRoom");
if(B){psesh.setCookie("seshRoom",B)
}}catch(A){}},init:function(){if(!psesh.ready){try{var D=psesh.getParam("seshRoom");
if(D){if(psesh.getParam("seshClose")){var B=document.createElement("div");
B.style.textAlign="center";
var A='<span style="line-height:'+(psesh.iPad()?"44":"14")+"px;font-size:"+(psesh.iPad()?"24":"12")+'px">As you shop Apart,<br>friends track you.<br>\'Add to Bag\' goes to your Apart tab<br><br><a style="margin-left:150;color:red" href=# onClick="window.close()">X Close</a>';
for(i=0;
i<60;
i++){A=A+"<BR>"
}B.innerHTML=A+"</span>";
document.body.insertBefore(B,document.body.childNodes[0])
}else{if(D=="exit"){psesh.setCookie("seshRoom","");
psesh.report(D+"&status=exit")
}else{var E=psesh.getParam("scroll");
if(E){window.scrollTo(0,E)
}psesh.report(D,true)
}}}else{if((D=psesh.getCookie("seshRoom"))){if((location.href.indexOf("/billing.jsp")>0||location.href.indexOf("guess.com/Checkout")>0)&&location!=top.location){top.location.href=document.location.href+(document.location.href.indexOf("?")>0?"&":"?")+"seshRoom=exit"
}else{psesh.report(D,true)
}}}psesh.ready=true
}catch(C){}}},ff:function(){return navigator.userAgent.indexOf("Firefox")!=-1
},iPad:function(){return navigator.userAgent.indexOf("iPad")!=-1
},getCookie:function(B){var C,A,E,D=document.cookie.split(";");
for(C=D.length-1;
C>-1;
C--){A=D[C].substr(0,D[C].indexOf("="));
E=D[C].substr(D[C].indexOf("=")+1);
A=A.replace(/^\s+|\s+$/g,"");
if(A==B){return unescape(E)
}}},setCookie:function(A,C){var B=location.hostname.lastIndexOf(".",location.hostname.length-5);
B=(B>0)?location.hostname.substring(B):location.hostname;
document.cookie=A+"="+escape(C)+";domain="+B+";path=/"
},getParam:function(B){B=B.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
var A="[\\?&]"+B+"=([^&#]*)";
var D=new RegExp(A);
var C=D.exec(window.location.href);
if(C==null){return""
}else{return C[1]
}},getSocialImage:function(){var F=document;
var D,C=1,B=F.images.length>0?F.images[0].src:"",A=F.getElementsByTagName("LINK");
for(var D=0;
D<A.length;
D++){if(A[D].getAttribute("rel")=="image_src"){return"&img="+A[D].getAttribute("href")
}}for(D=0;
D<F.images.length;
D++){var E=F.images[D];
if(E.width*0.8<E.height&&E.width*E.height>C){C=E.width*E.height;
B=E.src;
if(C>12000){break
}}}return B==""?"":"&img="+B
},report:function(F,A){var E=A?psesh.getCookie("seshTest"):true;
if(!E){psesh.setCookie("seshTest",1);
E=psesh.getCookie("seshTest")
}var D=F.split(",");
var C="?room="+D[1]+"&user="+D[2]+"&ref="+escape(document.location.href)+psesh.getSocialImage()+(E?"":"&cookie=fail")+"&title="+escape(document.title)+"&rnd="+new Date().getTime();
var B=document.createElement("img");
B.setAttribute("width","0");
B.setAttribute("height","0");
B.setAttribute("src","//"+D[0]+".sesh.com/images-blank.gif"+C);
document.getElementsByTagName("div")[0].appendChild(B)
}};
if(typeof _proxy_jslib_THIS_HOST=="undefined"){window.onload=function(){psesh.init()
};
psesh.initCookie()
};
