var flagtl
var flagtla

function LivingRoom()
{
<!-- Living Room -->
book = parseInt(document.order.bookcase.value * 17);
c = parseInt(document.order.cabinet.value * 13);
ac = parseInt(document.order.armchair.value * 12.5); 
sc = parseInt(document.order.straightchair.value * 7);
ct = parseInt(document.order.coffeetable.value * 10);
dc = parseInt(document.order.diningchair.value * 6);
dt = parseInt(document.order.diningtable.value * 26);
fs = parseInt(document.order.footstool.value * 2);
lampf = parseInt(document.order.floorlamp.value * 3);
lampt = parseInt(document.order.tablelamp.value * 0.3);
shoe = parseInt(document.order.shoecabinet.value * 5);
s2 = parseInt(document.order.sofa2.value * 40);
s3 = parseInt(document.order.sofa3.value * 53);
sL = parseInt(document.order.sofaL.value * 65);
st = parseInt(document.order.stool.value * 3);
storage = parseInt(document.order.storagecombi.value * 70);
tv1 = parseInt(document.order.tv14.value * 2);
tv2 = parseInt(document.order.tv20.value * 8);
tv3 = parseInt(document.order.tv32.value * 12);
tv4 = parseInt(document.order.tv42.value * 10);
LRTotal = book + c + ac + sc + ct + dc + dt + fs + lampf + lampt + shoe + s2 + s3 + sL + st + storage + tv1 + tv2 + tv3 + tv4;

<!-- Bedroom -->
bb = parseInt(document.order.bunkset.value * 109);
beds = parseInt(document.order.singleframe.value * 53);
bedq = parseInt(document.order.queenframe.value * 114);
bedk = parseInt(document.order.kingframe.value * 122);
bedtable = parseInt(document.order.bedside.value * 4);
chest2 = parseInt(document.order.drawer2.value * 4);
chest3 = parseInt(document.order.drawer3.value * 7);
chest6 = parseInt(document.order.drawer6.value * 10.5);
divanset = parseInt(document.order.divan.value * 130);
dressing = parseInt(document.order.dressingtable.value * 6);
sb = parseInt(document.order.mattressS.value * 60);
qb = parseInt(document.order.mattressQ.value * 65);
kb = parseInt(document.order.mattressK.value * 70);
ward2 = parseInt(document.order.wardrobe2.value * 50);
ward3 = parseInt(document.order.wardrobe3.value * 76);
ward4 = parseInt(document.order.wardrobe4.value * 93);
BRTotal = bb + beds + bedq + bedk + bedtable + chest2 + chest3 + chest6 + divanset + dressing + sb + qb + kb + ward2 + ward3 + ward4;

<!-- Boxes -->
archive = parseInt(document.order.archive.value * 1.13);
small = parseInt(document.order.small.value * 1.7);
medium = parseInt(document.order.medium.value * 3.11);
large = parseInt(document.order.large.value * 6.05);
BoxesTotal = archive + small + medium + large;

<!-- Appliances -->
dish = parseInt(document.order.dishwasher.value * 12);
f2 = parseInt(document.order.fridge2.value * 37);
f3 = parseInt(document.order.fridge3.value * 41.5);
fS = parseInt(document.order.fridgeside.value * 48);
fM = parseInt(document.order.fridgemini.value * 4);
iron = parseInt(document.order.ironing.value * 2);
oven = parseInt(document.order.microwave.value * 3);
cooker = parseInt(document.order.rice.value * 12);
vacuumC = parseInt(document.order.vacuum.value * 3);
washing1M = parseInt(document.order.washing1.value * 8); 
washing2M = parseInt(document.order.washing1.value * 18); 
oven1 = parseInt(document.order.conventional.value * 10); 
AppliancesTotal = dish + f2 + f3 + fS + fM + iron + oven + cooker + vacuumC + washing1M + washing2M + oven1;

<!-- Miscellaneous -->
bchild = parseInt(document.order.bicycleC.value * 3);
badult = parseInt(document.order.bicycleA.value * 6);
monitor = parseInt(document.order.computerM.value * 12);
table = parseInt(document.order.computerT.value * 22);
crib1 = parseInt(document.order.crib.value * 45);
keyboard1 = parseInt(document.order.keyboard.value * 1);
floorfan = parseInt(document.order.fanF.value * 2);
standfan = parseInt(document.order.fanS.value * 8);
folding = parseInt(document.order.foldingchair.value * 2);
homeprinter = parseInt(document.order.printer.value *1);
ladder1 = parseInt(document.order.ladder.value * 3);
magazinerack = parseInt(document.order.magazine.value * 2);
piano1 = parseInt(document.order.piano.value * 24);
sewingmachine = parseInt(document.order.sewing.value * 5);
study = parseInt(document.order.studytable.value * 32.5);
swivel1 = parseInt(document.order.swivel.value * 6);
MiscellaneousTotal = bchild + badult + monitor + table + crib1 + keyboard1 + floorfan + standfan + folding + homeprinter + ladder1 + magazinerack + piano1 + sewingmachine + study + swivel1;

C = parseInt(document.order.cft.value); 
document.order.sqft.value=Math.round(C / 6.56);

GrandTotal = LRTotal + BRTotal + BoxesTotal + AppliancesTotal + MiscellaneousTotal + C;
document.order.volume.value = parseInt(GrandTotal);
if (document.order.volume.value==0 )
   {
	MM_popupMsg('Please enter a value before calculating.')
}else if (document.order.volume.value!=0 ) {
GrandSqft = Math.ceil(GrandTotal / 6.56);
NewGrandSqft = Math.ceil(GrandSqft * 1.2);
if (flagtl == 1 ){
document.order.finalsqft.value = NewGrandSqft;
document.order.finalsqft1.value = NewGrandSqft + 5;
} else if (flagtl == 0){
document.order.finalsqft.value = Math.ceil(NewGrandSqft * 1.3);
document.order.finalsqft1.value = Math.ceil(NewGrandSqft * 1.3 + 5);
}
}
}

