
//----------------------------------------------------------------------------------------
function calcFees() {
	var result;
	var aprres;
	switch (document.frmCalc.lc_period.options[document.frmCalc.lc_period.selectedIndex].value){
	case '1':
	        result = (document.frmCalc.lc_amt.options[document.frmCalc.lc_amt.selectedIndex].value - 0) * 0.075
	        aprres = 7.5 * 365
	  break
	case '3':
	        result = (document.frmCalc.lc_amt.options[document.frmCalc.lc_amt.selectedIndex].value - 0) * 0.1
	        aprres = 10 * 121.667
	  break
	case '7':
	        result = (document.frmCalc.lc_amt.options[document.frmCalc.lc_amt.selectedIndex].value - 0) * 0.15
	        aprres = 15 * 52.143
	  break
	case '15':
	        result = (document.frmCalc.lc_amt.options[document.frmCalc.lc_amt.selectedIndex].value - 0) * 0.3
	        aprres = 30 * 24.333
	  break
	case '31':
			result = (document.frmCalc.lc_amt.options[document.frmCalc.lc_amt.selectedIndex].value - 0) * 0.6;
			aprres = 60 * 12
	  break
	/*default:
	      document.calc.fees.value = 'undefined';
	        (document.frmCalc.lc_period.options[document.frmCalc.lc_period.selectedIndex].value - 0)
			* (document.frmCalc.lc_amt.options[document.frmCalc.lc_amt.selectedIndex].value - 0) * 0.4
			*/
	} // end switch

		var endval = cent(result);
		var rounded = round(endval,2);
		var padded = cent(rounded);
		document.frmCalc.fees.value = '$' + padded;
		document.frmCalc.fees.className='ftbxcalc';

		var aprendval = cent(aprres);
		var aprrounded = round(aprendval,1);
		//aprpadded = cent(aprrounded);
		document.frmCalc.apr.value = aprrounded + '%';
		document.frmCalc.apr.className='ftbxcalc';

} // end calcFees() ............

//----------------------------------------------------------------------------------------

function hideCalc(){
	changeDiv('calc','none');
}

//----------------------------------------------------------------------------------------

function resetBg(what) {
	what.className='formtextbox';
}

//----------------------------------------------------------------------------------------
function showCalculator(){
	changeDiv('calc','block');
}
//----------------------------------------------------------------------------------------
function hideCalculator(){
	changeDiv('calc','none');
}
//----------------------------------------------------------------------------------------
function showError(){
	changeDiv('error','block');
}
//----------------------------------------------------------------------------------------
function hideError(){
	changeDiv('error','none');
}
//----------------------------------------------------------------------------------------


//----------------------------------------------------------------------------------------
function round(number,X) {
// rounds number to X decimal places, defaults to 2
    X = (!X ? 2 : X);
    return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
}
//----------------------------------------------------------------------------------------

function cent(amount) {
// returns the amount in the .99 format
    amount -= 0;
    return (amount == Math.floor(amount)) ? amount + '.00' : (  (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}
//----------------------------------------------------------------------------------------


//----------------------------------------------------------------------------------------

