// AOL Autos JS v1.20081215

// New-Car Search Moudle
function aol_initNewCarForm(){
	var newSel = $j('<select name="make" class="dGap" id="selectedMake"></select>').bind('change',function(){
		var modelSel = $j('#main_new_car_search .makes_list select[name="model"]').empty().attr('disabled','').append('<option value="">Show All Models</option>');
		if (this.selectedIndex == 0) {modelSel.attr('disabled','disabled');return;}
		var selectedMake = this.options[this.selectedIndex].value;
		var models = makesToModels[selectedMake];
		models.sort();
		for(var i=0;i<models.length;i++) {
			modelSel.append($j('<option value="'+models[i]+'">'+models[i]+'</option>'));
		}
	}).append('<option>Select a Make</option>');
	$j('#main_new_car_search .makes_list')
		.find("a").each(function() {var thisTxt = $j(this).text();newSel.append($j('<option value="' + thisTxt + '">' + thisTxt + '</option>'));}).end()
		.empty().append(newSel).append($j('<select name="model" class="dGap" id="selectedModel"></select>').attr('disabled','disabled').append('<option value="">Show All Models</option>')).after('<div class="submit_button"><input type="submit" value="find vehicles" /></div>')
}
function aol_submitNewSearch(form){
	var make = $j("#selectedMake");
	var model = $j("#selectedModel");
	if (make.val() == "Select a Make") {
		alert("Please select a 'Make'");
		make.focus();
		return false;
	}
	if (model.val() == "") {
		model.attr('disabled','disabled');
	}
	return true;
}

// Used-Car Search Moudle
function aol_initUsedCarForm(){
	var usedSel = $j('<select name="make1" class="dGap" id="u_selectedMake"></select>').bind('change',function(){
		var modelSel = $j('#cpo_used_car_search .makes_list select[name="model1"]').empty().attr('disabled','').append('<option value="">Show All Models</option>');
		if (this.selectedIndex == 0) {modelSel.attr('disabled','disabled');return;}
		var selectedMake = this.options[this.selectedIndex].value;
		var models = usedMakesModels[selectedMake];
		models.sort();
		for(var i=0;i<models.length;i++) {
			modelSel.append($j('<option value="'+models[i]+'">'+models[i]+'</option>'));
		}
	}).append('<option>Select a Make</option>');
	$j('#cpo_used_car_search .makes_list')
		.find("a").each(function() {var thisTxt = $j(this).text();usedSel.append($j('<option value="' + thisTxt + '">' + thisTxt + '</option>'));}).end()
		.empty().append(usedSel).append($j('<select name="model1" class="dGap" id="u_selectedModel"></select>').attr('disabled','disabled').append('<option value="">Show All Models</option>')).after('<input type="input" name="location" class="inp_loc" value="ZIP code or City, State" /><input type="hidden" name="cpo" value="true" /><div class="submit_button"><input type="submit" value="search used" /></div>')
		$j('.inp_loc').bind('blur',function(){
			restoreDefVal(this);
		});
		$j('.inp_loc').bind('click',function(){
			clearDefVal(this);
		});
		$j('#aol_usearch').bind('submit',function(){
			return aol_submitUsedSearch(this);
		});
}
function aol_submitUsedSearch(form){
	var make = $j("#u_selectedMake");
	var model = $j("#u_selectedModel");
	var loc = $j(".inp_loc");
	if (make.val() == "Select a Make") {
		alert("Please select a 'Make'");
		make.focus();
		return false;
	}
	if (model.val() == "") {
		model.attr('disabled','disabled');
	}
	if (loc.val() == 'ZIP code or City, State') {
		loc.attr('disabled','disabled');
	}
	return true;
}

// Dynamic Lead JQUERY
function dl_init(){
	if(document.getElementById('ws_dl')) {
		var wsDlObj = $j('#ws_dl .slide').html();
		$j('#ws_dl').remove();
		$j('.dlMod .dl .slide:first').empty().html(wsDlObj);
	}
	var dl_tabrow = $j("<div class='tab_row'></div>");
	$j(".autosDL .slide").each(function(){
		var slide_text = $j("<div class='slide_text'></div>");
		$j(this).css({float:"left",position:"absolute",top:"0",left:"0",height:"225px"}).hide();
		var lnkVal = $j(".stext .more a:first",this).attr('href');
		if(lnkVal) {
			$j('.photo img', this).wrap('<a href="'+ lnkVal +'"></a>');
		}
		$j(".head",this).appendTo(slide_text);
		$j(".stext",this).appendTo(slide_text);
		var linkBox = $j(".links",this);
		if(linkBox){
			linkBox.appendTo(slide_text);
		}
		slide_text.appendTo(this);
		$j(".tab",this).appendTo(dl_tabrow);
	});
	dl_tabrow.insertBefore($j(".autosDL .gallery"));
	$j(".autosDL .tab").each(function(){
		var liNode = $j(this);
		liNode.show().find("a")
			.bind("click",function(){
				dl_advSlide($j(".tab a").index(this))
				return false;
			});
	});
	$j(".autosDL .tab_row").find(":first").addClass("dl_sel");
	$j(".autosDL .dl").css({height:"225px",overflow:"hidden"}).find(":first").show();
	$j("<div class='dl_controls'><a href='javascript:;' class='previous_btn'><span>previous</span></a><a href='javascript:;' class='next_btn'><span>next</span></a></div>").appendTo('.autosDL .dlMod');
	$j(".autosDL .previous_btn").bind("click",function(){
		dl_advSlide(parseInt(dl_curr-1));
	});
	$j(".autosDL .next_btn").bind("click",function(){
		dl_advSlide(parseInt(dl_curr+1));
	});
}

