Javascript Help

I need help writing a function is javascript

I have an order form that right now when some puts in the number of books they want to order it calculates the total by basically

taking the number of books orders x 15.99 base price + 3.00 shipping cost + 5% sales tax if you state u select is Massaschusetts = total cost.

This is all displayed on order form page as you fill it out and it will change the total cost right away if you change the number ordered.

I need to add a function that will do this

Check the the field where the number of books ordered is entered by the user and if that amount is only one book the shipping cost is $3.00 but if the number order is more than 1 book the cost of shipping is determined adding $1.50 to the shipping base cost for every book over one that is ordered example

Number Ordered greater than 1 the shipping cost is $3.00+($1.50 x Books Ordered - 1 book ordered to subtract the 1st book that had a shipping charge of 3.00

so simple formula

5 Books are going to be ordered

3.00+(1.50x5-1)

3.00+(1.50x4)

3.00+6.00

9.00 total shipping cost for 5 books is 9.00

I need to add a function just like the settax function in the code below to make the form make this second calculation along with the alreay working total cost calculation.

I tried to write it bases off the settax function is the code above but I do not know the correct syntax for the function?

Code of both the javascript that I want to ad this to and the form fields that the function uses to display the final answer to the calculations.

Can anyone help me?


<script language="JavaScript" type="text/JavaScript">

<!--

function settax(Info){

	if(Info.state.value == "  "){ return false; }

	if(Info.state.value == "MA"){
	
		Info.tax.value = 5;
		
	}else{
	
		Info.tax.value = 0;
	}
	
	recalculate(Info);
	
	return false;
	
}

function recalculate(Info){

	var pprice = Info.qty.value*Info.price.value;
	var price = pprice.toFixed(2);
	
	var pshiphand = Info.qty.value*Info.shiphand.value;
	var shiphand = pshiphand.toFixed(2);

	var ptax = Info.price.value*(.01*Info.tax.value);
	var tax = Info.qty.value*ptax.toFixed(2);
	
	var total = parseFloat(tax)+parseFloat(shiphand)+parseFloat(price);
	
	Info.total.value = total.toFixed(2);

	return false;
}

//-->

	onLoad = settax(document.buynow);
	
</script>


<input type="text" name="qty" size=4 value="1" onBlur="recalculate(this.form);">

<input type="text" name="price" value="15.99" style="border-style: none; background: inherit" readonly="yes" size=6>

<input name="shiphand" type="text" style="border-style: none; background: inherit" value="3.00" size=3 maxlength="3" readonly="yes">

<input name="tax" type="text" style="border-style: none; background: inherit" value="0" size=1 maxlength="1" width="10">