function btnone(){
document.order.Rloose.checked = false;
 flagtl = 1;	 
}

function btntwo(){
document.order.Rtight.checked = false;
 flagtl = 0;	   
}

function btnonea(){
document.myform.Rloosea.checked = false;
 flagtla = 2;	 
}

function btntwoa(){
document.myform.Rtighta.checked = false;
 flagtla = 3;	   
}
function offButton(){
	   document.myform1.Radio1.checked = false;
	   document.myform1.display.value= "(Cm)";
	   document.myform1.display1.value= "(Cm)";
	   document.myform1.display2.value= "(Cm)";
	   document.myform1.display3.value= "(Cubic Cm)";
	   
}

function onButton(){
		window.document.myform1.Radio2.checked = false;
	   document.myform1.display.value= "(Inches)";
	   document.myform1.display1.value= "(Inches)";
	   document.myform1.display2.value= "(Inches)";
	   document.myform1.display3.value= "(Cubic Inches)";
}
function convert()
{
    qty = document.myform.qty.value;
    lgth = document.myform.length.value;
    wdth = document.myform.width.value;
    hght = document.myform.height.value;
    vol = qty * lgth * wdth * hght;
    document.myform.volume.value = vol;
   	
	 qty = document.myform.qty1.value;
    lgth = document.myform.length1.value;
    wdth = document.myform.width1.value;
    hght = document.myform.height1.value;
    vol = qty * lgth * wdth * hght;
    document.myform.volume1.value = vol;

    qty = document.myform.qty2.value;
    lgth = document.myform.length2.value;
    wdth = document.myform.width2.value;
    hght = document.myform.height2.value;
    vol = qty * lgth * wdth * hght;
    document.myform.volume2.value = vol;

    qty = document.myform.qty3.value;
    lgth = document.myform.length3.value;
    wdth = document.myform.width3.value;
    hght = document.myform.height3.value;
    vol = qty * lgth * wdth * hght;
    document.myform.volume3.value = vol;

	qty = document.myform.qty4.value;
	lgth = document.myform.length4.value;
	wdth = document.myform.width4.value;
	hght = document.myform.height4.value;
	vol = qty * lgth * wdth * hght;
	document.myform.volume4.value = vol;

	qty = document.myform.qty5.value;
	lgth = document.myform.length5.value;
	wdth = document.myform.width5.value;
	hght = document.myform.height5.value;
	vol = qty * lgth * wdth * hght;
	document.myform.volume5.value = vol;
 
	<!-- Addup -->
	v = document.myform.volume.value;
	v1 = document.myform.volume1.value;
	v2 = document.myform.volume2.value;
	v3 = document.myform.volume3.value; 
	v4 = document.myform.volume4.value;
	v5 = document.myform.volume5.value;
	total = parseInt(v) + parseInt(v1) + parseInt(v2) + parseInt(v3) + parseInt(v4) + parseInt(v5);
	document.myform.cubic.value = total;


 if (document.myform1.Radio1.checked)
    {
	total_inch = document.myform.cubic.value;
	result = parseInt(total_inch) * 16.387 / 1000000 * 35.314 / 6.56;
	newresult1 = parseInt(result * 1.2);
	
		if (document.myform.cubic.value==0 )
   {
	MM_popupMsg('Please enter a value before calculating.')
}else if (document.myform.cubic.value!=0 ) {
if (flagtla == 2 ) {
   document.myform.sqft.value = Math.round (newresult1);
   document.myform.sqft1.value = Math.round (newresult1) + 5;
   }else if (flagtla == 3 ){
    document.myform.sqft.value = Math.round (newresult1 *1.2);
   document.myform.sqft1.value = Math.round (newresult1 *1.2 + 5);
   }
   }
}
 else if (document.myform1.Radio2.checked) 
 {  
	total_cm = document.myform.cubic.value;
	result = parseInt(total_cm) / 1000000 * 35.314 / 6.56;
	newresult = parseInt(result * 1.2);	 
	if (document.myform.cubic.value==0 )
   {
	MM_popupMsg('Please enter a value before calculating.')
}else if (document.myform.cubic.value!=0 ) {
if (flagtla == 2 ) {
   document.myform.sqft.value = Math.round (newresult);
   document.myform.sqft1.value = Math.round (newresult) + 5;
   }else if (flagtla == 3 ){
    document.myform.sqft.value = Math.round (newresult *1.3);
    document.myform.sqft1.value = Math.round (newresult *1.3 + 5);
   }
	}
 }
}
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
