var trow= new Array()
var qty
var spcrows=14
function Areas(rform,row){

qty=eval("rform.r"+row+"c3.value")

	for(ncol=1; ncol<3; ncol++) {
		x=eval("rform.r"+row+"c"+ncol)
		if  (x.value>0){		
			trow[ncol]=x.value}
		else{
			trow[ncol]=" "				
		}
	}			
	x=eval("rform.r"+row+"c4")
	x.value=format(trow[1]*trow[2]*qty)

	//x.value=format(x.value)	

	if ((x.value==0) ||(x.value=="")) {
		x.value=" "
	}
// then sum up the totcol  array after the row is recalculated
	tsf=0
	for(nrow=1; nrow<=spcrows; nrow++) {
		x=eval("rform.r"+nrow+"c4")
			xstr=x.value
			//xstrno=xstrno.replace(",","")
			//tsf=(tsf*1+noformat*1)
			tsf=(tsf*1+noformat(xstr)*1)
		}
	rform.subtot.value=format(tsf)
	rform.circ_sf.value=format(tsf*rform.circpct.value/100)
	rform.useabletot.value=format(1*(tsf)+(1*noformat(rform.circ_sf.value)))
	rform.loss_sf.value=format(noformat(rform.useabletot.value)*rform.losspct.value/100)
	rform.renttot.value=format(1*noformat(rform.useabletot.value)+noformat(rform.loss_sf.value)*1)
	return true
}
 function format(num){
   if(isNaN(num))
     num = 0;
   var dol = Math.floor(num).toString();
   var cents = Math.floor((num*100+.5)%100).toString();
   for (var i = 0; i < Math.floor((dol.length-1)/3)-i; i++)
     dol = dol.slice(0,-(4*i+3))+','+dol.slice(-(4*i+3));
   while (cents.length<2)
    cents += "0";
	if (cents>0){
   		return dol+"."+cents}
	else{
	return dol}
 }
 function noformat(xstr){
 	xstrno=xstr.replace(",","")
	return xstrno
 }
 //var y=format(27777890)
 //var z=y.replace(",","")
  //alert(format(27777)) 
    //alert(y)
	//alert(z)