var objects = new Array(	['Bedroom 1', 'bedroom1', 
								[
									['Single Bed', 'sbed', 40],
									['Double Bed', 'dbed', 58],
									['King Size Bed', 'ksbed', 84],
									['Bedside Cabinet', 'bedcab', 10],
									['Chair', 'chair', 10],
									['3D Chest of Drawers', '3dchest', 15],
									['4D Chest of Drawers', '4dchest', 18],
									['5D Chest of Drawers', '5dchest', 21],
									['6D Chest of Drawers', '6dchest', 30],
									['Lg. Dressing Table', 'lgdress', 20],
									['Sm. Dressing Table', 'smdress', 12],
									['Headboard', 'hboard', 2],
									['Linen Basket', 'lbasket', 8],
									['Ottoman', 'ottoman', 12],
									['Table Lamp', 'tlamp', 2],
									['Tall Boy', 'tboy', 21],
									['Trouser Press', 'tpress', 6],
									['Large TV', 'tvlarge', 10],
									['Small TV', 'tvsmall', 5],
									['VCR', 'vcr', 2],
									['Dismantled Wardrobe', 'dismwrobe', 25],
									['1D Wardrobe', '1dwrobe', 36],
									['2D Wardrobe', '2dwrobe', 48],
									['3D Wardrobe', '3dwrobe', 60],
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2],
									['Bag/Sack', 'sack', 6],
									['Wardrobe Carton', 'wrobecarton', 9]
								]
							],
							['Bedroom 2', 'bedroom2', 
								[
									['Single Bed', 'sbed', 40],
									['Double Bed', 'dbed', 58],
									['King Size Bed', 'ksbed', 84],
									['Bedside Cabinet', 'bedcab', 10],
									['Chair', 'chair', 10],
									['3D Chest of Drawers', '3dchest', 15],
									['4D Chest of Drawers', '4dchest', 18],
									['5D Chest of Drawers', '5dchest', 21],
									['6D Chest of Drawers', '6dchest', 30],
									['Lg. Dressing Table', 'lgdress', 20],
									['Sm. Dressing Table', 'smdress', 12],
									['Headboard', 'hboard', 2],
									['Linen Basket', 'lbasket', 8],
									['Ottoman', 'ottoman', 12],
									['Table Lamp', 'tlamp', 2],
									['Tall Boy', 'tboy', 21],
									['Trouser Press', 'tpress', 6],
									['Large TV', 'tvlarge', 10],
									['Small TV', 'tvsmall', 5],
									['VCR', 'vcr', 2],
									['Dismantled Wardrobe', 'dismwrobe', 25],
									['1D Wardrobe', '1dwrobe', 36],
									['2D Wardrobe', '2dwrobe', 48],
									['3D Wardrobe', '3dwrobe', 60],
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2],
									['Bag/Sack', 'sack', 6],
									['Wardrobe Carton', 'wrobecarton', 9]
								]
							],
							['Bedroom 3', 'bedroom3', 
								[
									['Single Bed', 'sbed', 40],
									['Double Bed', 'dbed', 58],
									['King Size Bed', 'ksbed', 84],
									['Bedside Cabinet', 'bedcab', 10],
									['Chair', 'chair', 10],
									['3D Chest of Drawers', '3dchest', 15],
									['4D Chest of Drawers', '4dchest', 18],
									['5D Chest of Drawers', '5dchest', 21],
									['6D Chest of Drawers', '6dchest', 30],
									['Lg. Dressing Table', 'lgdress', 20],
									['Sm. Dressing Table', 'smdress', 12],
									['Headboard', 'hboard', 2],
									['Linen Basket', 'lbasket', 8],
									['Ottoman', 'ottoman', 12],
									['Table Lamp', 'tlamp', 2],
									['Tall Boy', 'tboy', 21],
									['Trouser Press', 'tpress', 6],
									['Large TV', 'tvlarge', 10],
									['Small TV', 'tvsmall', 5],
									['VCR', 'vcr', 2],
									['Dismantled Wardrobe', 'dismwrobe', 25],
									['1D Wardrobe', '1dwrobe', 36],
									['2D Wardrobe', '2dwrobe', 48],
									['3D Wardrobe', '3dwrobe', 60],
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2],
									['Bag/Sack', 'sack', 6],
									['Wardrobe Carton', 'wrobecarton', 9]
								]
							],
							['Bedroom 4', 'bedroom4', 
								[
									['Single Bed', 'sbed', 40],
									['Double Bed', 'dbed', 58],
									['King Size Bed', 'ksbed', 84],
									['Bedside Cabinet', 'bedcab', 10],
									['Chair', 'chair', 10],
									['3D Chest of Drawers', '3dchest', 15],
									['4D Chest of Drawers', '4dchest', 18],
									['5D Chest of Drawers', '5dchest', 21],
									['6D Chest of Drawers', '6dchest', 30],
									['Lg. Dressing Table', 'lgdress', 20],
									['Sm. Dressing Table', 'smdress', 12],
									['Headboard', 'hboard', 2],
									['Linen Basket', 'lbasket', 8],
									['Ottoman', 'ottoman', 12],
									['Table Lamp', 'tlamp', 2],
									['Tall Boy', 'tboy', 21],
									['Trouser Press', 'tpress', 6],
									['Large TV', 'tvlarge', 10],
									['Small TV', 'tvsmall', 5],
									['VCR', 'vcr', 2],
									['Dismantled Wardrobe', 'dismwrobe', 25],
									['1D Wardrobe', '1dwrobe', 36],
									['2D Wardrobe', '2dwrobe', 48],
									['3D Wardrobe', '3dwrobe', 60],
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2],
									['Bag/Sack', 'sack', 6],
									['Wardrobe Carton', 'wrobecarton', 9]
								]
							],
							['Bedroom 5', 'bedroom5', 
								[
									['Single Bed', 'sbed', 40],
									['Double Bed', 'dbed', 58],
									['King Size Bed', 'ksbed', 84],
									['Bedside Cabinet', 'bedcab', 10],
									['Chair', 'chair', 10],
									['3D Chest of Drawers', '3dchest', 15],
									['4D Chest of Drawers', '4dchest', 18],
									['5D Chest of Drawers', '5dchest', 21],
									['6D Chest of Drawers', '6dchest', 30],
									['Lg. Dressing Table', 'lgdress', 20],
									['Sm. Dressing Table', 'smdress', 12],
									['Headboard', 'hboard', 2],
									['Linen Basket', 'lbasket', 8],
									['Ottoman', 'ottoman', 12],
									['Table Lamp', 'tlamp', 2],
									['Tall Boy', 'tboy', 21],
									['Trouser Press', 'tpress', 6],
									['Large TV', 'tvlarge', 10],
									['Small TV', 'tvsmall', 5],
									['VCR', 'vcr', 2],
									['Dismantled Wardrobe', 'dismwrobe', 25],
									['1D Wardrobe', '1dwrobe', 36],
									['2D Wardrobe', '2dwrobe', 48],
									['3D Wardrobe', '3dwrobe', 60],
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2],
									['Bag/Sack', 'sack', 6],
									['Wardrobe Carton', 'wrobecarton', 9]
								]
							],
							['Lounge', 'lounge',
								[
									['4\' Bookcase', 'bookcase', 12],
									['Corner Unit', 'cornerunit', 20],
									['Small Hi Fi', 'hifi', 6],
									['Occasional Chair', 'occchair', 12],
									['Occasional Table', 'occtable', 15],
									['Grande Piano', 'gpiano', 100],
									['Upright Piano', 'upiano', 80],
									['Picture/Mirror', 'picture', 5],
									['Pouffee/Stool', 'stool', 8],
									['Pot/Plant', 'plant', 4],
									['Rug', 'rug', 10],
									['Easy Chair', 'easychair', 16],
									['2 Seater Sofa', '2ssofa', 32],
									['3 Seater Sofa', '3ssofa', 41],
									['4 Seater Sofa', '4ssofa', 50],
									['Lamp', 'lamp', 4],
									['Toy Box', 'toybox', 6],
									['TV/VCR/Hi Fi Cabinet', 'vcrcabinet', 15],
									['Small TV', 'tvsmall', 5],
									['Large TV', 'tvlarge', 10],
									['VCR/DVD Player etc', 'vcrplayer', 2],
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2]
								]
							],
							['Kitchen', 'kitchen',
								[
									['Cooker', 'cooker', 13],
									['Dishwasher', 'dwasher', 12],
									['Freezer Chest', 'freezer', 30],
									['Large Fridge Freezer', 'lffreezer', 24],
									['Small Fridge Freezer', 'sffreezer', 12],
									['Ironing Board', 'ironing', 2],
									['Microwave', 'mwave', 6],
									['Washer/T. Dryer', 'washer', 12],
									['Kitchen Table', 'ktable', 12],
									['Chair', 'chair', 10],
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2]
								]
							],
							['Study', 'study',
								[
									['Large Desk', 'ldesk', 45],
									['Small Desk', 'sdesk', 25],
									['2D Filing Cabinet', '2dfc', 8],
									['4D Filing Cabinet', '3dfc', 16],
									['PC & Printer', 'pcprinter', 10],
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2]
								]
							],
							['Dining Room', 'dining',
								[
									['Dining Chair', 'dchair', 8],
									['4\' Dining Table', '4fdtable', 30],
									['6\' Dining Table', '6fdtable', 45],
									['Hostess Trolly', 'trolly', 8],
									['6\' Sideboard', 'sideboard', 30],
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2]
								]
							],
							['Conservatory', 'conservatory',
								[
									['Bookcase', 'bookcase', 12],
									['Occasional Chair', 'occchair', 12],
									['Occasional Table', 'occtable', 12],
									['2 Seater Sofa', '2ssofa', 32],
									['3 Seater Sofa', '3ssofa', 41],
									['4 Seater Sofa', '4ssofa', 50],
									['Small TV', 'tvsmall', 5],
									['Large TV', 'tvlarge', 10],
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2]
								]
							],
							['Shed/Garage', 'shed',
								[
									['Barbecue', 'bbq', 10],
									['Bicycle', 'bike', 8],
									['Large Cupboard', 'lcupboard', 8],
									['Small Cupboard', 'scupboard', 5],
									['DIY/Tools', 'tools', 12],
									['Garden Bench', 'gbench', 12],
									['Garden Tools', 'gtools', 12],
									['Ladders/Steps', 'ladders', 15],
									['Large Toys', 'largetoy', 5],
									['Lawn Mower', 'mower', 6],
									['Patio Set', 'patio', 25],
									['Pot/Plant', 'plant', 4],
									['Wheelbarrow', 'wbarrow', 8],
									['Work Bench', 'wbench', 24],
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2]
								]
							],
							['Miscellaneous', 'misc',
								[
									['Large Box', 'lbox', 4],
									['Small Box', 'sbox', 2],
									['Suitcase', 'scase', 6]
								]
							]
						);
						
