function clearbox(val) {	var box_val = document.getElementById("message").value;	// alert(box_val.length);	if (box_val.length == val) {		document.getElementById("message").value = '';	}}function popitup(url) {	newwindow = window.open(url, 'name', 'height=200,width=150');	if (window.focus) {		newwindow.focus()	}	return false;}function popOpen(page, width, height, scrollbars) {	if (width == "") {		width = 457;	}	if (height == "") {		height = 459;	}	window.open(page, "w", "width=" + width + ", height=" + height			+ ", menubar=0, scrollbars=" + scrollbars);}function mpgCalculator(){		mpg_miles  = $('#mpg_miles').val();	mpg_price  = $('#mpg_price').val();	mpg_city  = $('#mpg_city').val();	mpg_hwy  = $('#mpg_hwy').val();		cost = 0;	if(parseInt(mpg_city)<parseInt(mpg_hwy)){		cost=(0.6/mpg_city+0.4/mpg_hwy)*mpg_price*((mpg_miles/12)*12);	}	$('#fuel_cost').html("<h3><strong> $"+ cost.toFixed(2) + ' / Year</strong></h3>');	 }function loanCalculator() {	rate = $('#rate').val();	term = $('#term').val();	downp = $('#downp').val();	price = $('#price').val().replace(/$/g, "").replace(/,/g, "");	trade = $('#trade').val();	msg = "";	if (isNaN(price)) {		msg += "\nPlease enter just numbers in the 'Vehicle Price' field";	}	if (downp != "" && isNaN(downp)) {		msg += "\nPlease enter just numbers in the 'Down Payment' field";	} else {		if (downp == "") {			downp = 0;		}	}	if (msg != "") {		alert(msg);	} else {		if (parseInt(downp) < parseInt(price)) {			principal = parseInt(price) - parseInt(downp)					- (trade == null ? 0 : parseInt(trade));			mointerest = rate / 100 / 12;			months = term * 12;			x = Math.pow(1 + mointerest, months);			$('#monthly').html("$"			+ ((principal * x * mointerest) / (x - 1)).toFixed(2)			+ '');		} else {			$('monthly').html('0');			alert("There's no monthly payment with your down payment!");		}	}}function showCoupon(id) {	window.open('http://www.dealerfire.com/coupons/?DealerID=' + id + '', '',			'resizable=yes,width=766,height=620');}function expand_info(val) {	var pos = document.getElementById('expand_info').style.display;	if (pos != "block") {		document.getElementById('expand_info').style.display = 'block';		document.getElementById('expand_lnk').innerHTML = 'Less Info';	} else {		document.getElementById('expand_info').style.display = 'none';		document.getElementById('expand_lnk').innerHTML = 'Expand Info';	}}function showHide(action) {	if (action == 0) {		document.getElementById('overlay').style.display = 'none';	} else {		document.getElementById('overlay').style.display = 'block';	}}var formid = "";var divclass = "";var query = "";loadAJAH = function(filename, obj) {	if (filename == "searchbox_home_new.php") {		formid = 'form#searchform_new';		divclass = "#searchbox_new";	} else if (filename == "searchbox_home_used.php") {		formid = 'form#searchform_used';		divclass = "#searchbox_used";	}else if (filename == "searchbox_home_newused.php") {		if (typeof(obj) == 'undefined')			var form = jQuery('form#searchform_used');		else 			var form = jQuery(obj.form);					formid = 'form#'+jQuery(form).attr('id');		divclass = '#'+jQuery(form).find('div.searchbox_home_container').attr('id')	} 	else {		formid = "form#searchform";		divclass = "#searchbox";	}	query = $(formid).formSerialize();	loaderWaitDisable();		$(divclass).load("searchbox_ajax.php?" + query + '&filename=' + filename+'&ajax=1',			loaderDoneDisable);}fillSearchboxValues = function(){	$("input,select", "form#searchform").each(	function() {		if ($(this).attr('name') != '') {			val = jQuery.url.param($(this).attr('name'));		 			val = unescape(val);			val = val.replace(/\+/g,' ');						if(val!=null && val!='' && typeof successful != 'undefined')			$(this).val(val);		}	})}loaderWaitShade = function() {	$('#blackback').css('background-color', '#000000');	$(divclass).fadeTo("slow", 0.30);}loaderDoneShade = function() {	$(divclass).fadeTo("slow", 1, function() {		$('#blackback').css('background-color', '#ffffff')	});}loaderWaitDisable = function() {	$('input,select', divclass).attr('disabled', 'true');}loaderDoneDisable = function() {	$('input,select', divclass).removeAttr('disabled');}/*jQuery( function() {	$('input,select', divclass).removeAttr('disabled');})*/addToCompare = function() {	sessionid = $.cookie('PHPSESSID');	var method = $(this).attr('checked')?"addToCompare":"removeFromCompare";	var valueToStore = $(this).val()	$.ajax({	   type: "POST",	   url: "ajax_functions.php?PHPSESSID="+sessionid,	   data: "method="+method+"&vin="+valueToStore,	   success: function(msg){		loadCompareList();	   }	 });}loadCompareList = function(){	sessionid = $.cookie('PHPSESSID');	$.ajax({	   type: "POST",	   url: "ajax_functions.php?PHPSESSID="+sessionid,	   data: "method=getComparisonVins",	   success: function(msg){	     	   },	   dataType: "script"	})}
