// calc.js
// written 12/27/2004
// copyright 2004 by Logicomm, Inc., all rights reserved
// last modified 12/27/2004 by jvan
// 3/28/2006 - added revenue fields - JVan
// 6/4/2006 - added techensure calculations - Jvan/Emiller
function setVals(){
	var salary1, salary2, salaryTot, bens, ohd;
	var mthly_ohd, hrly_cost;
	var hrly_loss, dtime, mthly_cost;
	salary1 = document.calculator.salary1.value;
	salary1=getCurrency(salary1);
	salary2 = document.calculator.salary2.value;
	salary2 = getCurrency(salary2);
	salaryTot = salary1 + salary2;
	bens = salaryTot *.28;
	bens=getCurrency(bens);
	document.calculator.bens.value = '$' +(bens);
	ohd = parseFloat(salary) + parseFloat(bens) + parseFloat(salary2);
	ohd = getCurrency(ohd);
	document.calculator.ohd.value = '$' +ohd;
	mthly_ohd = ohd/12;
	mthly_ohd = getCurrency(mthly_ohd);
	document.calculator.mthly_ohd.value='$'+mthly_ohd;
	cost_hr = parseFloat(mthly_ohd)/130;
	cost_hr=getCurrency(cost_hr);
	hrly_loss = parseFloat(cost_hr);
	hrly_loss=getCurrency(cost_hr);
	dtime = parseFloat(document.calculator.dtime.value);
	mthly_cost = hrly_loss*dtime;
	mthly_cost=getCurrency(mthly_cost);
	document.calculator.mthly_cost.value = '$'+mthly_cost;
	var system1, system2;
	var sys1tot, sys2tot, systotl;
	var tot_te, te_sav;
	system1 = document.calculator.tot_PCs.value;
	//system2 = document.calculator.tot_svrs.value;
	sys1tot = parseFloat(system1)*29.95;
	sys1tot = getCurrency(sys1tot);
	//sys2tot = parseFloat(system2)*159.95;
	//sys2tot = getCurrency(sys2tot);
	systot = sys1tot+sys2tot;
	systot1 = sys1tot/system1;
	tot_te = systot1;
	tot_te = getCurrency(tot_te);
	document.calculator.tot_te.value = '$' +tot_te;
	te_sav = mthly_cost-tot_te;
	te_sav=getCurrency(te_sav);
	document.calculator.te_sav.value = '$' +te_sav;
}
function getCurrency(str){
	retval= (Math.round(parseFloat(str)*100)/100); 
	retval -= 0;
    return (retval == Math.floor(retval)) ? retval + '.00' : (  (retval*10 == Math.floor(retval*10)) ? retval + '0' : retval);
}