var sections = objects.length;
var section = -1;
var total = 0;
						
for(j=0; j<sections; j++)
{
	document.writeln('<span onmouseover="doHighlight(this,'+j+')" onmouseout="noHighlight(this,'+j+')" id="objects_links_'+j+'" class="objects_links" onclick="ShowSection(\'objects_'+objects[j][1]+'\', '+j+')">'+objects[j][0]+'</span>');
}

for(j=0; j<sections; j++)
{
	document.writeln('<div id="objects_'+objects[j][1]+'" style="display: none">');
	document.writeln('<div class="objecttitle">'+objects[j][0]+'</div>');
	for(i=0; i<objects[j][2].length; i++)
	{
		document.writeln('<div class="m_item" id="object_'+j+'_'+i+'" onclick="setinputfocus(this)">');
		document.writeln('<div class="m_name">'+objects[j][2][i][0]+'</div>');
		document.writeln('<div class="m_total">Total: <input type="text" name="'+objects[j][1]+'_'+objects[j][2][i][1]+'" id="'+objects[j][1]+'_'+objects[j][2][i][1]+'" size="1" onkeypress="return check_numeric(event,this)" onchange="updatetally()" onkeyup="updatetally()" /></div>');
		document.writeln('</div>');
	}
	document.writeln('</div>');
}

function doHighlight(obj, num)
{
	if(num != section)
	obj.style.background = 'url(images/quotebutton_highlight.png) top left no-repeat';
}

function noHighlight(obj, num)
{
	if(num != section)
		obj.style.background = 'url(images/quotebutton.png) top left no-repeat';
}

function ShowSection(id, num)
{
	for(j=0; j<sections; j++)
	{
		$('objects_'+objects[j][1]).style.display = 'none';
		$('objects_links_'+j).style.background = 'url(images/quotebutton.png) top left no-repeat';
	}
	$('objects_links_'+num).style.background = 'url(images/quotebutton_selected.png) top left no-repeat'
	$(id).style.display = '';
	section = num;
}

function setinputfocus(e)
{
	e.getElementsByTagName('input')[0].focus();
}

function updatetally()
{
	total = 0;
	for(j=0; j<sections; j++)
	{
		for(i=0; i<objects[j][2].length; i++)
		{
			total += $(objects[j][1]+'_'+objects[j][2][i][1]).value * objects[j][2][i][2];
		}
	}
	$('totalcube').innerHTML = total;
}

function check_numeric(e, obj)
{
	 var charCode = (e.which) ? e.which : event.keyCode
	 if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	
	 return true;
}
