function overlay(c){var b=jQuery("#viewcars");jQuery(b).toggle();c=jQuery(c).position();jQuery.browser.msie?jQuery(b).css({top:c.top+5,left:c.left+32}):jQuery(b).css({top:c.top+5,left:c.left-(jQuery(b).width()+46)});return false}function overlayclose(){jQuery("#viewcars").hide()} jQuery.fn.liScroll=function(c){c=jQuery.extend({travelocity:0.07},c);return this.each(function(){function b(c,h){a.animate({left:"-="+c},h,"linear",function(){a.css("left",e);b(n,d)})}var a=jQuery(this);a.css({position:"relative",left:"100%","list-style-type":"none",margin:"0",padding:"0"});var h=0;a.wrap('<div class="mask" style="position: relative;left: 0;top: 8px;width: 292px;overflow: hidden;"></div>');a.parent().wrap('<div class="eventcontainer" style="border: 1px solid #000;background: #fff;width: 292px;height: 27px;margin: 0 3px;padding: 0;overflow: hidden;"></div>'); var e=a.parent().parent().width();a.find("li").each(function(b){h+=jQuery(this,b).width()});a.width(h);var d=h/c.travelocity,n=h+e;b(n,d);a.hover(function(){jQuery(this).stop()},function(){var a=jQuery(this).offset().left+h;b(a,a/c.travelocity)})})};function formatPrice(c){c+="";for(var b=c.split("."),c=b[0],b=b.length>1?"."+b[1]:"",a=/(\d+)(\d{3})/;a.test(c);)c=c.replace(a,"$1,$2");return c+b} function carsHQ_callback(c){if(c.featuredDealer.length>0){var b=c.featuredDealer,a=c.featuredVehicle,h=c.vehiclePhoto,e=c.salesEvent;jQuery("#carsHQ_widget").css({width:"300px","text-align":"left",margin:"0px auto","margin-top":"1em","padding-bottom":"3px","font-family":"Lucida Grande, Arial, sans-serif","background-color":"#fff","font-size":"11px"});var d,n;d=Math.floor(Math.random()*b.length);var f=b[d].dealer_ID,r=b[d].business_name;n=b[d].badge?b[d].badge:"";var o=b[d].type,p=b[d].city,s=b[d].state, i=b[d].zipCode,b=b[d].phone;typeof newspaperDomain!="undefined"&&(CreatorDomain=newspaperDomain);d=jQuery("<div></div>").css({"background-color":"#fff",width:"295px",margin:"0 3px"});var l=jQuery("<a></a>").attr({href:"http://www.carshq.com/zip/"+i,target:"_blank"}).css({"background-color":"#fff","float":"right","font-family":"Lucida Grande, Arial, sans-serif",color:"#000"}).html('<img src="http://widgets.fccinteractive.com/verticals/carshq.com/images/logo.png" title="carsHQ: Home Page" alt="CarsHQ Logo" style="border:none;"/>'); jQuery(d).append(l);jQuery("#carsHQ_widget").append(d);d=jQuery("<div></div>").css({background:"#192636 url(http://widgets.fccinteractive.com/verticals/carshq.com/images/topround.gif) no-repeat",clear:"both","padding-top":"8px",width:"295px",margin:"0 auto"});l=jQuery("<a></a>").css({margin:"0","margin-left":"-5px"}).attr({href:"http://www.carshq.com/search/page/search_results/top/1/zip/"+i+"/radius/50",target:"_blank"}).html('<img src="http://widgets.fccinteractive.com/verticals/carshq.com/images/topvehicles-title.png" title="carsHQ: View all Top Vehicles" style="border:none;" >'); jQuery(d).append(l);jQuery("#carsHQ_widget").append(d);l=jQuery("<a></a>").css({"float":"right","margin-right":"15px",color:"#fff","text-decoration":"none","font-size":"12px"}).attr({href:"http://www.carshq.com/search/page/search_results/top/1/zip/"+i+"/radius/50",title:"carsHQ: View all Top Vehicles",target:"_blank"}).text("View all "+String.fromCharCode(187));jQuery(d).append(l);jQuery("#carsHQ_widget").append(d);var m,g,q,u,v,t;if(a.length>0){d=0;m=[];for(q=0;q<a.length;q++)a[q].dealer_ID==f&& (m[d]=q,d+=1);q=Math.floor(Math.random()*m.length);t=m[q];q=a[t].vehicle_ID;l=a[t].year;u=a[t].make;v=a[t].model;g=a[t].price;t=a[t].sale_price;var k,j,x=jQuery("<div></div>").css({"background-color":"#192636","vertical-align":"top",width:"295px",margin:"0 auto",padding:"0"});if(h.length>0){for(var y=0;y<h.length;y++)if(h[y].vehicle_ID==q)j=h[y].photo;j&&(k=jQuery("<a></a>").attr({href:"http://www.carshq.com/search/page/detail/id/"+q+"/dealer_id/"+f+"/zip/"+i+"/radius/50",title:"View this "+u+" "+ v+" at carsHQ.com",target:"_blank"}).html('<img src="http://www.carshq.com/gfx/180x135/'+j+'" title="View this '+l+" "+u+" "+v+' at carsHQ.com" style="float: left;width: 53%;margin: 5px 5px 12px 8px;border:2px solid #fff;"/>'))}else k=jQuery("<a></a>").attr({href:"http://www.carshq.com/search/page/detail/id/"+q+"/dealer_id/"+f+"/zip/"+i,title:"View this "+l+" "+u+" "+v+"at carsHQ.com",target:"_blank"}).html('<img src="http://www.carshq.com/gfx/180x135/no_pic.jpg" title="No Image Available" style="float: left;width: 53%;margin: 8px;border:2px solid #fff;"/>'); jQuery(x).append(k);k=jQuery("<div></div>").css({"float":"right",width:"36%",margin:"0",padding:"5px"});jQuery(k).append('<span style="display: inline;padding: 0;font-size: 13px;font-weight: bolder;color: #fff;width: 20%;">'+l+" "+u+" "+v+"</span>");j=jQuery("<span>").css({display:"block","padding-top":"3px","padding-bottom":"10px","font-size":"26px","font-weight":"bolder",color:"#fff"});g!="0"?t!="0"?jQuery(j).html('<span style="font-size: 98%;text-decoration: line-through;font-weight:normal;">$'+ formatPrice(g)+"</span><br />$"+formatPrice(t)):jQuery(j).text("$"+formatPrice(g)):jQuery(j).text("Contact for price");jQuery(k).append(j);jQuery(x).append(k);jQuery(x).append('<p style="clear:both;"></p>');jQuery("#carsHQ_widget").append(x);k=jQuery("<img></img>").attr({src:"http://widgets.fccinteractive.com/verticals/carshq.com/images/bottomarrow.gif"});jQuery("#carsHQ_widget").append(k);if(e.length>0){k=0;var z=jQuery("<ul></ul>").attr("id","salesEvent");for(j=0;j<e.length;j++)if(e[j].dealer_ID== f)g=e[j].name,l=e[j].description,g=jQuery("<li></li>").css({"white-space":"nowrap","float":"left",margin:"0",padding:"0",background:"#fff"}).html("<strong>"+g+"</strong> "+l),jQuery(z).append(g),k++;k>0&&(jQuery("#carsHQ_widget").append(z),jQuery(function(){jQuery(z).liScroll({travelocity:0.05})}))}o=="dealership"?(n!=""?(g=jQuery("<div></div>").css({"float":"left","background-color":"#fff","margin-left":"10px","padding-bottom":"10px",width:"auto",height:"48px"}),p=jQuery("<a></a>").attr({href:"http://www.carshq.com/search/page/search_results/dealer_id/"+ f+"/zip/"+i+"/radius/50",target:"_blank"}).css({width:"100%","line-height":"48px",height:"48px"}).html('<img src="http://www.carshq.com/gfx/badges/'+n+'" title="'+r+'" style="margin:8px auto auto;width:135px;height:35px;text-align:center;border:none;"/>'),jQuery(g).append(p)):(g=jQuery("<div></div>").css({"background-color":"#fff",margin:"0 auto",width:"auto",height:"48px"}),e=jQuery("<a/>").attr({href:"http://www.carshq.com/search/page/search_results/dealer_id/"+f+"/zip/"+i+"/radius/50",target:"_blank"}).css({"float":"right", width:"auto","line-height":"48px",height:"48px"}).text(r),jQuery(g).append(e),jQuery("#carsHQ_widget").append(g)),d>1&&(p=jQuery("<a></a>").click(function(){overlay(this)}).css({color:"#666",cursor:"pointer","text-decoration":"none","float":"right",width:"35%","margin-top":"10px","margin-right":"30px"}).text("View more from "+r),jQuery(g).append(p),jQuery("#carsHQ_widget").append(p))):(g=jQuery("<div></div>").css({"background-color":"#fff",margin:"0 3px",width:"35%"}),e=jQuery("<div/>").css({"float":"left", width:"100%","text-align":"center","line-height":"48px",height:"48px",color:"#000"}),jQuery(e).append('<span style="padding: 4px 0 0 0;font-size: 11px;font-weight: bolder;">Phone: '+b+"</span>"),jQuery(e).append('<span style="padding: 4px 0 0 0;font-size: 11px;font-weight: bolder;">'+p+", "+s+"</span>"),jQuery(g).append(e))}jQuery("#carsHQ_widget").append(g);p=jQuery("<div></div>").css({position:"absolute",display:"none","background-color":"#fff",border:"1px solid #192636",width:"224px",padding:"8px", "z-index":"101"}).attr("id","viewcars");s=jQuery("<div></div>").css({"float":"left",width:"135px","margin-top":"-5px"});e=jQuery("<a></a>").attr({href:"http://www.carshq.com/zip/"+i,target:"_blank"}).html('<img src="http://www.carshq.com/gfx/carsHQsmall_logo.gif" style="border:none;" title="carsHQ: Home Page" />');jQuery(s).append(e);jQuery(p).append(s);s=jQuery("<div></div>").css({"float":"right","margin-right":"1px"});e=jQuery("<a></a>").click(function(){overlayclose();return false}).html('<img src="http://www.carshq.com/gfx/close.gif" style="border:none;cursor:pointer;" title="Close Window" />'); jQuery(s).append(e);jQuery(p).append(s);jQuery(p).append('<p style="clear:both;"></p>');if(m.length>1){for(var w,s=0;s<m.length;s++)if(o=m[s],g=a[o].vehicle_ID,g!=q){d=a[o].year;k=a[o].make;j=a[o].model;e=a[o].price;o=a[o].sale_price;b=jQuery("<div></div>").css({"float":"left",width:"64px",height:"64px",margin:"4px","margin-bottom":"12px",padding:"2px 0"});if(h.length>0){for(l=0;l<h.length;l++)if(h[l].vehicle_ID==g)w=h[l].photo;d=w?jQuery("<a></a>").attr({href:"http://www.carshq.com/search/page/detail/id/"+ g+"/dealer_id/"+f+"/zip/"+i+"/radius/50",title:"View this "+d+" "+k+" "+j+" at carsHQ.com",target:"_blank"}).html('<img src="http://www.carshq.com/gfx/96x72/'+w+'" border="none" width="60" title="View this '+d+" "+k+" "+j+' at carsHQ.com" />'):jQuery("<a></a>").attr({href:"http://www.carshq.com/search/page/detail/id/"+g+"/dealer_id/"+f+"/zip/"+i+"/radius/50",title:"View this "+d+" "+k+" "+j+" at carsHQ.com",target:"_blank"}).html('<img src="http://www.carshq.com/gfx/96x72/no_pic.jpg" width="60" title="View this '+ d+" "+k+" "+j+' at carsHQ.com" />');jQuery(b).append(d);jQuery(p).append(b)}e!="0"?o!="0"?(e=jQuery("<span></span>").css({"font-size":"98%","text-decoration":"line-through"}).text("$"+formatPrice(e)),jQuery(b).append(e),o="<br />$"+formatPrice(o),jQuery(b).append(o)):jQuery(b).append("$"+formatPrice(e)):jQuery(b).append("Contact for price")}a=jQuery("<div/>").css({"text-align":"center","background-color":"#fff","margin-top":"1px","padding-bottom":"1px",width:"99%",height:"35px",clear:"left"});n=n!== ""?jQuery("<a></a>").attr({href:"http://www.carshq.com/search/page/search_results/dealer_id/"+f+"/zip/"+i+"/radius/50",target:"_blank"}).html('<img src="http://www.carshq.com/gfx/badges/'+n+'" border="0" title="'+r+'" />'):jQuery("<a></a>").attr({href:"http://www.carshq.com/search/page/search_results/dealer_id/"+f+"/zip/"+i+"/radius/50",target:"_blank"}).text(r);jQuery(a).append(n);jQuery(p).append(a)}jQuery("#carsHQ_widget").append(p)}if(c.topVehicleClassified.length>0){n=c.topVehicleClassified.length< 7?c.topVehicleClassified.length:7;f=jQuery("<div></div>").css({background:"#fff url(http://widgets.fccinteractive.com/verticals/carshq.com/images/dottedline.png) top center no-repeat",clear:"both","padding-top":"8px",width:"295px",margin:"0 auto"});r=jQuery("<a></a>").css({margin:"0","margin-left":"-5px"}).attr({href:"http://www.carshq.com/search/page/listing/newspaper/"+CreatorDomain,target:"_blank"}).html('<img src="http://widgets.fccinteractive.com/verticals/carshq.com/images/classifieds-title.png" title="carsHQ: View all Classifieds" style="border:none;" >'); jQuery(f).append(r);jQuery("#carsHQ_widget").append(f);i=jQuery("<a></a>").attr({href:"http://www.carshq.com/zip/"+i,target:"_blank"}).css({"background-color":"#fff","float":"right","margin-right":"12px","font-family":"Lucida Grande, Arial, sans-serif",color:"#000"}).html('<img src="http://widgets.fccinteractive.com/verticals/carshq.com/images/logo_75.png" title="carsHQ: Home Page" alt="CarsHQ Logo" style="border:none;"/>');jQuery(f).append(i);jQuery("#carsHQ_widget").append(f);i=jQuery("<a></a>").css({"float":"right", "margin-right":"15px","margin-top":"-16px",color:"#900","text-decoration":"none","font-size":"12px"}).attr({href:"http://www.carshq.com/search/page/listing/newspaper/"+CreatorDomain,title:"carsHQ: View all Classifieds",target:"_blank"}).text("View all "+String.fromCharCode(187));jQuery(f).append(i);jQuery("#carsHQ_widget").append(f);i=jQuery("<div></div>").css({padding:"0",margin:"0","margin-right":"5px","font-size":"11px","font-family":"sans-serif","background-color":"#fff",clear:"both"});f=[];r= 0;for(a=jQuery("<ul/>").css({padding:"0 5px",margin:"0","margin-right":"5px"});f.length<n;)if(m=r,jQuery.inArray(m,f)==-1)f[r]=m,r++,h=c.topVehicleClassified[m].id,w=c.topVehicleClassified[m].description,m=f.length!=n?jQuery("<li/>").css({"list-style":"none",background:"url(http://widgets.fccinteractive.com/verticals/carshq.com/images/chevron.gif) right center no-repeat","border-bottom":"1px dotted #666",padding:"5px 7px","font-size":"11px",margin:"0 5px","text-align":"left"}):jQuery("<li/>").css({"list-style":"none", background:"url(http://widgets.fccinteractive.com/verticals/carshq.com/images/chevron.gif) right center no-repeat",padding:"5px 7px","font-size":"11px",margin:"0 5px","text-align":"left"}),h=jQuery("<a/>").attr({title:h,href:"http://www.carshq.com/search/page/listing/id/"+h+"/newspaper/"+CreatorDomain,target:"_blank"}).css({color:"#000","text-decoration":"none"}).hover(function(){jQuery(this).css("text-decoration","underline")},function(){jQuery(this).css("text-decoration","none")}).text(w),jQuery(m).append(h), jQuery(a).append(m);jQuery(i).append(a);jQuery("#carsHQ_widget").append(i)}jQuery("#carsHQ_widget").append(jQuery("<div></div>").css({clear:"both"}))};