function dl_advSlide(ind){
	if(ind == dl_curr){return false}
	var dl_slides = $j('.autosDL .slide');
	var dl_slength = dl_slides.length;
	if(ind == "-1"){ind = parseInt(dl_slength-1);}
	if(ind == dl_slength){ind = 0;}
	var dl_tabs = $j('.autosDL .tab');
	$j(dl_slides).each(function() {
		$j(this).css({zIndex:'300'});
	});
	$j(dl_tabs).parent().children().removeClass('dl_sel');
	$j(dl_tabs[ind]).addClass('dl_sel');
	$j(dl_slides[dl_curr]).css({zIndex:'400'});
	$j(dl_slides[ind]).show().css({zIndex:'500',left:'-436px'}).animate({'left':'+=436px'},0);
	dl_curr = ind;
}

// BoomTag for Make/Model
function getBoomTag(make, model){
	make = unescape(make).toLowerCase();
	model = unescape(model).toLowerCase();  
	var num = '';
	if(boom[make] && boom[make][model]) {num = boom[make][model];}
	if(num == '') {return;}
	document.getElementById('boom_tag').innerHTML = '<img src="http://ad.doubleclick.net/activity;src=3880;dcnet=3880;boom='+num+';sz=1x1;ord=1?" width="1" height="1" border="0" alt="" />';
}

// Google Sponsored Links
function afc_footer_only_j(data) {
	if(data.length > 0) {
		var output = '';
		for(var i=0;i<4;i++) {
			if(data[i]) {
				output += '<div class="item"><a href="'+ data[i].redirect_url +'" ' + params.target + '>'+ data[i].title +'<p>'+ data[i].d1 +' '+ data[i].d2 +'</p><span>'+ data[i].url +'</span></a></div>';
			}
		}
		$j('#dmn_results').html('<div class="spon_link footer_only"><h3><a href="http://about-search.aol.com/index.html#sl" target="_blank">Sponsored Links</a></h3>'+ output + '<a href="http://search.aol.com/aol/weboffers?invocationType=campaign7&query=autos&sbrand=undefined&sch=paol-landing&sclient=aol-landing&scoco=undefined&snum=10&ssch=campaign7&sview=undefined&spch=campaign7" target="_blank">See More Offers</a></div>');
	}
}

function autos_initNewMakes(form,mArr) {
	var mArrL = mArr.length;
	for (var i=0; i<mArrL; i++) {
		form.elements["make"].options[i+1] = new Option(mArr[i].l,mArr[i].l);
	}
}
function autos_initUsedMakes(form,mArr) {
	var makeArray = new Array();
	for (var make in mArr) {
		makeArray.push(make);
	}
	var mArrL = makeArray.length;
	makeArray.sort();
	for (var i=0; i<mArrL; i++) {
		form.elements["make1"].options[i+1] = new Option(makeArray[i],makeArray[i]);
	}
}

function autos_initNewModels(make, mArr) {
	var makeVal = make.options[make.selectedIndex].value;
	var model = make.form.elements["model"];
	model.options.length = 0;
	model.options[0] = new Option("Show All Models", "");

	if (!makeVal || makeVal == "-1") {
		model.disabled = true;
		return;
	}

	var mArrL = mArr.length;
	var i;

	for (i=0;i<mArrL; i++) {
		if (mArr[i].l == makeVal) break; 
	}

	mArrL = mArr[i].m.length;

	for (var j=0;j<mArrL; j++) {
		model.options[j+1] = new Option(mArr[i].m[j].l,mArr[i].m[j].l);
	}

	model.selectedIndex = 0;
	model.disabled = false;
}
function autos_submitNewSearch(form){
	var make = document.getElementById("selectedMake");
	var model = document.getElementById("selectedModel");
	if (make.value == "") {
		alert("Please select a 'Make'");
		make.focus();
		return false;
	}
	if (model.value == "") {
		model.disabled="true";
	}
	return true;
}
function autos_submitUsedSearch(form){
	if(form.elements['make1'].value == -1) {
		alert("Please select a 'Make'");
		return false;
	}
	var locElem = form.elements["location"];
	if(locElem.value == "" || locElem.value == locElem.defaultValue) {
		locElem.disabled = true;
	}
}

function autos_submitKeywordUsedSearch(form){
	var keywordElem = form.elements["keyword"];
	if(keywordElem.value == keywordElem.defaultValue) {
		keywordElem.value = ""
	}
	var locElem = form.elements["location"];
	if(locElem.value == locElem.defaultValue) {
		locElem.value = "" ;
	}
}

