function calculate()
{
    var ajaxObj = new Ajax.Request('/Tools/Calculators/Break_Even_Calculator',
            {method: 'post',
             parameters : 'sales='+ encodeURIComponent($('sales').value) +'&cost='+ encodeURIComponent($('cost').value) +'&fixed='+ encodeURIComponent($('fixed').value) +'&projfixed='+ encodeURIComponent($('projfixed').value),
             onComplete: function(originalRequest)
            {
            	if (originalRequest.responseJSON && typeof originalRequest.responseJSON == 'object') {
            		$('txtProfit').value = originalRequest.responseJSON.profit;
            		$('txtPoint').value = originalRequest.responseJSON.point;
            	}
            }
    });

    ajaxObj = null;
    return false;
}

function calculatorReset() {
	['txtProfit', 'txtPoint'].each(function (field) {
		$(field).value = '';
	});
	
	$('sales').value = '100000.00';
	$('cost').value = '75000.00';
	$('fixed').value = '20000.00';
	$('projfixed').value = '25000.00';

	
	return false;
}
