<!-- BEGIN HIDING FROM OLD BROWSERS

//JOM...need to make sure this page always opens in a new window unless opened from
// the non-content area of a frame
//ledgerautos.htm
//alert("Ref="+document.referrer)



function checkNumber(input,form1){
	if(input.value==''){
		input.value=input.defaultValue
	}
    
	            status=''
                msg ="This field requires numeric data: " + input.value;
                var str = input.value;
				if (str.indexOf(",") > 0 ) {
					// COMMAS ARE NOT ALLOWED
					var str2 = str.substring(0,(str.indexOf(","))) + str.substring((str.indexOf(",")+1), str.length);
					input.value= str2;
				}
            
			    str = input.value;
                for (var i = 0; i < str.length; i++){
                                var ch = str.substring(i, i + 1)
                                
								if ((ch < "0" || "9" < ch) && ( ch != '.')  && (ch != '-')){
                                	input.focus()
                                	input.value=input.defaultValue;
                                	input.select()
                                	status=msg;
                                } 
        		}
        add_input(form1)
 }

function add_input(form1){
	var total1,total2,total3,total4,total5,total6;


        if (form1.interest_rate.value == 0) {form1.interest_rate.value=9}
        if (form1.no_of_payments.value == 0) {form1.no_of_payments.value=1}

        total1=((form1.cost1.value*1)+(form1.destination.value*1))              

        total2=(total1*1-form1.trade_in.value*1)
        if (total2 < 0) { total2=0 }

        total3=((total2*(form1.sales_tax.value*'.01'))+total2*1)
        if (total3 < 0) { total3=0 }
//      form1.sub_total_cost.value=((total3*1))

        total4=(total3*1-form1.incentives.value*1)
        if (total4 < 0) { total4=0 }

        total5=(total4*1-form1.down_payment.value*1)
        total6=(total5*1)
        if (total6 < 0) { total6=0 }

        form1.total_cost.value=((total6*1))
        compute_payments(form1)
}

function compute_payments(form1)
{
    var i = form1.interest_rate.value;
	if (i > 0.0) {
        i = i / 100.0;
        }
    i /= 12;
    var pow = 1;
    for (var j = 0; j < form1.no_of_payments.value; j++)
        pow = pow * (1 + i);
	var x = (form1.total_cost.value * pow * i) / (pow - 1);// CC
	//x = x*100;
	//x=x.IndexOf(".");
	x = Math.round(x);
	form1.monthly_payments.value = x//(form1.total_cost.value * pow * i) / (pow - 1)
}

function selectField(field)
{
        field.select()
}

function clearForm(form1)
{
        form1.cost1.value = "0"
        form1.destination.value="0"
        form1.trade_in.value="0"
        form1.incentives.value = "0"
        form1.down_payment.value = "0"
//      form1.sub_total_cost.value="0"
        form1.total_cost.value="0"
        form1.interest_rate.value="9"
        form1.no_of_payments.value="60"

        form1.monthly_payments.value="0"
}
// END HIDING -->