// KBB Search Module - Used/KBB
function kbb_init() {
	$j(document).ready(function(){
		$j('.kbb_search .content div > input').each(function() {
			$j(this).attr('checked','');
		});
		$j('.kbb_search .right > div').each(function() {
			$j(this).hide();
		});
		$j('.kbb_private_radio').attr('checked','checked');
		$j('.kbb_private_frame').show();
	});
}
function kbb_sel(sel_type) {
	$j('.kbb_search .content div > input').each(function() {
		$j(this).attr('checked','');
	});
	$j('.kbb_search .right > div').each(function() {
		$j(this).hide();
	});
	$j('.kbb_' + sel_type + '_radio').attr('checked','checked');
	$j('.kbb_' + sel_type + '_frame').show();
}
function init_maincallout(sel_type) {
	var newObj = $j('<img src="http://o.aolcdn.com/art/ch_autos/autos_new.gif" class="new_img" alt="" />');
	$j('.mainUsedCars h2').append(newObj);
	if (document.cookie.indexOf('saw_callout') == -1) {
		$j('.new_callout h2').before($j('<iframe src="http://o.aolcdn.com/art/ch_autos/blank.html" height="73px" width="636px" frameborder="0"></iframe>'))
		$j('.new_callout').show().animate({opacity: 1.0},2000).fadeOut('slow','').end();
		document.cookie = "saw_callout=1; path=/";
	}
}

/* Make-Model Template */
var current = 0;
var showPhotosExterior = 1;
var cntExt = 0;
var cntInt = 0;
var imageDir = "http://cdn.digitalcity.com/autos2007";

function initPictures()	{
	for (var k=0; k<picArray.length; k++)	{
		if (imageVendor == 'autodata')	{
			picArray[k] = 'http://imageonthefly.autodatadirect.com/images/?IMG=' + picArray[k] + '&WIDTH=314&HEIGHT=186';
		} else	{
			picArray[k] = 'http://o.aolcdn.com/commerce/images/' + picArray[k];
		}
	}
}

function showRegularErrorImg(obj) {
	$j(obj).attr({ 
		src: "/cars-images/cars-image_unavailable.jpg",
		width: "314",
		height: "236"
	});
}

function prevImage(){
   if (current == 0){
      $j('.masthead_image img').attr('src',picArray[picArray.length - 1]);
      current = picArray.length - 1;
   } else {
      $j('.masthead_image img').attr('src',picArray[current-1]);
      current -= 1;
   }
   $j('.masthead_footer .controls span').html((current+1)+'/'+picArray.length);
}

function nextImage(){
   if (current == picArray.length - 1){
      $j('.masthead_image img').attr('src',picArray[0]);
      current = 0;
   } else {
      $j('.masthead_image img').attr('src',picArray[current+1]);
      current += 1;
   }
   $j('.masthead_footer .controls span').html((current+1)+'/'+picArray.length);
}

function init_mastHead() {
	$j('.controls .c_prev').bind('click',function(){
		prevImage();
		return false;
	});
	$j('.controls .c_next').bind('click',function(){
		nextImage();
		return false;
	});
	$j('.masthead_image img').bind('error',function(){
		showRegularErrorImg(this);
	});
}

//Best Deals v2
function closeDetails(){
	$j('.selected').removeAttr('class').addClass('empty');
	$j('.best_deal_detail_wrap').remove();
	$j('.best_deals .getaquote').remove();
}

function highlightThis(ele){
if(ele.className=='empty')
	ele.className = 'hover';
else if(ele.className=='hover')
	ele.className='empty';
	/*if($j(ele).attr('class')==undefined)
		$j(ele).addClass('hover');
	else if($j(ele).attr('class')=='hover')
		$j(ele).removeAttr('class');*/
}

function store(ele){			
	ele.nextSibling.value=ele.selectedIndex;
}
function repl(str){
	return str.replace(/\s+&\s+/g, '_')
}

function selectBoxOption(section,el) {
	if (el.options[el.selectedIndex].disabled) {
		alert("This option is not available! ");
		el.selectedIndex=el.nextSibling.value;
		return;
	}	
	if($j('#dd_make').val()){
		$j('#dd_make option:selected').val(repl($j('#dd_make option:selected').val()));	
		$j('#dd_model option:selected').val(repl($j('#dd_model option:selected').val()));
	}
	$j('#searchForm').submit();
}

