function calcCOIN(did, property, loss, deduct, cutoff, target, target2) {
	// turn percentage into decimal
	if (cutoff >= 1) { cutoff = cutoff/100; }
	
	var should = property * cutoff;
	var payout = ((did - should) < 0) ? ((did / should) * loss) - deduct : loss - deduct;
	if (payout > did) { payout = did; }
	
	var message;
	if ((did - should) < 0) {
		message = "Coinsurance requirement was not met.";
	} else {
		message = "Coinsurance requirement met.";
	}
	
	setDivText(target, message);
	
	var curPayout = new Number(payout).toFixed(2);
	var prcPayout = new Number((curPayout / (loss - deduct)) * 100).toFixed(2);
	setDivText(target2, "Amount Payable:  $" + curPayout + " (" + prcPayout + "%)");
}
function setDivText(target, text) {
	if (target.hasChildNodes()) { 
		target.replaceChild(document.createTextNode(text), target.firstChild);
	 } else { 
		target.appendChild(document.createTextNode(text));
	}
}
function verify(that) {
	for (var i=0; i < that.elements.length; i++) {
		if (that.elements[i].value == "") {
			alert("Please supply values for all fields.");
			that.elements[i].focus();
			return false;
		}
	}
	return true;
}
