function get(id)
{
	return document.getElementById(id);
}

function convertInchesorMM( )
	{
		try
		{
			if( get('inches').value != '' )
			{
				// Convert from inches
				get('mm').value = convertTwoDP( (parseInt( get('inches').value, 10 )*10) / 0.393700787 );
			}
			else
			{
				// Convert from mm
				get('inches').value = convertTwoDP( (parseInt( get('mm').value, 10 )/10) * 0.393700787 );
			}
		}
		catch( e ){} 
	}
	
	function convertTwoDP( val )
	{
		return Math.round( val * 100 ) / 100;
	}
	
	function noenter()
	{
		return true;
	}

	function calcQuote( )
	{
		var sqMeterage = 0;

		var thisWindow = 0;

		thisWindow=(parseInt( get('em_Width_1').value ) * parseInt( get('em_Height_1').value) ) / 1000000;
		if (!isNaN(thisWindow)) { sqMeterage+=thisWindow; }

		thisWindow=(parseInt(get('em_Width_2').value ) * parseInt( get('em_Height_2').value) ) / 1000000;
		if (!isNaN(thisWindow)) { sqMeterage+=thisWindow; }

		thisWindow=(parseInt( get('em_Width_3').value ) * parseInt( get('em_Height_3').value) ) / 1000000;
		if (!isNaN(thisWindow)) { sqMeterage+=thisWindow; }

		thisWindow=(parseInt( get('em_Width_4').value ) * parseInt( get('em_Height_4').value) ) / 1000000;
		if (!isNaN(thisWindow)) { sqMeterage+=thisWindow; }

		thisWindow=(parseInt( get('em_Width_5').value ) * parseInt( get('em_Height_5').value) ) / 1000000;
		if (!isNaN(thisWindow)) { sqMeterage+=thisWindow; }

		//var cost_c = sqMeterage * 215;
		var cost_r = sqMeterage * 225;
		var cost_m = sqMeterage * 240;
		
		//document.all.em_Total_chelsea.value = isNaN( cost_c ) ? 0.00 : round( cost_c, 2 );
		get('em_Total_richmond').value = isNaN( cost_r ) ? 0.00 : round( cost_r, 2 );
		get('em_Total_mayfair').value = isNaN( cost_m ) ? 0.00 : round( cost_m, 2 );
	}
	function round( number, places ) 
	{
		// rounds number to X decimal places, defaults to 2
		places = ( !places ? 2 : places );
		return Math.floor( number * Math.pow( 10, places ) ) / Math.pow( 10, places );
	}
