function calculate()
{
    var ajaxObj = new Ajax.Request('/Tools/Calculators/Property_Stamp_Duty_Calculator',
            {method: 'post',
             parameters : 'value='+ encodeURIComponent($('value').value) +'&new='+ ($('new_0').checked ? 0 : 1) +'&first='+ ($('first_0').checked ? 0 : 1) +'&area='+ ($('area_0').checked ? 0 : 1) +'&site='+ encodeURIComponent($('site').value) +'&rent='+ encodeURIComponent($('rent').value) +'&term='+ encodeURIComponent($('term').value),
             onComplete: function(originalRequest)
            {
            	if (originalRequest.responseJSON && typeof originalRequest.responseJSON == 'object') {
            		$('txtTaxable').value = originalRequest.responseJSON.taxable;
            		$('txtRate').value = originalRequest.responseJSON.rate;
            		$('txtStamp').value = originalRequest.responseJSON.stamp;
            		
            		$('txtPercentage').value = originalRequest.responseJSON.percent;
            		$('txtDutyLease').value = originalRequest.responseJSON.duty;
            	}
            }
    });

    ajaxObj = null;
    return false;
}

function calculatorReset() {
	['txtDutyLease', 'txtPercentage', 'txtStamp', 'txtRate', 'txtTaxable'].each(function (field) {
		$(field).value = '';
	});

	return false;
}
