<!-- Begin

function do_totals(form) {
	wmf=eval(form.wet_mooring_fee.value)
	ehf=eval(form.electrical_hookup_fee.value)
	tsf=eval(form.trailer_storage_fee.value)
	
	form.wet_mooring_fee.value = round_decimals(wmf,"2")
	form.electrical_hookup_fee.value = round_decimals(ehf,"2")
	form.trailer_storage_fee.value = round_decimals(tsf,"2")
	
	trf=wmf+ehf+tsf
	form.total_rental_fee.value = round_decimals(trf,"2")
	
	// Services
	slf=eval(form.services_launch_fee.value)
	srf=eval(form.services_ramping_fee.value)	
	shf=eval(form.services_haulout_fee.value)
	
	form.services_launch_fee.value = round_decimals(slf,"2")
	form.services_ramping_fee.value = round_decimals(srf,"2")
	form.services_haulout_fee.value = round_decimals(shf,"2")
	
	st=slf+srf+shf
	form.services_total.value = round_decimals(st,"2")


	sub_total=eval(form.sub_total.value)
	tax=eval(form.tax.value)	
	total=eval(form.total.value)
	deposit=eval(form.deposit.value)
	total_due=eval(form.total_due.value)

	sub_total=trf+st 
	total=sub_total+(sub_total*tax)
	total_due=total-deposit
	
	form.sub_total.value = round_decimals(sub_total,"2")
	form.total.value = round_decimals(total,"2")
	form.deposit.value = round_decimals(deposit,"2")
	form.total_due.value = round_decimals(total_due,"2")
	

}

/* This script is Copyright (c) Paul McFedries and 
Logophilia Limited (http://www.mcfedries.com/).
Permission is granted to use this script as long as 
this Copyright notice remains in place.*/

function round_decimals(original_number, decimals) {
    var result1 = original_number * Math.pow(10, decimals)
    var result2 = Math.round(result1)
    var result3 = result2 / Math.pow(10, decimals)
    return pad_with_zeros(result3, decimals)
}

function pad_with_zeros(rounded_value, decimal_places) {

    // Convert the number to a string
    var value_string = rounded_value.toString()
    
    // Locate the decimal point
    var decimal_location = value_string.indexOf(".")

    // Is there a decimal point?
    if (decimal_location == -1) {
        
        // If no, then all decimal places will be padded with 0s
        decimal_part_length = 0
        
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "." : ""
    }
    else {

        // If yes, then only the extra decimal places will be padded with 0s
        decimal_part_length = value_string.length - decimal_location - 1
    }
    
    // Calculate the number of decimal places that need to be padded with 0s
    var pad_total = decimal_places - decimal_part_length
    
    if (pad_total > 0) {
        
        // Pad the string with 0s
        for (var counter = 1; counter <= pad_total; counter++) 
            value_string += "0"
        }
    return value_string
}



function hello(){ 
	alert("hi")
} 

// Radio Buttons
function clearButtons(buttonGroup){ 
	for (i=0; i < buttonGroup.length; i++) { 
    	if (buttonGroup[i].checked == true) { 
    	buttonGroup[i].checked = false 
    }
   } 
} 


function checkthis(el)
{
	if (el.name=="time") { el.value=''; }
	if (el.name=="date") { el.value=''; }
}

//  End -->

