function initialise(){
   document.calculator.loungeTotal.value=0;
   document.calculator.diningroom2Total.value=0;
   document.calculator.familyroom3Total.value=0;
   document.calculator.kitchenroom4Total.value=0;
   document.calculator.laundryroom5Total.value=0;
   document.calculator.hallroom6Total.value=0;
   document.calculator.masterbedroom7Total.value=0;
   document.calculator.secondbedroom8Total.value=0;
   document.calculator.thirdbedroom9Total.value=0;
   document.calculator.forthbedroom10Total.value=0;
   document.calculator.sundries11Total.value=0;
   document.calculator.outside12Total.value=0;
   document.calculator.oursize13Total.value=0;
   document.calculator.bigTotal.value=0; 

for (xx = 0; xx < document.calculator.elements.length; xx++) 
		{
		if (document.calculator.elements[xx].type == 'text') 
			{ 
			document.calculator.elements[xx].value = 0;
   			}
		}

}

function calculate(unit, element, totalBox, priorval)
{
   var roomTotalBox = document.getElementById(totalBox);

   var unitValue = parseFloat(unit);

   var elementValue = eval("document.calculator." + element + ".value");
   var prValue = eval("document.calculator." + element + ".priorval");


   var number = parseFloat(elementValue);
   var numberpr = parseFloat(prValue);

   var subTotalValue = roomTotalBox.value;
   var roomSubTotal = parseFloat(subTotalValue);
   var bigSubTotal = parseFloat(document.calculator.bigTotal.value);

	if(number>numberpr)
	{
	var n = 0;
	roomTotalBox.value = eval(roomTotalBox.value) - formatsize(numberpr*unitValue + roomSubTotal);
	document.calculator.bigTotal.value = eval(document.calculator.bigTotal.value) - formatsize(numberpr*unitValue + bigSubTotal);
	n = number - numberpr;
	numberpr = number;
	document.getElementById(element).priorval = numberpr;
	roomTotalBox.value = formatsize(n*unitValue + roomSubTotal);
	document.calculator.bigTotal.value = formatsize(n*unitValue + bigSubTotal);


	}
	if(number<numberpr)
	{
	var n = 0;
	roomTotalBox.value = eval(roomTotalBox.value) - formatsize(numberpr*unitValue + roomSubTotal);
	document.calculator.bigTotal.value = eval(document.calculator.bigTotal.value) - formatsize(numberpr*unitValue + bigSubTotal);
	n = number - numberpr;
	numberpr = number;
	document.getElementById(element).priorval = numberpr;

	roomTotalBox.value = formatsize(n*unitValue + roomSubTotal);
	document.calculator.bigTotal.value = formatsize(n*unitValue + bigSubTotal);
	}

	m = document.calculator.bigTotal.value;


	if(m>0 && m<24.3)
	{
	document.calculator.oursize13Total.value = "3 x 3 x 2.7 = 24.3";
	}
	if(m>24.4 && m<32.4)
	{
	document.calculator.oursize13Total.value = "4 x 3 x 2.7 = 32.4";
	}
	if(m>32.5 && m<36.45)
	{
	document.calculator.oursize13Total.value = "4.5 x 3 x 2.7 = 36.45";
	}
	if(m>36.55 && m<48.6)
	{
	document.calculator.oursize13Total.value = "6 x 3 x 2.7 = 48.6";
	}
	if(m>48.7 && m<56.7)
	{
	document.calculator.oursize13Total.value = "7 x 3 x 2.7 = 56.7";
	}
	if(m>56.8 && m<64.8)
	{
	document.calculator.oursize13Total.value = "6 x 4 x 2.7 = 64.8";
	}
	if(m> 64.9 && m<72.9)
	{
	document.calculator.oursize13Total.value = "9 x 3 x 2.7 = 72.9";
	}
	if(m> 73 && m<97.2)
	{
	document.calculator.oursize13Total.value = "6 x 6 x 2.7 = 97.2";
	}
	if(m>97.2)
	{
	document.calculator.oursize13Total.value = "Please contact us";
	}

}

function formatsize(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num)) num = "0";
cents = Math.floor((num * 100 + 0.5) % 100);
num = Math.floor((num * 100 + 0.5) / 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));
return (num + "." + cents);
}
   
function a_times_b(form) {

a=eval(form.a.value)
if(a==1)
{
form.week.value="$32.00 / Week ($140.00 / Month)";
}
if(a==2)
{
form.week.value="$35.00 / Week ($150 / Month)";
}
if(a==3)
{
form.week.value="$38.00 / Week ($165 / Month)";
}
if(a==4)
{
form.week.value="$37.00 / Week ($160 / Month)";
}
if(a==5)
{
form.week.value="$39.00 / Week ($170 / Month)";
}
if(a==6)
{
form.week.value="$44.00 / Week ($190 / Month)";
}
if(a==7)
{
form.week.value="$42.00 / Week ($180 / Month)";
}
if(a==8)
{
form.week.value="$47.00 / Week ($205 / Month)";
}
if(a==9)
{
form.week.value="$53.00 / Week ($230 / Month)";
}
if(a==10)
{
form.week.value="$62.00 / Week ($270 / Month)";
}
if(a==11)
{
form.week.value="$72.00 / Week ($310 / Month)";
}
if(a==12)
{
form.week.value="$81.00 / Week ($350 / Month)";
}
if(a==13)
{
form.week.value="$58.00 / Week ($250 / Month)";
}
if(a==14)
{
form.week.value="$63.00 / Week ($275 / Month)";
}
if(a==15)
{
form.week.value="$68.00 / Week ($295 / Month)";
}
if(a==16)
{
form.week.value="$83.00 / Week ($360 / Month)";
}
if(a==17)
{
form.week.value="$74.00 / Week ($320 / Month)";
}
if(a==18)
{
form.week.value="$96.00 / Week ($415 / Month)";
}
if(a==19)
{
form.week.value="$15.00 / Week ($65 / Month)";
}
if(a==20)
{
form.week.value="$14.00 / Week ($60.00 / Month)";
}
}
 