function myInit() {
	
	/*
	$("#navigation > ul > li").hover( function () {		
		$("#navigation ul > li").removeClass('hover');
		$(this).addClass('hover');
		},function () {
		//$(this).removeClass('hover');
		}
		);
	*/
		
	$('#navigation > ul > li:last').addClass('last');
	
	$("#commentForm").submit(function() {		
		$('#commentForm').attr('method','post');
		errors = '';	
		if (!$('#cf_comment').val()) {
			errors += "Comment\n";
			}
		if (!$('#cf_name').val()) {
			errors += "Name\n";
			}
		if (!$('#cf_email').val()) {
			errors += "Email\n";
			}
		if (errors) {			
			alert("The following fields are required:\n\n"+errors);
			return false;
			} 	
		});
	
	}

function trunc(formElement){
var sValue = formElement.value;
formElement.value = Math.round(sValue*100)/100;	
}

function update(){
calculate();
return false;
}

function calculate(){
var loan = new Number(document.calcform.loan.value);
var months = document.calcform.term.value;
var int_rate = new Number(document.calcform.interest_rate.value);
var factor_a = new Number(int_rate/1200);
var factor_b = new Number(Math.pow((1 + (int_rate/1200)), months));
var factor_c = new Number(factor_b -1);
var monthly_payment = new Number(((factor_a * factor_b)/factor_c)* loan);
var total_charge_credit = new Number((monthly_payment * months) - loan);
var total_repayment = new Number(monthly_payment * months);	
// Interest Only
var int_only = ((loan * int_rate) / 12)/100;
if(total_repayment > 0  ){
	document.calcform.monthly_payment.value =  monthly_payment ;
	document.calcform.total_charge.value = total_charge_credit;
	document.calcform.total_repayment.value = total_repayment;
	document.calcform.interest_only.value = int_only;
	trunc(document.calcform.monthly_payment);
	trunc(document.calcform.total_charge);
	trunc(document.calcform.total_repayment);
	trunc(document.calcform.interest_only);
}
}
