function calculateValues(form){

	calcRealPropertySold(form);

	calcRealPropertyNotSold(form);

	calcRealEstateSold(form);

	calcJointAndSurvivorProperty(form);

	calcPersonalProperty(form);

	calcTotal(form);

	return false;

}

function toCurrency(num) {

     	var newNum;

	newNum = Math.round(num * 100) / 100;

	if(parseFloat(newNum)!=parseInt(newNum)){

		if(parseFloat(newNum*10)==parseInt(newNum*10))

			newNum+="0";

		}

		else{

			newNum+=".00";

		}

	return '$' + newNum;

}

function calcRealPropertySold(form){

	var value2;

	var RealProperty;

	RealProperty = form.txtRealProperty.value.replace(/[,\$]/g,"");

	if (RealProperty<50001){

		value2 = RealProperty * .055;

	}

	else if (RealProperty<100001){

		value2 = ((RealProperty - 50000) * .045) + 2750;

	}

	else if (RealProperty<400001){

		value2 = ((RealProperty - 100000) * .035) + 5000;

	}

	else {

		value2 = ((RealProperty - 400000) * .02) + 15500;

	}

	form.txtRealPropertyFee.value = toCurrency(value2);

	return;

}

function calcRealPropertyNotSold(form){

	var NotSold;

	NotSold = form.txtNotSold.value.replace(/[,\$]/g,"");



	form.txtNotSoldFee.value = toCurrency(NotSold * .02);

	return;

}

function calcRealEstateSold(form){

	var RESold;

	RESold = form.txtRESold.value.replace(/[,\$]/g,"");



	if (eval(RESold)<10000){

		form.txtRESoldFee.value = toCurrency(RESold * .06);

	}

	else

	{

		form.txtRESoldFee.value = toCurrency(((RESold - 10000) * .02) + 600);

	}

}

function calcJointAndSurvivorProperty(form){

	var JASP;

	JASP = form.txtJointAndSurvivorProperty.value.replace(/[,\$]/g,"");



	form.txtJointAndSurvivorPropertyFee.value = toCurrency(JASP * .005);

}

function calcPersonalProperty(form){

	var PP;

	PP = form.txtPersonalProperty.value.replace(/[,\$]/g,"");



	form.txtPersonalPropertyFee.value = toCurrency(PP * .01);

}

function calcTotal(form){

	form.txtTotalFee.value = toCurrency(eval(form.txtRealPropertyFee.value.slice(1)) + eval(form.txtNotSoldFee.value.slice(1)) + eval(form.txtRESoldFee.value.slice(1)) + eval(form.txtJointAndSurvivorPropertyFee.value.slice(1)) + eval(form.txtPersonalPropertyFee.value.slice(1)));

}