//Franchise Galleries
function aol_initFranGal(currPage,totalPages,pageUrl) {
	$j(".autosDL .slide").each(function(){
			var franchise_img = $j("<div class='franchise_img'></div>");
			var franchise_text= $j("<div class='franchise_text'></div>");
			var slide_head=$j("<div class='slide_head'></div>");
			var head_left=$j("<div class='head left'></div>");
			var div = $j("<div></div>");
			var franchise_slink = $j("<div class='franchise_slink'></div>");
			var pagination = $j("<div class='pagination'></div>");

			$j(".autosDL .pagination div").appendTo(pagination);

			var lnkVal = $j(".stext .more a:first",this).attr('href');
			if(lnkVal) {
				$j('.photo img', this).wrap('<a href="'+ lnkVal +'"></a>');
			}

			$j(".photo",this).appendTo(franchise_img);
			$j(".head h3",this).appendTo(head_left);
			$j(".copy",this).appendTo(div);
			$j(".links",this).appendTo(franchise_slink);

			slide_head.append(head_left).append(pagination).append("<div class='clear'></div>");
			franchise_text.append(slide_head).append(div).append(franchise_slink).append('<div class="slide_foot"></div>');
			$j(this).parent().html(franchise_img).append(franchise_text);

			var dl = $j(".franchise_text");
			var prev_style = currPage == 1? 'filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;':' ';
			var next_style = currPage == totalPages? 'filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;':'' ;
			var prev_href = currPage == 1?"":"href='" + pageUrl + "/pg-" + (currPage - 1) + "'";
			var next_href = currPage == totalPages?"":"href='" + pageUrl +"/pg-"+ (currPage + 1) + "'";
			$j("<div class='nav'><a " + prev_href + "class='prev' style='" + prev_style + "'><span>previous</span></a><a " + next_href + "class='next' style='"+ next_style + "'><span>next</span></a></div>").appendTo($j('.slide_foot'));
	});
	
	$j(document).ready(function(){
		aol_initFranGal_search();
		$j('#foot_search').bind('blur',function(){
			restoreDefVal(this);
		});
		$j('#foot_search').bind('click',function(){
			clearDefVal(this);
		});
		$j('.slide_foot form').bind('submit',function(){
			return aol_submitFranSlideForm();
		});
		$j('.listing_content a img').each(function(){
			$j(this).bind('error',function(){
				showRegularErrorImg(this);
			});
		});
	});
}
function aol_initFranGal_search() {
	var labelTxt = '';
	var hidFields = '<input type="hidden" name="pdata" value="100000165x1202441438x1200094664" /><input type="hidden" name="range" value="50" />';
	if(fr_year != '' && fr_make != '' && fr_model != '') {
		var yearVal = '<input type="hidden" name="year1" value="' + fr_year + '" />';
		var yearLab = fr_year;
		if(fr_year1){
			yearVal += '<input type="hidden" name="year2" value="' + fr_year1 + '" />';
			yearLab += '-'+fr_year1;
		}
		labelTxt += yearLab + ' ' + fr_make + ' ' + fr_model + ' ';
		hidFields += yearVal + '<input type="hidden" name="make1" value="' + fr_make + '" /><input type="hidden" name="model1" value="' + fr_model + '" />';
	} else if(fr_body != '') {
		labelTxt += fr_body + ' ';
		hidFields += '<input type="hidden" name="keyword" value="' + fr_body + '" />';
	} else {
		if(fr_body == '' && fr_key != '') {
			labelTxt += fr_key + ' ';
			hidFields += '<input type="hidden" name="keyword" value="' + fr_key + '" />';
		}
	}
	
	if(labelTxt.length > 0) {
		$j('.slide_foot .nav').before('<form method="get" action="/used-pranha-redirect.jsp"><div class="left"><input type="text" id="foot_search" name="location" value="zip code or city, state" />'+ hidFields +'<div class="newDefButton"><input type="submit" value="Go" /></div></div></form><img src="http://pr.atwola.com/promoimp/100000165xx1200094664/aol" alt="" height="1" width="1" style="position:absolute" />');
		$j('.slide_foot .left').before('<label for="foot_search">Search for a used <strong>' + labelTxt + '</strong>in your area</label>');
	}
}
function aol_submitFranSlideForm(){
	var loc = $j('#foot_search');
	var jObj = document.getElementById('foot_search');
	if (loc.val() == jObj.defaultValue) {
		alert("Please enter a 'Location'");
		clearDefVal(jObj);
		loc.focus();
		return false;
	}
	return true;
}
var marketPrice = 'Based on factors such as MSRP, Invoice Price, available marketplace inventory, marketplace demand, consumer rebates, and special incentives, Market Price is a good reference point for negotiations with the dealer as it approximates what the average consumer is paying in the market.  Market Price is calculated using a proprietary algorithm developed by Vincentric and is only available for new cars.  Destination charges and taxes are not included when estimating Market Price.';
var msrp ='Manufacturer\'s Suggester Retail Price, also known as "sticker price", is the suggested vehicle sale price as labeled by the automaker.';
var invoice = 'Invoice Price is the price that the dealer theoretically (but not necessarily) paid the automaker.';
var milesDrive = 'Since Total Cost to Own estimates can vary based upon the number of miles you drive per year, AOL Autos allows you to select the number of miles you drive per year from a dropdown menu. Entering the number of miles you drive per year will help AOL Autos prepare a more accurate Total Cost to Own estimate for your vehicle.';
var rating = 'The vehicle\'s value rating is calculated by Vincentric. How does Vincentric measure value and establish its ratings? This question is best answered with an example. Two vehicles can have the same purchase price, but different ownership costs. The vehicle with the lower ownership costs is a better value than the one having the higher ownership costs. To put this concept into action, Vincentric first measured the cost of ownership for over 2,000 vehicle configurations from the same model year.  Cost of ownership is calculated by combining the costs associated with depreciation, insurance, repairs, maintenance (scheduled and unscheduled), finance, fuel, taxes and state fees (including the Federal Hybrid Tax Credit), and opportunity costs. This creates the "Measured" Cost of Ownership. The vehicle\'s "Expected" cost of ownership is based on statistical models that correlate the price of a vehicle with cost of ownership within each of the 34 segments that comprise all vehicles. An average "Expected" cost to own is established. Any vehicle that falls above the Average Value line is a better value than a vehicle that fall below the "Average Value" line. Vincentric uses this approach to rate each vehicle from Excellent to Poor on a five point rating system, which is converted to a five star rating system by AOL Autos. The scores are calculated based on the percentage difference between a vehicle\'s "Expected" cost of ownership and its "Measured" cost of ownership. This statistically driven approach allows Vincentric to measure value in an unbiased manner, and help consumers and the automotive industry better understand how ownership costs impact the creation of value for the buyer.';
var cpm = 'Cost Per Mile is an estimate of what it will cost you to operate the vehicle per mile, over a five year period. Cost Per Mile is a calculation that AOL Autos makes by taking the Total Cost to Own price over 5 years and dividing it by the number of miles you selected when using the Cost of Ownership calculations.  Note:  The default annual mileage is 15,000';
var dep = 'Depreciation is the reduction in value incurred during a given period of time.  Depreciation is calculated assuming the owner will end up selling the vehicle to a private party (not a dealer) and uses a combination of data sources such as length of ownership, vehicle condition, average annual mileage, and sales price.';
var fuel = 'Fuel costs are what it will cost you at the gas pump for the vehicle over a period of time. Fuel costs are calculated using the U.S. Government Environmental Protection Agency\'s estimated mileage figures (when available) for both highway and city driving, then adjust based on the estimated percentage of mileage for these two types of driving. The estimated miles driven per year, the type of fuel the vehicle requires, and current state gas prices are all factored into the Fuel Cost.';
var fin = 'Financing is the amount it costs to borrow money for a vehicle purchase.  Using data from multiple lending institutions, along with national averages provided by the financial industry, financing costs is based on a standard down payment, loan term, and interest rate to simplify calculations and comparisons.';
var ins = 'Actual Insurance costs vary by type of vehicle, driver, and coverage amounts.  Using data from multiple insurance industry sources, the insurance costs for each vehicle are based on the same driver age, driving record, location, discounts, type of use, as well as insurance coverage.';
var mnt = 'Maintenance costs are based on manufacturer intervals for scheduled maintenance, Vincentric intervals for unscheduled maintenance, labor rate, and parts prices.';
var fee = 'Administrative fees include registration and title fees while taxes include sales tax.  Both fees and taxes vary by state.';
var rep = 'Repair costs are based on the average price for keeping a vehicle in operating condition, not including the cost for scheduled maintenance.  The costs assume a $0 deductible extended service contract and are based on averages from major providers of automotive extended warranty contracts.  Repairs also take into account manufacturer warranties. with adjustment for both lifecycles of 2, 3, 4 or 5 years and a total lifecycle mileage of 10,000, 15,000, and 20,000 miles per year.';
var opp = 'Opportunity cost is the amount of interest that could have been earned if those funds had not been spent owning and operating the vehicle.  Rates are based on certificates of deposit rates supplied by nationally recognized financial institutions and length of ownership.';

