/* reset the old sbImgResize() */
function sbImgResize(){};
/* set it up with jQuery */
jQuery.fn.maxImgWidth= function(maxX){
	if(!maxX){maxX = 480};
	if($(this).width() > maxX){
		$(this).css("width",maxX+"px");
	}
}
/* now, run the plugin with anything that needs it */
function specialsBuilderImgResizer(){
	$("div.sVar1Wrap6 img").maxImgWidth();
	$("div.sVar9Wrap5 img").maxImgWidth();
	$("div.sVar2Wrap6 img").maxImgWidth(340);
	//line 16 appears to cause generic specials to resize to its setting of 380 :: next line
	//$("#specialsListing .widgetWrap img").maxImgWidth(380);
	$("div.sVar3Wrap4 img").maxImgWidth(380);
	$("div.sVar6Wrap4 img").maxImgWidth(400);
	$("div.sVar8Wrap6 img").maxImgWidth(468);
	$("td.quickWrapContent img").maxImgWidth(500);
}
// not sure but I don't think the next function is used anymore -ddcjustinh 10-28-2008
function specialsBuilderImgResizerIE(){
		$("div.sVar1Wrap6 img").maxImgWidth();
		$("div.sVar9Wrap5 img").maxImgWidth();
		$("div.sVar10Wrap2 img").maxImgWidth(226);	//not needed for ie7 or FF as max-width css is set	
		$("div.sVar2Wrap6 img").maxImgWidth(340);
		//line 16 appears to cause generic specials to resize to its setting of 380 :: next line
		//$("#specialsListing .widgetWrap img").maxImgWidth(380);
		$("div.sVar3Wrap4 img").maxImgWidth(380);
		$("div.sVar6Wrap4 img").maxImgWidth(400);
		$("div.sVar8Wrap6 img").maxImgWidth(468);
		$("td.quickWrapContent img").maxImgWidth(500);
}
/* 
All are widths
Default=480px
340px
380px
400px
468px
500px (used by the dealer "generic" special)
 */
 
 // update the cms classic details links used in sbapp
 function cmsClassicLinkUpdater(){
/* =	commentted out in favor of the new script below due to the IE6 error in DNA570131
	for(i=0;i < $("#specialsListing a").size()-1;i++ ){
		var urlString = $("#specialsListing a").eq(i).attr("href").toString();
		if(urlString.indexOf("used_vehicle_details") > -1){
			$("#specialsListing a").eq(i).attr("href",urlString.replace(/used_vehicle_details.htm/g, "used-inventory/vehicle-details.htm") );
		}
		if(urlString.indexOf("new_vehicle_details") > -1){
			$("#specialsListing a").eq(i).attr("href",urlString.replace(/new_vehicle_details.htm/g, "new-inventory/vehicle-details.htm") );
		}
	} 
*/
	$("#specialsListing a").click(function(){
		var urlString = $(this).attr("href").toString();
		if(urlString.indexOf("used_vehicle_details") > -1){
			$(this).attr("href",urlString.replace(/used_vehicle_details.htm/g, "used-inventory/vehicle-details.htm") );
		}
		if(urlString.indexOf("new_vehicle_details") > -1){
			$(this).attr("href",urlString.replace(/new_vehicle_details.htm/g, "new-inventory/vehicle-details.htm") );
		}
	});
 }
