function calculate() {

	var price = $("#price").attr("value");			// retail price
	var quantity = $("#quantity").attr("value");


	$("#cc_price").attr("value", price);
	$("#cc_quantity").attr("value", quantity);

	/* Zong */

	var zongPeoplePaid = ($("#conRate").attr("value")/100) *  quantity;
	
	var zongGross = zongPeoplePaid * price;

	var vfee = .45;		// 45% per transaction
	
	var zongTotalFee = .45 * zongGross
	var zongPay = zongGross - zongTotalFee

	// set result
	$("#peoplePaid").attr ("value", roundNumber(zongPeoplePaid,2)) ;
	$("#gross").attr ("value", roundNumber(zongGross,2)) ;
	$("#vfee").attr ("value", roundNumber( zongTotalFee ,2) ) ;

	$("#tfee").attr ("value", roundNumber(zongTotalFee,2)) ;
	$("#pay").attr("value", roundNumber(zongPay, 2))

	/* CC */

	var ccPeoplePaid = ($("#cc_conRate").attr("value")/100) *  quantity;
	
	var ccGross = ccPeoplePaid * price;

	var cc_vfee = .03 * ccGross;  	// variable 3% per trans x gross
	var cc_ffee =.3 * ccPeoplePaid;	// fixed per trans x people paid
	

	var ccTotalFee = cc_ffee + cc_vfee 
	
	var creditCardPay = ccGross - ccTotalFee

	// set result
	$("#cc_peoplePaid").attr ("value", roundNumber(ccPeoplePaid,2)) ;	// set result
	$("#cc_gross").attr ("value", roundNumber(ccGross,2)) ;
	$("#cc_vfee").attr ("value", roundNumber(cc_vfee ,2) ) ;
	$("#cc_ffee").attr ("value", roundNumber(cc_ffee ,2) ) ;

	$("#cc_tfee").attr ("value", roundNumber(ccTotalFee,2)) ;
	$("#cc_pay").attr("value", roundNumber(creditCardPay, 2))

}

function roundNumber(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}