var co=new Object;
var resi1=new Array(968, 1198, 1500);
var resi2=new Array(2037,3133,4868);
var resi3=new Array(1210,1406,2017);
var resi4=new Array(1366,1643,2133);
var resi5=new Array(1556,1959,2940);

var comm1=new Array(1250,1450,2160);
var comm2=new Array(1247,1465,2224);
var comm3=new Array(1501,1824,2300);
var comm4=new Array(1793,2064,2689);

var ind1=new Array(751,813,938);
var ind2=new Array(735,792,891);
var ind3=new Array(823,912,1022);
var ind4=new Array(820,886,990);

var ret1=new Array(1276,1567,1847);
var ret2=new Array(1012,1258,1400);
var ret3=new Array(1199,1303,1407);
var ret4=new Array(985,1105,1350);

var hm1=new Array(1767,2216,2896);
var hm2=new Array(1548,1944,2121);
var hm3=new Array(1482,1902,2554);
var hm4=new Array(2293,2966,3388);

function recalc_onclick() {
    co.type=document.getElementById('formc').type.value /* Building Type */
    co.location=document.getElementById('formc').location.value; /* Lcoation */
if (document.getElementById('formc').location.value == 1){		//Cairns
	co.location=1.23}
else if (document.getElementById('formc').location.value == 2){	//Brisbane
	co.location=1.10}
else if (document.getElementById('formc').location.value == 3){	//Sydney
	co.location=1}
else if (document.getElementById('formc').location.value == 4){	//Canberra
	co.location=1}
else if (document.getElementById('formc').location.value == 5){	//Melbourne
	co.location=1.03}
else if (document.getElementById('formc').location.value == 6){	//Adelaide
	co.location=1.04}
else if (document.getElementById('formc').location.value == 7){	//Perth
	co.location=1.10}
else if (document.getElementById('formc').location.value == 8){	//Hobart
	co.location=0.92}
    co.finish=document.getElementById('formc').finish.value; /* Finish Quality */
    co.sqm=eeparseFloatTh(document.getElementById('formc').sqm.value); /* Square Meters */
    calc(co, document.getElementById('formc'));
};

var eeisus=1;
var eetrue="TRUE";
var eefalse="FALSE";
var eedec=".";
var eeth=",";
var eedecreg=new RegExp("[.]","g");
var eethreg=new RegExp(",","g");

