(function(){function C(L,N){var P,O,K,M;L.style.left=0;L.style.top=0;P=LMI.Element.getOffsets(N);O=LMI.Element.getOffsets(L);K=P.x-O.x+(0.3*L.offsetWidth);M=(K<0?0:K);L.style.left=M+"px";L.style.top=(P.y-O.y-180)+"px"}function H(L){var P=LMI.MinEvents.findTarget(L,"A"),O=document.getElementById("loginWidget"),Q={x:0,y:0},N,K,M=YAHOO.util.Dom;L=L||window.event;if(L.pageX){Q.x=L.pageX;Q.y=L.pageY}else{if(L.clientX){Q.x=L.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;Q.y=L.clientY+document.body.scrollTop+document.documentElement.scrollTop}}Q.x=(Q.x-140<0)?0:Q.x-140;Q.y=(Q.y-45<0)?0:Q.y-45;K=document.getElementById("registerWidget");if(K){K.style.left=Q.x+"px";if(Q.y+K.offsetHeight>M.getViewportHeight()-10){Q.y=Q.y-(Q.y+K.offsetHeight-M.getViewportHeight());Q.y=(Q.y<0?0:Q.y)}K.style.top=Q.y+"px"}}function I(K){var L=document.getElementById("captcha");if(L){L=L.getElementsByTagName("img")[0];L.src=LMI.Data.Urls.registerCaptcha+"?t="+new Date().getTime()}}function E(K){var L=document.getElementById("loginRegister");I(K);K.style.visibility="hidden";LMI.PopupForm.showElem(K);C(K,L);K.style.visibility="visible";LMI.PopupForm.focusForm(K)}function G(K){I(K);LMI.PopupForm.showElem(K);LMI.PopupForm.focusForm(K)}function F(K){return function(S){var N=document.getElementById("userLinks"),T,Y,V,W,X,R=K.value,U,Q,P,L,O;if(document.body.id!="mywww"){while(N&&N.firstChild){N.removeChild(N.firstChild)}W=document.createElement("span");W.appendChild(document.createTextNode(LMI.Strings.getString("js.hdr.welcome",R)));N.appendChild(W);if(document.getElementById("fromAddress")){document.getElementById("fromAddress").value=R}X=document.createElement("div");X.id="userLinksList";T=document.createElement("ul");T.className="linkList horizontalLinkList";V=document.createElement("a");V.href=LMI.Data.Urls.editAccount;V.rel="nofollow";V.appendChild(document.createTextNode(LMI.Strings.getString("js.page.myacct")));Y=document.createElement("li");Y.appendChild(V);Y.appendChild(document.createTextNode(" |"));T.appendChild(Y);V=document.createElement("a");V.href=LMI.Data.Urls.logout;V.appendChild(document.createTextNode(LMI.Strings.getString("js.hdr.signout")));Y=document.createElement("li");Y.className="last";Y.appendChild(V);T.appendChild(Y);X.appendChild(T);N.appendChild(X);if("visitorVO" in LMI.Data.state){LMI.Data.state.visitorVO=S.visitorVO;LMI.Data.recentSearches=S.recentSearches;LMI.Data.recentLocations=S.recentLocations;U=LMI.DropDown.getById("what");if(U){U.clearSection("recent");L=LMI.Data.recentSearches;if(L){for(P in L){if(L.hasOwnProperty(P)&&L[P].searchTerms){U.addItem(L[P].searchTerms,"recent")}}}}Q=LMI.DropDown.getById("where");if(Q){Q.clearSection("recent");L=LMI.Data.recentLocations;if(L){for(P in L){if(L.hasOwnProperty(P)&&L[P].locationValue){Q.addItem(L[P].locationValue,"recent")}}}}}}else{var M=new LMI.Url(window.location.href);if(M.page=="editaccount.ds"){window.location=LMI.Urls.get("editaccount.ds")}else{window.location=LMI.Urls.get("displaymywww.ds")}}}}function D(K){return function(M){var O,L,N;if(M.fieldErrors!=null){for(o in M.fieldErrors){switch(o){case"username":O="emailInp";break;case"password":O=(K=="login")?"pass":"passwordReg";break;case"emailAddress":O="emailAddress";break;case"captchaCode":O="verifyCaptcha";break;case"verifyEmailAddress":O="verifyEmailAddress";break;case"verifyPassword":O="verifyPassword";break;default:O=""}if(O){L=document.getElementById(O);L.className+=(L.className.length>0?" ":"")+"fieldError";L.parentNode.parentNode.appendChild(LMI.PopupForm.getErrorMessage(M.fieldErrors[o][0]))}}}N=document.getElementById("pass");if(N){N.value=""}}}var B={handleSuccess:F(document.getElementById("emailInp")),handleError:D("login"),buildSubmitUrl:function(L){var N=L.username.value,K=L.password.value,M=L.rememberMe.checked?"1":"0";return LMI.Data.Urls.login+"?username="+N+"&password="+K+"&rememberMe="+M}};var J={handleSuccess:F(document.getElementById("emailAddress")),handleError:D("register"),buildSubmitUrl:function(N){var M=N.emailAddress.value,P=N.verifyEmailAddress.value,L=N.password.value,O=N.verifyPassword.value,K=N.captchaCode.value,Q=N.rememberMe.checked?"1":"0";return LMI.Data.Urls.register+"?emailAddress="+M+"&verifyEmailAddress="+P+"&password="+L+"&verifyPassword="+O+"&captchaCode="+K+"&rememberMe="+Q}};if(document.body.id=="mywww"){J.showElem=E}else{J.showElem=G}function A(){var N=document.getElementById("loginWidget")||document.getElementById("signinReturn"),L,O,K=document.getElementById("loginRegister"),M=document.getElementById("registerPopup");if(N){L=new LMI.PopupForm("login","loginPopup");L.setStrategy(B)}N=document.getElementById("registerWidget");if(N){O=new LMI.PopupForm("register",["registerPopup","loginRegister"]);O.setStrategy(J);if(K){LMI.MinEvents.addEvent(K,"click",H);if(M){LMI.MinEvents.addEvent(M,"click",function(Q){var P=document.getElementById("registerWidget");if(P){P.style.left="";P.style.top="123px"}})}}}}A()})();(function(){var C=LMI.MinEvents,G=0.25;function L(N){var M;if(document.body.id==="mywww"){YAHOO.util.Dom.setStyle(N,"height",0);YAHOO.util.Dom.removeClass(N,"hidden");M=new YAHOO.util.Anim(N,{height:{to:N.scrollHeight}},G);M.onComplete.subscribe(function(){YAHOO.util.Dom.setStyle(N,"height","auto")});M.animate()}else{N.className=N.className.replace(/hidden/,"")}}function H(N){var M;if(!N.className.match("hidden")){if(document.body.id==="mywww"){M=new YAHOO.util.Anim(N,{height:{to:0}},G);M.onComplete.subscribe(function(){YAHOO.util.Dom.addClass(N,"hidden")});M.animate()}else{N.className+=(N.className.length>0?" ":"")+"hidden"}}}function K(){var N=document.getElementById("forgotpass"),M=document.getElementById("forgotlink");LMI.PopupForm.clearErrorMessages(N);if(N.className.match(/hidden/)){L(N);H(M)}else{H(N);L(M)}}function D(P){var O=document.getElementById("loginForm"),R,M=document.getElementById("forgotInp"),N,Q;if(document.body.id==="mywww"){R="signinContainer"}else{R=O.parentNode}LMI.Messages.clear();if(P.infoMessages!==null){for(Q in P.infoMessages){if(P.infoMessages.hasOwnProperty(Q)){LMI.Messages.addMessage(LMI.PopupForm.getMessage(P.infoMessages[Q]),{insertionPoint:R})}}}K();M.value="";N=LMI.PopupFormCollection.getPopupByName("login");if(N){LMI.PopupForm.clearErrorMessages(N.form)}}function A(N){var O,M,P;if(N.fieldErrors!==null){for(P in N.fieldErrors){if(N.fieldErrors.hasOwnProperty(P)){if(P==="username"){O="forgotInp"}else{O=""}if(O){M=document.getElementById(O);M.className+=(M.className.length>0?" ":"")+"fieldError";M.parentNode.parentNode.appendChild(LMI.PopupForm.getErrorMessage(N.fieldErrors[P][0]))}}}}}function J(){return function(M){if(M[0].success){D(M[0])}else{A(M[0])}}}function F(N){var O=N.username.value,M=LMI.Data.Urls.forgotPassword+"?username="+O;LMI.PopupForm.clearErrorMessages(N);LMI.XHR.makeXHRRequest(M,"post",J())}function B(N){var M=N.target||N.srcElement;C.stopEvent(N);F(M)}function I(M){K();C.stopEvent(M)}function E(){var M=document.getElementById("forgotForm");if(M){C.on(M,"submit",B)}M=document.getElementById("forgotlink");if(M){C.on(M,"click",I)}M=document.getElementById("closeForgot");if(M){C.on(M,"click",I)}}E()})();