        function calculate()
	{
		var txtMoving=document.getElementById('txtMoving');
		var txtTotalMovingHours=document.getElementById('txtTotalMovingHours');
		var txtTotalMovingCost=document.getElementById('txtTotalMovingCost');
		var txtTotalUSACost=document.getElementById('txtTotalUSACost');
		var txtTotalSafe=document.getElementById('txtTotalSafe');
		var divTotalSave=document.getElementById('divTotalSave');		
		iMoving=txtMoving.value;
		iTotalUSACost=txtTotalUSACost.value;
		var hrsPerEmp=2080;
		var directRate=3;
		if(isNaN(iMoving)) iMoving=0;
		if(isNaN(iTotalUSACost)) iTotalUSACost=0;
		
		txtTotalMovingHours.value=hrsPerEmp*iMoving;
		txtTotalMovingCost.value=formatCurrency((hrsPerEmp*iMoving*directRate))//(hrsPerEmp*iMoving*directRate).toFixed(2);
		if(iTotalUSACost>0){
			txtTotalSafe.value=formatCurrency((iTotalUSACost-(hrsPerEmp*iMoving*directRate)))//(iTotalUSACost-txtTotalMovingCost.value).toFixed(2);			
		}
	}
	
	function formatCurrency(num) {
        num = num.toString().replace(/\$|\,/g,'');
        if(isNaN(num))
        num = "0";
        sign = (num == (num = Math.abs(num)));
        num = Math.floor(num*100+0.50000000001);
        cents = num%100;
        num = Math.floor(num/100).toString();
        if(cents<10)
        cents = "0" + cents;
        for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
        num = num.substring(0,num.length-(4*i+3))+','+
        num.substring(num.length-(4*i+3));
		if(cents>50)
			num=parseInt(num)+1
        return (((sign)?'':'-') + '$' + num);
    }