function calc(data){
	data.type;
	data.location;
	data.finish; 
	data.sqm;

	if(data.type=="resi1"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi1[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi1[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi1[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi1[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi1[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi1[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="resi2"){
		if(data.finish=="low"){
		document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi2[0], data.sqm, "min")*data.location),2);
		document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi2[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi2[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi2[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi2[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi2[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="resi3"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi3[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi3[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi3[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi3[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi3[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi3[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="resi4"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi4[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi4[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi4[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi4[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi4[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi4[2], data.sqm, "max")*data.location),2);
		}
	}
		if(data.type=="resi5"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi5[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi5[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi5[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi5[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(resi5[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(resi5[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="comm1"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm1[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm1[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm1[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm1[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm1[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm1[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="comm2"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm2[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm2[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm2[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm2[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm2[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm2[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="comm3"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm3[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm3[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm3[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm3[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm3[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm3[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="comm4"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm4[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm4[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm4[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm4[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(comm4[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(comm4[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="ind1"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind1[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind1[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind1[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind1[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind1[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind1[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="ind2"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind2[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind2[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind2[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind2[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind2[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind2[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="ind3"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind3[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind3[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind3[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind3[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind3[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind3[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="ind4"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind4[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind4[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind4[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind4[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ind4[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ind4[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="ret1"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret1[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret1[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret1[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret1[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret1[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret1[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="ret2"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret2[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret2[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret2[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret2[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret2[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret2[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="ret3"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret3[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret3[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret3[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret3[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret3[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret3[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="ret4"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret4[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret4[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret4[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret4[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(ret4[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(ret4[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="hm1"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm1[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm1[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm1[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm1[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm1[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm1[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="hm2"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm2[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm2[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm2[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm2[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm2[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm2[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="hm3"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm3[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm3[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm3[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm3[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm3[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm3[2], data.sqm, "max")*data.location),2);
		}
	}
	if(data.type=="hm4"){
		if(data.finish=="low"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm4[0], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm4[0], data.sqm, "max")*data.location),2);
		}else if(data.finish=="med"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm4[1], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm4[1], data.sqm, "max")*data.location),2);
		}else if(data.finish=="high"){
			document.getElementById('formc').minimum.value = "$"+eedisplayFloatNDTh((result(hm4[2], data.sqm, "min")*data.location),2);
			document.getElementById('formc').maximum.value = "$"+eedisplayFloatNDTh((result(hm4[2], data.sqm, "max")*data.location),2);
		}
	}
};

function result(t,sqm,n){
	var sum =0;
	if(n=="min"){
		sum = ((t * sqm) * 0.95);
		return sum;
	}
	else if(n=="max"){
		sum = ((t * sqm) * 1.05);
		return sum;
	}
}

function myIsNaN(x){
  return(isNaN(x)||(typeof x=='number'&&!isFinite(x)));
};

function round(n,nd){
  if(isFinite(n)&&isFinite(nd)){
    var sign_n=(n<0)?-1:1;
    var abs_n=Math.abs(n);
    var factor=Math.pow(10,nd);
    return sign_n*Math.round(abs_n*factor)/factor;
  }else{
    return NaN;
  }
};

function sum2(arr,rt,rb){
  var sum=0;
  for(var ii=rt;ii<=rb;ii++){
    sum+=arr[ii]
  };
  return sum
};

function sum3(arr,rt,ct,rb,cb){
  var sum=0;for(var ii=rt;ii<=rb;ii++){
    for(var jj=ct;jj<=cb;jj++){
      sum+=arr[ii][jj]
    }
  };
  return sum
};

function sumgeneral(cnt,vsum,vcnt,x){
  var sum=vsum;for(var ii=0;ii<x.length;ii++){
    sum+=sum3(x[ii][0],x[ii][1],x[ii][2],x[ii][3],x[ii][4]);
  };
  return sum;
};

function eeparseFloat(str){
  str=String(str).replace(eedecreg,".");
  var res=parseFloat(str);
  if(isNaN(res)){
  	return 0;
  }else{
  	return res;
  }
};

function eeparsePercent(str){
  var parts=String(str).split('%');
  var tmp=String(parts[0]).replace(eedecreg,".");
  var res=parseFloat(tmp)/100;
  if(isNaN(res)){
    return 0;
  }else{
    return res;
  }
};

function eedisplayFloatND(x,nd){
  if(myIsNaN(x)){
    return Number.NaN;
  }else{
    var res=round(x,nd);
    if(nd>0){
      var str=String(res);
      if(str.indexOf('e')!=-1)return str;
      if(str.indexOf('E')!=-1)return str;var parts=str.split('.');
      if(parts.length<2){
        var decimals=('00000000000000').substring(0,nd);
        return(parts[0]).toString()+eedec+decimals;
      }else{
        var decimals=((parts[1]).toString()+'00000000000000').substring(0,nd);
        return(parts[0]).toString()+eedec+decimals;
      }
    }else{
      return res;
    }
  }
};

function eedisplayPercentND(x,nd){
  if(myIsNaN(x)){
    return Number.NaN;
  }else{
    return eedisplayFloatND(x*100,nd)+'%';
  }
}

function eeparseFloatTh(str){
  str=String(str).replace(eethreg,"");
  str=String(str).replace(eedecreg,".");
  var res=parseFloat(str);
  if(isNaN(res)){
    return 0;
  }else{
    return res;
  }
};

function eedisplayFloatNDTh(x,nd){
  if(myIsNaN(x)){
    return Number.NaN;
  }else{
    var res=round(x,nd);
    if(nd>0){
      var str=String(res);
      if(str.indexOf('e')!=-1)
        return str;
      if(str.indexOf('E')!=-1)
        return str;
			var parts=str.split('.');
      var res2=eeinsertThousand(parts[0].toString());
      if(parts.length<2){
        var decimals=('00000000000000').substring(0,nd);
				//alert(decimals);
        return(res2);
      }else{
        var decimals=((parts[1]).toString()+'00000000000000').substring(0,nd);
        return res2;
      }
    }else{
      return(eeinsertThousand(res.toString()));
    }
  }
};
  
function eeinsertThousand(whole){
  if(whole==""||whole.indexOf("e")>=0){
    return whole;
  }
  else{
    var minus_sign="";
    if(whole.charAt(0)=="-"){
      minus_sign="-";whole=whole.substring(1);};
      var res="";
      var str_length=whole.length-1;
      for(var ii=0;ii<=str_length;ii++){
      if(ii>0&&ii%3==0){res=eeth+res;};
      res=whole.charAt(str_length-ii)+res;
    };
    return minus_sign+res;
  }
};

function updateDisplay(){

};