Favorites.DropDown={};Favorites.DropDown.closetimer=0;Favorites.DropDown.timeout=50;Favorites.DropDown.autohide_time=3000;Favorites.DropDown.dropdown_div=null;Favorites.DropDown.dropdown_cover=null;Favorites.DropDown.dropdown_header=null;Favorites.DropDown.dropdown_body=null;Favorites.DropDown.dropdown_footer=null;Favorites.DropDown.dropdown_iframe=null;Favorites.DropDown.background_color="white";Favorites.DropDown.EXPORT={refresh:1,showError:1,create:1,hide:1,refreshListRanks:1};Favorites.addRenderer(Favorites.DropDown);Favorites.DropDown.initialize=function(a,b){Favorites.DropDown.fav_tab=Com.$(a);Com.addEvent(Favorites.DropDown.fav_tab,"mouseover",Favorites.DropDown._cancelCloseTimer);Com.addEvent(Favorites.DropDown.fav_tab,"mouseout",Favorites.DropDown._startHideTimer);b=Com.$(b);Com.addEvent(b,"mouseover",Favorites.DropDown.create)};Favorites.DropDown.create=function(a){Favorites.DropDown._cancelCloseTimer();if(Favorites.DropDown.dropdown_div){Favorites.DropDown._setPosition();Favorites.DropDown._popup();if(a===true){Favorites.DropDown._startHideTimer(Favorites.DropDown.autohide_time)}return}Favorites.DropDown.dropdown_div=document.createElement("div");Favorites.DropDown.dropdown_div.id="favorites_dropdown";Favorites.DropDown.dropdown_div.style.position="absolute";Favorites.DropDown.dropdown_div.style.background=Favorites.DropDown.background_color;Favorites.DropDown.dropdown_div.style.width="388px";Favorites.DropDown.dropdown_div.innerHTML='<div style="border: thin solid #c4c3be;">  <table width=364 cellspacing=0 cellpadding=0 style="background:'+Favorites.DropDown.background_color+';">    <tr>      <td id="favorites_dropdown_header" align="right">'+Favorites.DropDown._renderHeader()+'      </td>    </tr>  </table>  <div style="overflow:auto; max-height:500px; background:'+Favorites.DropDown.background_color+'" width=364>    <table width=364 cellspacing=5 cellpadding=5 style="background'+Favorites.DropDown.background_color+';">      <tr>        <td id="favorites_dropdown_body" align="right">'+Favorites.DropDown._renderList()+'        </td>      </tr>    </table>  </div>  <table width=364 cellspacing=5 cellpadding=5 style="background:'+Favorites.DropDown.background_color+';">    <tr>      <td id="favorites_dropdown_footer" align="right">'+Favorites.DropDown._renderFooter()+"      </td>    </tr>  </table></div>";Favorites.DropDown.dropdown_cover=document.createElement("div");Favorites.DropDown.dropdown_cover.id="corner_cover";Favorites.DropDown.dropdown_cover.style.background=Favorites.DropDown.background_color;Favorites.DropDown.dropdown_cover.style.position="absolute";Favorites.DropDown.dropdown_cover.style.width="90px";Favorites.DropDown.dropdown_cover.style.height="4px";Com.addEvent(Favorites.DropDown.dropdown_div,"mouseover",Favorites.DropDown.create);Com.addEvent(Favorites.DropDown.dropdown_div,"mouseout",Favorites.DropDown._startHideTimer);Com.addEvent(Favorites.DropDown.dropdown_cover,"mouseover",Favorites.DropDown.create);Com.addEvent(Favorites.DropDown.dropdown_cover,"mouseout",Favorites.DropDown._startHideTimer);if(Com.isIE6()){Favorites.DropDown.dropdown_iframe=document.createElement("iframe");Favorites.DropDown.dropdown_iframe.id="fav.dropdown_iframe";Favorites.DropDown.dropdown_iframe.style.position="absolute";document.body.appendChild(Favorites.DropDown.dropdown_iframe)}Favorites.DropDown._setPosition();document.body.appendChild(Favorites.DropDown.dropdown_div);document.body.appendChild(Favorites.DropDown.dropdown_cover);Favorites.DropDown.dropdown_header=Com.$("favorites_dropdown_header");Favorites.DropDown.dropdown_body=Com.$("favorites_dropdown_body");Favorites.DropDown.dropdown_footer=Com.$("favorites_dropdown_footer");if(a===true){Favorites.DropDown._startHideTimer(Favorites.DropDown.autohide_time)}Favorites.DropDown.dropdown_div.style.zIndex=100;Favorites.DropDown.dropdown_cover.style.zIndex=101;Favorites.DropDown._popup()};Favorites.DropDown._renderHeader=function(){var b,a=Favorites.getList();if(a===undefined||(!Favorites.isLoggedIn()&&a.length===0)){return"<br />"}b='<br /> <font style="text-decoration: none; color:#3f3f3f; font-weight:bold; font-size:8.8pt;             font-family:verdana,arial,helvetica,sans-serif;             letter-spacing:0px;">   You have  </font> <font style="text-decoration: none; color:#009900; font-weight:bold; font-size:8.8pt;             font-family:verdana,arial,helvetica,sans-serif;             letter-spacing:0px;">'+a.length+' </font> <font style="text-decoration: none; color:#3f3f3f; font-weight:bold; font-size:8.8pt;             font-family:verdana,arial,helvetica,sans-serif;             letter-spacing:0px;">';b+=(a.length===1)?" Favorite":" Favorites";if(a.length===0){return b}b+='</font> (<a style="color:#0079cd; font-weight:bold; font-size:8.8pt;           font-family:verdana,arial,helvetica,sans-serif;           letter-spacing:0px;" href ="/favorites"   onmouseover="style.color=\'#666666\';"   onmouseout="style.color=\'#0066cc\';">See details</a>)';return b};Favorites.DropDown._renderFooter=function(){if(!Favorites.isLoggedIn()){return'<a style="color:#0066cc; font-weight:bold; font-size:8.8pt;          font-family:verdana,arial,helvetica,sans-serif; letter-spacing:0px;          text-decoration: underline; cursor: pointer;"   onmouseover="style.color=\'#666666\';"   onmouseout="style.color=\'#0066cc\';"   onclick="Favorites.popupLogin(\'login\');Favorites.DropDown.hide()">Sign-in</a> | <a style="color:#0066cc; font-weight:bold; font-size:8.8pt;         font-family:verdana,arial,helvetica,sans-serif; letter-spacing:0px;         text-decoration: underline; cursor: pointer;"   onmouseover="style.color=\'#666666\';"   onmouseout="style.color=\'#0066cc\';"   onclick="Favorites.popupLogin(\'create\');Favorites.DropDown.hide()">Create Account</a><br />'}return'<a style="color:#0066cc; font-weight:bold; font-size:8.8pt;         font-family:verdana,arial,helvetica,sans-serif; letter-spacing:0px;         text-decoration: underline; cursor: pointer;"   onmouseover="style.color=\'#666666\';"   onmouseout="style.color=\'#0066cc\';"   onclick="Favorites.logout()">Sign out</a><br />'};Favorites.DropDown._popup=function(){Favorites.DropDown.dropdown_div.style.display="block";Favorites.DropDown.dropdown_cover.style.display="block";if(Favorites.DropDown.dropdown_iframe){Favorites.DropDown.dropdown_iframe.style.width=Favorites.DropDown.dropdown_div.style.width;Favorites.DropDown.dropdown_iframe.style.height=Favorites.DropDown.dropdown_div.offsetHeight+"px";Favorites.DropDown.dropdown_iframe.style.display="block"}};Favorites.DropDown._startHideTimer=function(a){if(typeof(a)==="number"){a=a}else{a=Favorites.DropDown.timeout}Favorites.DropDown.closetimer=window.setTimeout(Favorites.DropDown.hide,a)};Favorites.DropDown._cancelCloseTimer=function(){if(Favorites.DropDown.closetimer){window.clearTimeout(Favorites.DropDown.closetimer);Favorites.DropDown.closetimer=null}};Favorites.DropDown.hide=function(){if(Favorites.DropDown.dropdown_div){Favorites.DropDown.dropdown_div.style.display="none";Favorites.DropDown.dropdown_cover.style.display="none";if(Favorites.DropDown.dropdown_iframe){Favorites.DropDown.dropdown_iframe.style.display="none"}}};Favorites.DropDown.refresh=function(){if(Favorites.DropDown.dropdown_div){Favorites.DropDown.dropdown_header.innerHTML=Favorites.DropDown._renderHeader();Favorites.DropDown.dropdown_body.innerHTML=Favorites.DropDown._renderList();Favorites.DropDown.dropdown_footer.innerHTML=Favorites.DropDown._renderFooter();if(Favorites.DropDown.dropdown_iframe){Favorites.DropDown.dropdown_iframe.style.width=Favorites.DropDown.dropdown_div.style.width;Favorites.DropDown.dropdown_iframe.style.height=Favorites.DropDown.dropdown_div.offsetHeight+"px"}}};Favorites.DropDown.refreshListRanks=function(){if(Favorites.DropDown.dropdown_div){Favorites.DropDown.dropdown_body.innerHTML=Favorites.DropDown._renderList()}};Favorites.DropDown._setPosition=function(){var b,a,c;if(Favorites.DropDown.dropdown_div){b=Favorites.findPos(Favorites.DropDown.fav_tab);a=b[0]-290;c=b[1]+23;Favorites.DropDown.dropdown_div.style.left=a+"px";Favorites.DropDown.dropdown_div.style.top=c+"px";a=b[0]+1;c=b[1]+23;Favorites.DropDown.dropdown_cover.style.left=a+"px";Favorites.DropDown.dropdown_cover.style.top=c+"px";if(Favorites.DropDown.dropdown_iframe){Favorites.DropDown.dropdown_iframe.style.left=Favorites.DropDown.dropdown_div.style.left;Favorites.DropDown.dropdown_iframe.style.top=Favorites.DropDown.dropdown_div.style.top}}};Favorites.DropDown._renderList=function(){var c,b="",a=Favorites.getList();if(a===undefined||a.length===0){return'<table width=100%><tr><td align=center>  <h3>Tip: Use the <a href="/carchooser">Car Chooser</a> to find Favorites!</h3></tr></td></table>'}else{b="<table width=100% border=0>";b+="<tr><td height=1 bgcolor=gray></td></tr>";for(c=0;c<a.length;c+=1){b+="<tr><td onmouseover=\"style.backgroundColor='#e3e3e3'; ";b+=(a[c].available)?"style.cursor='pointer';":"";b+='"        onmouseout="style.backgroundColor=\''+Favorites.DropDown.background_color+"';\">"+Favorites.DropDown._renderFavorite(a[c])+"</td></tr>";b+="<tr><td height=2></td></tr>";b+="<tr><td height=1 bgcolor=gray></td></tr>"}b+="</table>";return b}};Favorites.hoverCell=function(){return};Favorites.DropDown._renderFavorite=function(b){var e,d=Favorites.formatCarPrice(b),c=Favorites.formatCarNote(b),a=Favorites.DropDown.formatCarTitle(b);e='<table border=0 cellspacing=0 width=100%><tr><td><table border=0 cellspacing=5 celpadding=8  width=100%><tr>  <td><table cellspacing=1><tr><td>    <span style="min-width: 135px; min-height: 89px; width: 135px; height: 89px; ';if(b.available===true){e+='cursor:pointer;" onclick="Favorites.gotoUrl(\''+Favorites.legacyUrl(b)+"')\">";e+='<img style="border:thin solid white; min-width: 135px; min-height: 89px; width: 135px; height: 89px;" src="http://images.newcars.com/images/pictures/VEHICLE/'+b.image+'-S.jpg"/>'}else{e+='">';e+='<div style="border:thin solid gray; width:135px; height:89px;"><table bgcolor=white width=100% height=100%><tr><td valign=middle align=center>No Longer Available</td></tr></table></div>'}e+="    </span>  </td></tr></table></td>  <td width=100% height=100% valign=top>    <table border=0 height=100% width=100%>      <tr rowspan=2>        <td height=100% width=100%>          <table border=0 width=100% height=100%";if(b.available===true){e+=" onclick=\"Favorites.gotoUrl('"+Favorites.legacyUrl(b)+"')\""}e+=">            <tr>              <td height=10>              </td>            </tr>            <tr>              <td width=100% valign=top>"+a+'              </td>            </tr>            <tr>              <td valign=top height=100%>                <span style="text-decoration: none; color:#009900;                    font-weight:400; font-family:verdana,arial,helvetica,sans-serif; font-size:10pt;                    letter-spacing:-1px;">MSRP: '+d+'</span>              </td>            </tr>         </table>       </td>       <td valign=top>         <table border=0 height=100%>           <tr>             <td align=right>               <span title="Remove this car from Favorites" style="text-decoration: none; color: red; font-size:13pt; cursor: pointer;" onclick="Favorites.attemptRemoveFavorite('+b.year+",'"+b.make_name+"','"+b.model_name+"','"+b.bodystyle+"','"+b.style+"')\"><img src=/images/favorites/fav_remove_icon_sm-trans.png width=20/>               </span>             </td>           </tr>           <tr>             <td height=100% onclick=\"Favorites.gotoUrl('"+Favorites.legacyUrl(b)+"')\">             </td>           </tr>         </table>       </td>     </tr>    </table>  </td></tr></table></td></tr></table>";return e};Favorites.DropDown.formatCarTitle=function(a){var b='<span title="View more detailed information"  style="text-decoration: none; color:#6f4500; font-size:10pt; font-weight:bold;  font-family:verdana,arial,helvetica,sans-serif; letter-spacing:0px;';if(a.available===true){b+='cursor:pointer;" onclick="Favorites.gotoUrl(\''+Favorites.legacyUrl(a)+"')"}b+='">'+a.year+" "+a.make_name+" "+a.model_name+'          </span><br /><font style="text-decoration: none; color:#black; font-weight:bold; font-size:8pt;             font-family:verdana,arial,helvetica,sans-serif;             letter-spacing:0px;">'+Favorites.formatStyle(a.bodystyle,a.style)+"          </font>";return b};Favorites.DropDown.showError=function(a){if(Favorites.DropDown.dropdown_div&&Favorites.DropDown.dropdown_div.style.display==="block"){alert(a.join("<br/>"))}};