$j(document).ready(function () {
   var whatsThis = $j('<div class="whatsThis"></div>');
	whatsThis.html('<div><a class="close_x" href="javascript:;">X</a><div id="message"></div></div>');
	var bc = $j('.body_content');
	if($j(bc).length == 0){
		$j('body').append(whatsThis);
	}else{
		$j(bc).append(whatsThis);		
	}
	$j('.whatsThis .close_x').bind('click',function(){$j(this).parent().parent().hide()});	
	$j('.describe:eq(0)').wrap('<a href="javascript:void(0)" onclick="showText($j(\'#marketPrice\'),msrp,0,18,280)"></a>');
	$j('.describe:eq(1)').wrap('<a href="javascript:void(0)" onclick="showText($j(\'#marketPrice\'),invoice,0,18,280)"></a>');
	$j('.describe:eq(2)').wrap('<a href="javascript:void(0)" onclick="showText($j(\'#marketPrice\'),marketPrice,0,18,280)"></a>');	
});

function showDescription(ele,leftOffset,topOffset){
	var text = '';
	var eleText = $j(ele).html();

	if(eleText == 'Depreciation'){
		text=dep;
	}else if(eleText == 'Cost Rating'){
		text=rating;
	}else if(eleText == 'Cost per mile'){
		text=cpm;
	}else if(eleText == 'Fuel Cost'){
		 text=fuel;
	}else if(eleText == 'Financing'){
		text=fin;
	}else if(eleText == 'Insurance'){
		text=ins;
	}else if(eleText == 'Maintenance'){
		text=mnt;
	}else if(eleText == 'Fees, Taxes' || eleText == 'Fees and Taxes'){
		text=fee;
	}else if(eleText == 'Repairs'){
		text=rep;
	}else if(eleText == 'Opportunity Cost' || eleText == 'Opportunity Costs'){
		text=opp;
	}
	showText(ele,text,leftOffset,topOffset,200);
}

