if(typeof(getCookie)=="undefined"){var getCookie=function(cookieName){var cookieKey=cookieName+"=";var cookieArray=document.cookie.split(';');for(var i=0;i2){_query+=arguments[2];} var _req=new ajax();_req.callBackFunc=function(){MYT.handleSaveListingResponse(_req,_adId,_clickPosition);};_req.postData=_query;_req.loadXMLDoc("/find/login-popup");},handleSaveListingResponse:function(req,adId,clickPosition){var _text=req.responseText;for(var _code in _ajaxResponseCodes){if(_text.search("&"+_code)!=-1){alert(_ajaxResponseCodes[_code]);this.sendAuthentication();return;}} var _left=0,_top=0;if(clickPosition.pageX){_left=200;_top=clickPosition.pageY-40;}else{_left=380;_top=document.body.scrollTop+40;} var _divs=document.getElementsByTagName("div");for(var i=0;i<_divs.length;i++){if(_divs[i].className=="mytlogindiv"){_loginWindow=_divs[i];}} _loginWindow.style.top=_top>0?_top:0;_loginWindow.style.left=_left>0?_left:0;_loginWindow.innerHTML=_text;this.showLoginWindow();},sendAuthentication:function(){if(!_authUrl)return;var _credentials={"HANDLE_ID":document[_loginFormName].HANDLE_ID.value,"PASSWORD":document[_loginFormName].PASSWORD.value,"REDIRECT":window.location.href};var _authForm=document.createElement("form");_authForm.setAttribute("method","post");_authForm.setAttribute("action",_authUrl);for(var _key in _credentials){var _field=document.createElement("input");_field.setAttribute("type","hidden");_field.setAttribute("name",_key);_field.setAttribute("value",_credentials[_key]);_authForm.appendChild(_field);} document.body.appendChild(_authForm);_authForm.submit();},init:function(){var _notLoggedInHeader=document.getElementById('mytLogoCntrNotLoggedIn');var _loggedInHeader=document.getElementById('mytLogoCntrLoggedIn');if(this.isLoggedIn()){_notLoggedInHeader.style.display='none';_loggedInHeader.style.display='block';}else{_loggedInHeader.style.display='none';_notLoggedInHeader.style.display='block';_authUrl=_notLoggedInHeader.getElementsByTagName("a")[0].href;}}};}();if(window.location.href.search("listing")!=-1){var saveVehicle=function(adId,thisev){return MYT.saveListing(adId,thisev);};var performLogin=function(){return MYT.loginSaveListing();};} var hideLogin=MYT.hideLoginWindow;MYT.init();