function showText(ele,text,leftOffset,topOffset,width){
	var leftBodyContent = 0;
	if($j('.body_content').length != 0){
		leftBodyContent = $j('.body_content').offset().left;
	}
	var position = $j(ele).offset();
	var body = $j('body').offset();	
	var left = (position.left-body.left+leftOffset-leftBodyContent)+'px';
	var top = (position.top-body.top+topOffset)+'px';	
	
	$j('.whatsThis #message').html(text);	
	$j('.whatsThis').css({left:left,top:top,width:width}).show();
}

// beacoN v6
var bN={v:6,h:[],b:"",w:100,t:document.title,r:document.referrer,ae:function(A,B,C){if(A.addEventListener){A.addEventListener(B,C,false)}else{if(A.attachEvent){A.attachEvent("on"+B,C)}}},d:new Date(),init:function(){var A=window,E=bN.h.toString(),B=A.location.hostname,D=new RegExp(B+"![0-9]+"),C=E.match(D);if(A.bNi){return }if(E.indexOf(B)==-1){return }C=(C)?parseInt(C[0].replace((B+"!"),"")):0;if(Math.floor(Math.random()*C)!=0){return }bN.ae(A,"load",bN.load);bN.ae(document,"click",bN.click);bN.img("vanity/","");A.bNi=1},f:1,wait:function(){var A,B=new Date();do{A=new Date();if(bN.f){return }}while(A-B<bN.w)},img:function(G,D){var C,A,H=new Image(),F=encodeURIComponent;C=new Date();A="?ts="+C.getTime()+"&h="+F(window.location.hostname)+"&v="+bN.v+"&t="+F(bN.t)+"&r="+F(bN.r)+"&l="+bN.l+"&ms="+(C-bN.d);H.onload=function(){bN.f=1};bN.f=0;if(!bN.b){var B=window.location.hostname.split("."),E=B.length-1;B="b."+B[E-1]+"."+B[E];bN.b=B}H.src="http://"+bN.b+"/"+G+A+D+bN.g+bN.i;bN.i="";if(D&&D.indexOf(F(window.location.href.replace(/#.*/,"")+"#"))==-1&&D.indexOf("javascript%3A")==-1&&D.indexOf("&tag=")==-1){if(!document.all){bN.wait()}}},l:0,ls:0,load:function(){var A=new Date();bN.l=A-bN.d;if(Math.floor(Math.random()*bN.ls)!=0){return }bN.ping("load")},p:[],ping:function(B,A){var C=encodeURIComponent;if(typeof bN.p[B]!="undefined"){clearInterval(bN.p[B])}if(typeof A=="number"){if(A>0){A=A*1000;bN.p[B]=setInterval("bN.img('ping', '&nm="+C(B)+"')",A)}else{return }}bN.img("ping","&nm="+C(B))},click:function(B){var L=window,J=document,N=B||L.event,E=N.srcElement||N.target,G=E.className,P,C,D,M,A,O="",F="",K=0,I=0,H=encodeURIComponent;do{P=E.nodeName;if(typeof G!="undefined"&&G.indexOf("bN")!=-1){O+="&tag="+P}if(P=="IMG"){O+="&img="+H(E.src);D=E.alt;if(D){O+="&alt="+H(D)}}if(P=="A"){A=E.href;if(A){O+="&ah="+H(A)}else{return }M=E.innerHTML.replace(/<[^>]*>/g,"");if(M){O+="&at="+H(M)}}if(P=="INPUT"){C=E.type;if(C=="button"||C=="submit"||C=="image"){O+="&btn="+H(E.value)}}F+=(E.id)?E.id+"+":"";E=E.parentNode}while(P!="BODY");if(O!=""){if(N.pageX||N.pageY){K=N.pageX;I=N.pageY}else{if(N.clientX||N.clientY){K=N.clientX+J.body.scrollLeft+J.documentElement.scrollLeft;I=N.clientY+J.body.scrollTop+J.documentElement.scrollTop}}O+="&cx="+K+"&cy="+I;if(F){O+="&id="+H(F.slice(0,-1))}bN.img("click",O)}},g:"",i:"",set:function(C,F,B){var D=encodeURIComponent,A=B?bN.i:bN.g,E=new RegExp("&"+D(C)+"=[^&]*"),G="&"+D(C)+"="+D(F);if(E.test(A)){if(F){A=A.replace(E,G)}else{A=A.replace(E,"")}}else{A+=G}if(B){bN.i=A}else{bN.g=A}}};

// beacoN AXS Flash Detect v1
if(typeof axs=="undefined"){var axs={}}axs.fd=function(E,B){if(!axs.fd.v){if(!E){E=6}if(!B){B=10}var A=0,D,C=B,G=navigator;if(G.plugins&&G.plugins.length){D=G.plugins["Shockwave Flash"];if(D&&D.description){A=D.description.charAt(D.description.indexOf(".")-1)}if(A<E){A=0}if(A>B){A=B}}else{while(!A&&E<=C){try{D=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+C);A=C}catch(F){}if(!A){C--}}}axs.fd.v=A}return axs.fd.v};bN.set("fv",axs.fd());

bN.h=["autos.aol.com"];bN.init();

function aol_initResComp(pNode){var fId='f_maList';var fLa='select a make';var fFi='make';for(var i=0;i<4;i++){if(i==1){var fId='f_moList';var fLa='select a model';var fFi='model'}else if(i==2){var fId='f_yrList';var fLa='select a year';var fFi='year'}else if(i==3){var fId='f_trList';var fLa='select a trim';var fFi='trim'}pNode.find('form').append('<div id="'+fId+'" class="listFilt '+fId+'"><h3 class="label">'+fLa+'</h3><div class="listOpts list_styled"><div class="bor_wrap"><div class="inner"><a href="/" class="close_x">X</a></div></div></div><input type="hidden" name="'+fFi+'" class="reqVal" /></div>')}pNode.find('form').append('<div id="f_suButt"><input type="hidden" name="loc" value="" /><input type="hidden" name="review" value="" /><input type="hidden" name="pageType" value="" /><input type="submit" value="go" class="subBut" /></div>');pNode.find('form').bind('submit',function(){$j(this).find('input.reqVal').each(function(){if($j(this).attr('name')!='make' && $j(this).val()==''){$j(this).attr('disabled','disabled')}})});$j(window).ready(function(){$j.getScript('/cars-js/cars-reviewevd.jsp?make=make',function(){var make='';var ulObj='';var makesArray=new Array();for (make in jDataArr){makesArray.push(make)}makesArray.sort();var mLen=makesArray.length;for(var i=0;i<mLen;i++){var r=i % 19;if(i==0){ulObj+='<ul class="ext"><li><a href="/car-az/">all makes</a></li>'}if(i!=0 && r==0 && i!=mLen){ulObj+='</ul><ul class="ext"><li><a href="/car-'+makesArray[i]+'-az/" class="list_item">'+makesArray[i]+'</a></li>'}else{ulObj+='<li><a href="/car-'+makesArray[i]+'-az/" class="list_item">'+makesArray[i]+'</a></li>'}if(i==eval(mLen-1)){ulObj+='</ul>'}}var maNode=$j('#f_maList');var moNode=$j('#f_moList');var yrNode=$j('#f_yrList');var trNode=$j('#f_trList');maNode.find('.inner').append(ulObj).find('li a').each(function(){$j(this).bind('click',function(){var tObj=$j(this);var maVal=tObj.text();maNode.find('a.actSel').removeClass('actSel');tObj.addClass('actSel');maNode.find('h3').text(maVal).removeClass('is_open').next().removeClass('list_open').next().val(maVal);moNode.find('h3').text('select a model').removeClass('has_items').unbind('click');moNode.find('input').val('');yrNode.find('h3').text('select a year').removeClass('has_items').unbind('click');yrNode.find('input').val('');trNode.find('h3').text('select a trim').removeClass('has_items').unbind('click');trNode.find('input').val('');if(maVal=='all makes'){maNode.find('input').val('')}else{if(moNode.find('h3').hasClass('has_items')==false){moNode.find('h3').addClass('has_items').bind('click',function(){var bObj=$j(this);bObj.toggleClass('is_open');bObj.next().toggleClass('list_open');rt.a=bObj.parent().attr('class')});moNode.find('.close_x').bind('click',function(){$j(this).parent().parent().parent().removeClass('list_open');$j(this).parent().parent().parent().parent().children(0).removeClass('is_open');return false})}aol_popResComp('mo',$j('#f_moList'),maVal)}return false})});maNode.find('h3').addClass('has_items').bind('click',function(){var bObj=$j(this);$j(this).toggleClass('is_open');$j(this).next().toggleClass('list_open');rt.a=bObj.parent().attr('class')});maNode.find('.close_x').bind('click',function(){$j(this).parent().parent().parent().removeClass('list_open');$j(this).parent().parent().parent().parent().children(0).removeClass('is_open');return false})});$j('#f_maList input').val('');$j('#f_moList input').val('');$j('#f_yrList input').val('');$j('#f_trList input').val('')})}
function aol_popResComp(lType,pNode,valOne,valTwo,valThr){var nNode=pNode.next();if(lType=='mo'){var lLab='all models';var dataArr=jDataArr[valOne];dataArr.sort()}else if(lType=='yr'){var lLab='all years';var dataArr=jYearArr[valOne+':'+valTwo];dataArr.sort().reverse()}else if(lType=='tr'){var lLab='all trims';var dataArr=valOne}pNode.find('h3').addClass('has_items').next();var lLen=dataArr.length;var lNum=Math.round(eval(lLen / 3));var ulObj='';if(lLen <= '38'){var lRem='19';var uCla=''}else{var lRem=lNum;var uCla=' class="ext"'}for(var i=0;i<lLen;i++){var r=i % lRem;if(i==0){ulObj+='<ul '+uCla+'><li><a href="javascript:;">'+lLab+'</a></li>'}if(i!=0 && r==0 && i!=lLen){ulObj+='</ul><ul '+uCla+'><li><a href="javascript:;" class="list_item">'+dataArr[i]+'</a></li>'}else{ulObj+='<li><a href="javascript:;" class="list_item">'+dataArr[i]+'</a></li>'}if(i==eval(lLen-1)){ulObj+='</ul>'}}pNode.find('ul').remove();pNode.find('.inner').append(ulObj).find('li a').each(function(){$j(this).bind('click',function(){var obj=$j(this);var oTxt=obj.text();var oVal=oTxt;if(oTxt==''+lLab+''){oVal=''}pNode.find('a.actSel').removeClass('actSel');obj.addClass('actSel');pNode.find('h3').text(oTxt).removeClass('is_open').next().removeClass('list_open');pNode.find('input').val(oVal);if(oTxt==''+lLab+''){if(lType=='mo'){nNode.find('h3').text('select a year').removeClass('has_items').unbind('click');nNode.find('input').val('');nNode.next().find('h3').text('select a trim').removeClass('has_items').unbind('click');nNode.next().find('input').val('')}else if(lType=='yr'){nNode.find('h3').text('select a trim').removeClass('has_items').unbind('click');nNode.find('input').val('')}}else{if(lType=='mo'){aol_popResComp('yr',$j('#f_yrList'),$j('#f_maList input').val(),$j('#f_moList input').val());nNode.find('h3').removeClass('has_items').text('all years').unbind('click');nNode.next().find('h3').removeClass('has_items').text('all trims').unbind('click')}else if(lType=='yr'){aol_getResTrimList($j('#f_maList input').val(),$j('#f_moList input').val(),$j('#f_yrList input').val());nNode.find('h3').removeClass('has_items').text('all trims').unbind('click');nNode.find('ul').remove()}if(nNode.find('h3').hasClass('has_items')==false){nNode.find('h3').addClass('has_items').bind('click',function(){var bObj=$j(this);$j(this).toggleClass('is_open');$j(this).next().toggleClass('list_open');rt.a=bObj.parent().attr('class')});nNode.find('.close_x').bind('click',function(){$j(this).parent().parent().parent().removeClass('list_open');$j(this).parent().parent().parent().parent().children(0).removeClass('is_open');return false})}}return false})})}
function aol_getResTrimList(moVal,maVal,yrVal){var trNode=$j('#f_trList');var trInNode=trNode.find('.inner');$j.getJSON('/cars-trims_ajax_helper.jsp?make='+moVal+'&model='+maVal.replace(' & ','_')+'&year='+yrVal+'&flip=trimlevel',function(jData){var lLen=jData.length;for (var i=0;i<lLen;i++){if(i==0){trInNode.append('<ul class="full"><li><a href="javascript:;" class="aTrim">all trims</a></li>')}aol_popResTrimList(jData[i],trInNode);if(i==eval(lLen-1)){trInNode.append('</ul>')}}if(lLen>20){$j('#f_trList .bor_wrap').css({height:'272px',overflow:'scroll'})}else{$j('#listingsPage #f_trList .bor_wrap').css({height:'auto',overflow:'auto'})}trInNode.find('ul li a').each(function(){$j(this).bind('click',function(){var hNode=trNode.find('h3');trNode.find('a.actSel').removeClass('actSel');$j(this).addClass('actSel');if($j(this).hasClass('aTrim')==true){hNode.text('all trims').removeClass('is_open');hNode.next().removeClass('list_open');$j('#f_trList input').val('')}else{hNode.removeClass('is_open');hNode.next().removeClass('list_open');$j('#f_trList input').val($j(this).attr('name'))}var hTxt=$j(this).text();hNode.text('');hNode.append('<span>'+hTxt+'</span>');return false})})})}
function aol_popResTrimList(trimContent,trInNode){for(var content in trimContent){trInNode.find('ul').append('<li><a href="javascript:;" name="'+content+'" title="'+trimContent[content]+'" class="list_item">'+trimContent[content]+'</a></li>')}}
function aol_closeCustDrop(pId,tObj){$j('#'+pId+' h3').bind('mouseover',function(){if(tObj.timer && $j(this).parent().attr('class')==tObj.a){clearTimeout(tObj.timer);tObj.timer=null}}).bind('mouseleave',function(){var obj=this;tObj.timer=setTimeout(function(){$j(obj).removeClass('is_open').parent().children(1).removeClass('list_open')},500)});$j('#'+pId+' .bor_wrap').bind('mouseover',function(){if(tObj.timer){clearTimeout(tObj.timer);tObj.timer=null}}).bind('mouseleave',function(){var obj=this;tObj.timer=setTimeout(function(){$j(obj).parent().removeClass('list_open').parent().children(0).removeClass('is_open')},500)})}