// Set default door combination
var myDoor 					= new Array();
myDoor['Facade'] 			= 'White_Siding';
myDoor['Door Construction'] = 'Insulated';
myDoor['Door Model'] 		= '730';
myDoor['Panel Style'] 		= 'Ranch';
myDoor['Door Size'] 		= 'door_1';
myDoor['Color'] 			= 'Almond_Steel';
myDoor['Window Design'] 	= 'No_Windows';
myDoor['Decorative Hardware'] 	= 'no_decorative_hardware';

// Set default front end displays
var currentSpecs 					= new Array();
currentSpecs['Door Construction'] 	= 'Insulated';
currentSpecs['Door Model'] 			= '730';
currentSpecs['Panel Style'] 		= 'Ranch';
currentSpecs['Color'] 				= 'Almond Steel';
currentSpecs['Window Design'] 		= 'No Windows';
		
var doorImages				= new Array();
doorImages['facade']		= 'White_Siding';
doorImages['door']			= '730';
doorImages['window']		= 'No_Windows';
doorImages['hdw']			= 'no_decorative_hardwre';

var drImg					= new Array();

(function($){

	// On-load scripts
	$(document).ready(function() {
		
		// Add reset button click handler
		$('.reset').click(function()				{ resetDoor(); });
	
		// Add main menu click handlers
		$('.facade').click(function()     			{ enableMenu("facade"); });
		$('.door_construction').click(function() 	{ enableMenu("door_construction"); });
		$('.door_model').click(function() 			{ enableMenu("door_model"); });
		$('.panel_style').click(function() 			{ enableMenu("panel_style"); });
		$('.door_size').click(function()			{ switchDoorSize(); });
		$('.color').click(function() 				{ enableMenu("color"); });
		$('.window_design').click(function() 		{ enableMenu("window_design"); });
		$('.decorative_hardware').click(function() 	{ enableMenu("decorative_hardware"); });
		
		// Create the door based on default settings
		buildDoor();
	});
	
	function parseXml(xml) {  
		if (jQuery.browser.msie) {  
			var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");  
			xmlDoc.loadXML(xml);  
			xml = xmlDoc;  
		}  
		return xml; 
	}
	
	// Build the requested menu
	function buildMenu( myMenu, menuClass )
	{	
		switch( myMenu )
		{
			case 'facade' :
				$.ajax({
					type: "GET",
					url: "buildadoor.xml",
					dataType: ($.browser.msie) ? "text" : "xml",
					success: function(xml) {
						var newXML = parseXml(xml);
						newMenu = '<ul>';	
						$(newXML).find( myMenu ).each(function(){
							var id        	= $(this).attr('id');
							var thumb  		= $(this).attr('thumb');
							var rollover  	= $(this).attr('rollover');
							var height 		= $(this).attr('height');
							var width  		= $(this).attr('width');
							var alt    		= $(this).attr('alt');
							newMenu = newMenu + '<li><img id="' + id + '" src="img/thumbs_' + myMenu + '/' + thumb;
							newMenu = newMenu + '" width="' + width + '" height="' + height + '" alt="' + alt + '" />';
							newMenu = newMenu + alt + '</li>';					
						});
						newMenu = newMenu + '</ul>';
						$( menuClass ).html( newMenu );
				
						$( menuClass + ' img').hover(
							function() {  onHover( $(this) ); }, 
							function() { offHover( $(this) ); }
						);
						
						$( menuClass + ' img' ).click(function() { myDoor['Facade'] = $(this).attr('id'); buildDoor();  });
					}
				});
				break;

			case 'door_construction' :
				$.ajax({
					type: "GET",
					url: "buildadoor.xml",
					dataType: ($.browser.msie) ? "text" : "xml",
					success: function(xml) {
						var newXML = parseXml(xml);
						newMenu = '<ul>';			
						$(newXML).find( myMenu ).each(function(){
							var id     = $(this).attr('id');
							var thumb  = $(this).attr('thumb');
							var height = $(this).attr('height');
							var width  = $(this).attr('width');
							var alt    = $(this).attr('alt');
							newMenu = newMenu + '<li><img id="' + id + '" src="img/thumbs_' + myMenu + '/' + thumb;
							newMenu = newMenu + '" width="' + width + '" height="' + height + '" alt="' + alt + '" />';
							newMenu = newMenu + alt + '</li>';					
						});
						newMenu = newMenu + '</ul>';
						$( menuClass ).html( newMenu );
						$( menuClass + ' img' ).click(function() 
						{ 
							myDoor['Door Construction'] = $(this).attr('id'); 
							currentSpecs['Door Construction'] = $(this).attr('alt');
							buildDoor(); 
						});
					}
				});
				break;
				
			case 'door_model' :
				$.ajax({
					type: "GET",
					url: "buildadoor.xml",
					dataType: ($.browser.msie) ? "text" : "xml",
					success: function(xml) {
						var newXML = parseXml(xml);
						var newMenu = '<ul>';
						var door_construction_id = '#' + myDoor['Door Construction'];
						var myDoorConstruction = $(newXML).find( door_construction_id );
						
						myDoorConstruction.find( myMenu ).each(function(){
							var id     = $(this).attr('id');
							var thumb  = $(this).attr('thumb');
							var height = $(this).attr('height');
							var width  = $(this).attr('width');
							var alt    = $(this).attr('alt');
							var text   = $(this).attr('text');
							//newMenu = newMenu + '<li><img id="' + id + '" src="img/thumbs_' + myMenu + '/' + thumb;
							//newMenu = newMenu + '" width="' + width + '" height="' + height + '" alt="' + alt + '" />';
							//newMenu = newMenu + alt + '</li>';					
							newMenu = newMenu + '<li id="' + id + '" alt="' + alt + '"><b>Model ' + id + '</b><br />' +  text + '</li>';
						});
						newMenu = newMenu + '</ul>';
						$( menuClass ).html( newMenu );
						$( menuClass + ' li' ).click(function() 
						{ 
							myDoor['Door Model'] = $(this).attr('id'); 
							currentSpecs['Door Model'] = $(this).attr('alt'); 
							buildDoor(); 
						});
					}
				});
				break;
				
			case 'panel_style' :
				$.ajax({
					type: "GET",
					url: "buildadoor.xml",
					dataType: ($.browser.msie) ? "text" : "xml",
					success: function(xml) {
						var newXML = parseXml(xml);
						var newMenu = '<ul>';
						var door_construction_id = '#' + myDoor['Door Construction'];
						var door_model_id = '#' + myDoor['Door Model'];
						var myDoorConstruction = $(newXML).find( door_construction_id );
						var myDoorModel = myDoorConstruction.find( door_model_id );
						
						myDoorModel.find( myMenu ).each(function(){
							var id     = $(this).attr('id');
							var thumb  = $(this).attr('thumb');
							var height = $(this).attr('height');
							var width  = $(this).attr('width');
							var alt    = $(this).attr('alt');
							newMenu = newMenu + '<li><img id="' + id + '" src="img/thumbs_' + myMenu + '/' + thumb;
							newMenu = newMenu + '" width="' + width + '" height="' + height + '" alt="' + alt + '" />';
							newMenu = newMenu + alt + '</li>';					
						});
						newMenu = newMenu + '</ul>';
						$( menuClass ).html( newMenu );
						$( menuClass + ' img' ).click(function() 
						{ 
							myDoor['Panel Style'] = $(this).attr('id'); 
							currentSpecs['Panel Style'] = $(this).attr('alt'); 
							buildDoor(); 
						});
					}
				});
				break;
				
			case 'color' :
				$.ajax({
					type: "GET",
					url: "buildadoor.xml",
					dataType: ($.browser.msie) ? "text" : "xml",
					success: function(xml) {
						var newXML = parseXml(xml);
						
						var newMenu = '<ul>';						
						
						var door_construction_id 	= '#' + myDoor['Door Construction'];
						var door_model_id 			= '#' + myDoor['Door Model'];
						var panel_style_id 			= '#' + myDoor['Panel Style'];
						var door_size_id  			= '#' + myDoor['Door Size'];
						
						var myDoorConstruction 	= $(newXML).find( door_construction_id );
						var myDoorModel 		= myDoorConstruction.find( door_model_id );
						var myPanelStyle 		= myDoorModel.find( panel_style_id );
						var myDoorSize			= myPanelStyle.find( door_size_id );
						
						myDoorSize.find( myMenu ).each(function(){
							var id     = $(this).attr('id');
							var thumb  = $(this).attr('thumb');
							var height = $(this).attr('height');
							var width  = $(this).attr('width');
							var alt    = $(this).attr('alt');
							newMenu = newMenu + '<li><img id="' + id + '" src="img/thumbs_' + myMenu + '/' + thumb;
							newMenu = newMenu + '" width="' + width + '" height="' + height + '" alt="' + alt + '" />';
							newMenu = newMenu + alt + '</li>';					
						});
						newMenu = newMenu + '</ul>';
						$( menuClass ).html( newMenu );
						$( menuClass + ' img' ).click(function() 
						{ 
							myDoor['Color'] = $(this).attr('id'); 
							currentSpecs['Color'] = $(this).attr('alt'); 
							buildDoor(); 
						});
					}
				});
				break;
				
			case 'window_design' :
				$.ajax({
					type: "GET",
					url: "buildadoor.xml",
					dataType: ($.browser.msie) ? "text" : "xml",
					success: function(xml) {
						var newXML = parseXml(xml);						
						var newMenu = '<ul>';						
						var myWindows = $(newXML).find( "window_design" );
						
						// Get number of doors
						var myDoorNum = 1;
						if(myDoor['Door Size'] == 'door_2')
							myDoorNum = 2;
						var myDoorColor = myDoor['Color'];
						myWindows.each(function() {						
							// Remove window options not present based on 1 or 2 doors
							var doorNum = $(this).attr('door');
							var SW = $(this).attr('SteelWood');
							if (myDoorColor == 'CherryWood' || myDoorColor == 'OakWood')
							{
								if (SW == 1 && (doorNum == myDoorNum || doorNum == '3'))
								{
									var id      = $(this).attr('id');
									var thumb   = $(this).attr('thumb');
									var height  = $(this).attr('height');
									var width   = $(this).attr('width');
									var alt     = $(this).attr('alt');
									newMenu = newMenu + '<li><img id="' + id + '" src="img/thumbs_' + myMenu + '/' + thumb;
									newMenu = newMenu + '" width="' + width + '" height="' + height + '" alt="' + alt + '" />';
									newMenu = newMenu + alt + '</li>';	
								}
							}
							// Remove window options not present based on 1 or 2 doors
							else if(doorNum == myDoorNum || doorNum == '3')
							{
								var id      = $(this).attr('id');
								var thumb   = $(this).attr('thumb');
								var height  = $(this).attr('height');
								var width   = $(this).attr('width');
								var alt     = $(this).attr('alt');
								newMenu = newMenu + '<li><img id="' + id + '" src="img/thumbs_' + myMenu + '/' + thumb;
								newMenu = newMenu + '" width="' + width + '" height="' + height + '" alt="' + alt + '" />';
								newMenu = newMenu + alt + '</li>';	
							}
						});
						newMenu = newMenu + '</ul>';
						$( menuClass ).html( newMenu );
						$( menuClass + ' img' ).click(function() 
						{ 
							myDoor['Window Design'] = $(this).attr('id'); 
							currentSpecs['Window Design'] = $(this).attr('alt'); 
							buildDoor(); 
						});
					}
				});
				break;
				
			case 'decorative_hardware' :
				$.ajax({
					type: "GET",
					url: "buildadoor.xml",
					dataType: ($.browser.msie) ? "text" : "xml",
					success: function(xml) {					
						var newXML = parseXml(xml);
					
						var myHardware = $(newXML).find('#' + myDoor['Door Model'] + '_' + myDoor['Door Size']);
						var noHardware = $(newXML).find('#no_decorative_hardware');
						
						var newMenu = '<ul>';						
						var id     	= noHardware.attr('id');
						var thumb  	= noHardware.attr('thumb');
						var height 	= noHardware.attr('height');
						var width  	= noHardware.attr('width');
						var alt    	= noHardware.attr('alt');
						newMenu 	= newMenu + '<li><img id="' + id + '" src="img/thumbs_' + myMenu + '/' + thumb;
						newMenu 	= newMenu + '" width="' + width + '" height="' + height + '" alt="' + alt + '" />';
						newMenu 	= newMenu + alt + '</li>';	
						
						id     	= myHardware.attr('id');
						thumb  	= myHardware.attr('thumb');
						height 	= myHardware.attr('height');
						width  	= myHardware.attr('width');
						alt    	= myHardware.attr('alt');
						newMenu = newMenu + '<li><img id="' + id + '" src="img/thumbs_' + myMenu + '/' + thumb;
						newMenu = newMenu + '" width="' + width + '" height="' + height + '" alt="' + alt + '" />';
						newMenu = newMenu + alt + '</li>';	
						newMenu = newMenu + '</ul>';
						
						$( menuClass ).html( newMenu );
						$( menuClass + ' img' ).click(function() 
						{ 
							myDoor['Decorative Hardware'] = $(this).attr('id'); 
							buildDoor(); 
						});
					}
				});
				break;
		}
	}
	
	// Hide sub menus and enable chosen menu upon main menu item click
	function enableMenu( myMenu )
	{
		// Hide all menus (& introduction)
		$('#introduction').css('display', 'none');
		$('#facade_menu').css('display', 'none');
		$('#door_construction_menu').css('display', 'none');
		$('#door_model_menu').css('display', 'none');
		$('#panel_style_menu').css('display', 'none');
		$('#color_menu').css('display', 'none');
		$('#window_design_menu').css('display', 'none');
		$('#decorative_hardware_menu').css('display', 'none');

		// Build chosen menu selector
		var menuClass = '#' + myMenu + '_menu';
		
		// Build the actual menu from XML file
		buildMenu( myMenu, menuClass );

		// Show menu
		$(menuClass).css('display', 'block');
	}
	
	// Changes between 1 door and 2 door garage
	function switchDoorSize()
	{
		if(myDoor['Door Size'] == 'door_1')
			myDoor['Door Size'] = 'door_2';
		else
			myDoor['Door Size'] = 'door_1';
		buildDoor();
		
		// Rebuild Window Design menu (some designs are not present for 1/2 door options)
		if($('#window_design_menu').css('display') == 'block')
			enableMenu( "window_design" );
	}
	
	// Convert image to rollover state upon rollover
	function onHover( obj )
	{
		var myImageSrc = obj.attr('src');
		var myImageSrcRollerOver = myImageSrc.replace('.jpg', '_ro.jpg');
		obj.attr('src', myImageSrcRollerOver); 
	}
	
	// Return image to normal state after rollover
	function offHover( obj )
	{
		var myImageSrc = obj.attr('src');
		var myImageSrcRollerOver = myImageSrc.replace('_ro.jpg', '.jpg');
		obj.attr('src', myImageSrcRollerOver); 
	}
	
	// Create and show the door based on information in the myDoor array
	function buildDoor()
	{
		// Ensure the selected options are all valid
		verifyDoor();
		
		// Add/Remove hardware menu
		checkForHardware();
		$.ajax({
			type: "GET",
			url: "buildadoor.xml",
					dataType: ($.browser.msie) ? "text" : "xml",
			success: function(xml) {
				var newXML = parseXml(xml);
				// Set Facade
				var myFacadeId  = '#' + myDoor['Facade'];
				var myFacadeSrc = $(newXML).find( myFacadeId ).attr('background');
				doorImages['facade'] = 'img/facades/' + myFacadeSrc;
				document.getElementById('imgfacade').src = doorImages['facade']; 
				// Set Door
				var myDoorSrc = 
					myDoor['Panel Style'] + '_' +
					myDoor['Door Size'] + '_' +
					myDoor['Color'] + '.png';
				doorImages['door'] = 'img/doors/' + myDoorSrc.toLowerCase();
				document.getElementById('imgdoor').src = doorImages['door']; 
				// Set Window Design
				if( myDoor['Window Design'] == 'No_Windows' )
				{
					doorImages['window'] = 'img/blank.png';
				}
				// Door 1 / Ranch
				else if( myDoor['Door Size'] == 'door_1' && myDoor['Window Design'].search(/ranch/i) > -1)
				{
					doorImages['window'] = 
						'img/window_design/ranch/' + 
						myDoor['Color'] + '/ranch_' + 
						myDoor['Door Size'] + '_' + 
						myDoor['Window Design'].toLowerCase().replace('ranch', '') + '_' + 
						myDoor['Color'].toLowerCase() + '.png';
					document.getElementById('imgwindow').src = doorImages['window']; 
				}
				// Door 1 / Non-Ranch
				else if( myDoor['Door Size'] == 'door_1') {
					doorImages['window'] = 
						'img/window_design/raised/' + 
						myDoor['Color'] + '/raised_' + 
						myDoor['Door Size'] + '_' + 
						myDoor['Window Design'].toLowerCase() + '_' + 
						myDoor['Color'].toLowerCase() + '.png';
					document.getElementById('imgwindow').src = doorImages['window']; 
				}
				// Door 2 / Ranch
				else if( myDoor['Door Size'] == 'door_2' && myDoor['Window Design'].search(/ranch/i) > -1)
				{
					doorImages['window'] = 
						'img/window_design/ranch/' + 
						myDoor['Color'] + '/ranch_' + 
						myDoor['Door Size'] + '_' + 
						myDoor['Window Design'].toLowerCase().replace('ranch', '') + '_' + 
						myDoor['Color'].toLowerCase() + '.png';
					document.getElementById('imgwindow').src = doorImages['window']; 
				}
				// Door 2 / Non-Ranch
				else if( myDoor['Door Size'] == 'door_2' && myDoor['Window Design'].search(/ranch/i) == -1)
				{
					doorImages['window'] = 
						'img/window_design/raised/' + 
						myDoor['Color'] + '/raised_' + 
						myDoor['Door Size'] + '_' + 
						myDoor['Window Design'].toLowerCase() + '_' + 
						myDoor['Color'].toLowerCase() + '.png';
					document.getElementById('imgwindow').src = doorImages['window']; 
				}
				var myWindowId = '#' + myDoor['Window Design'] + '_' + myDoor['Door Size'] + '_' + myDoor['Color'];
				var imgAttr = $(newXML).find(myWindowId);
				var imgHeight = imgAttr.attr('height');
				var imgWidth = imgAttr.attr('width');
				var imgTop = imgAttr.attr('top');
				var imgLeft = imgAttr.attr('left');
				$('#window_design').css('width', imgWidth);					
				$('#window_design').css('height', imgHeight);
				$('#window_design').css('top', imgTop);
				$('#window_design').css('left', imgLeft);
				// Set hardware
				if(myDoor['Decorative Hardware'] != 'no_decorative_hardware')
				{
					doorImages['hdw'] = 'img/decorative_hardware/' + myDoor['Decorative Hardware'] + '.png';
					$('#decorative_hardware').css('top', '-30px');
					$('#decorative_hardware').css('left', '-58px');
					document.getElementById('imghdw').src = doorImages['hdw']; 

				}
				else
				{
					doorImages['hdw'] = 'img/blank.png';
				}
			}
		});
		// Set fields in the "Current Specifications" display
		$('#spec_model').html(currentSpecs['Door Model']);
		$('#spec_construction').html(currentSpecs['Door Construction']);
		$('#spec_window').html(currentSpecs['Window Design']);
		$('#spec_panel').html(currentSpecs['Panel Style']);
		$('#spec_color').html(currentSpecs['Color']);
		document.getElementById('imgwindow').style.visibility = 'visible'; 
		if( myDoor['Window Design'] == 'No_Windows' )
			{
				document.getElementById('imgwindow').style.visibility = 'hidden'; 
			}
		if(myDoor['Decorative Hardware'] != 'no_decorative_hardware')
			{
				document.getElementById('imghdw').style.visibility = 'visible'; 
			}
		else
			{
				document.getElementById('imghdw').style.visibility = 'hidden'; 
			}
	}
	
	// Ensure that all door options are valid (reset to first possible option if invalid)
	function verifyDoor()
	{
		$.ajax({
			type: "GET",
			url: "buildadoor.xml",
			dataType: ($.browser.msie) ? "text" : "xml",
			success: function(xml) 
			{
				var newXML = parseXml(xml);
				var door_construction_id 	= '#' + myDoor['Door Construction'];
				var door_model_id 			= '#' + myDoor['Door Model'];
				var panel_style_id 			= '#' + myDoor['Panel Style'];
				var door_size_id  			= '#' + myDoor['Door Size'];
				var color_id	  			= '#' + myDoor['Color'];
				var window_design_id		= '#' + myDoor['Window Design']; 
				
				// Verify Door Construction
				var myDoorConstruction 	= $(newXML).find( door_construction_id );
				if(myDoorConstruction.length == 0)
				{
					myDoorConstruction = $(newXML).find('door_construction:first');
					myDoor['Door Construction']	= myDoorConstruction.attr('id');
					currentSpecs['Door Construction'] = myDoorConstruction.attr('alt'); 
					door_construction_id = '#' + myDoor['Door Construction'];
					$('#door_construction').html(currentSpecs['Door Construction']);
				}
				
				// Verify Door Model
				var myDoorModel = $(newXML)
					.find( door_construction_id )
					.find( door_model_id );
				if( myDoorModel.length == 0 )
				{
					myDoorModel = $(newXML)
						.find( door_construction_id )
						.find( 'door_model:first' );
					myDoor['Door Model'] = myDoorModel.attr('id');
					currentSpecs['Door Model'] = myDoorModel.attr('alt');
					door_model_id = '#' + myDoor['Door Model'];
					$('#spec_model').html(currentSpecs['Door Model']);
				}
				
				// Verify Panel Style
				var myPanelStyle = $(newXML)
					.find( door_construction_id )
					.find( door_model_id )
					.find( panel_style_id );
				if( myPanelStyle.length == 0 )
				{
					myPanelStyle = $(newXML)
						.find( door_construction_id)
						.find( door_model_id )
						.find( 'panel_style:first');
					myDoor['Panel Style'] = myPanelStyle.attr('id');				
					currentSpecs['Panel Style'] = myPanelStyle.attr('alt');				
					panel_style_id = '#' + myDoor['Panel Style'];
					$('#spec_panel').html(currentSpecs['Panel Style']);
				}
				
				// Verify Door Size
				var myDoorSize = $(newXML)
					.find( door_construction_id )
					.find( door_model_id )
					.find( panel_style_id )
					.find( door_size_id );
				if( myDoorSize.length == 0 )
				{
					myDoorSize = $(newXML)
						.find( door_construction_id)
						.find( door_model_id )
						.find( panel_style_id )
						.find( 'door_size:first' );
					myDoor['Door Size'] = myDoorSize.attr('id');
					door_size_id = '#' + myDoor['Door Size'];
				}
				
				// Verify Color
				var myColor = $(newXML)
					.find( door_construction_id )
					.find( door_model_id )
					.find( panel_style_id )
					.find( door_size_id )
					.find( color_id );
				if( myColor.length == 0 )
				{
					myColor = $(newXML)
						.find( door_construction_id)
						.find( door_model_id )
						.find( panel_style_id )
						.find( door_size_id )
						.find( 'color:first' );					
					myDoor['Color'] = myColor.attr('id');	
					currentSpecs['Color'] = myColor.attr('alt');	
					color_id = '#' + myDoor['Color'];
					$('#spec_color').html(currentSpecs['Color']);
				}
				
				// Verify Hardware
				if( myDoor['Decorative Hardware'] != 'no_decorative_hardware' )
				{
					switch( myDoor['Door Model'] )
					{
						case '730' :
						case '755' :
						case '770' :
						case '790' :
							var myHardware = $(newXML).find( '#' + myDoor['Decorative Hardware'] );
							var exists = myHardware.length;
							var correctModel = (myHardware.attr('model') == myDoor['Door Model']);
							var correctSize = (myHardware.attr('door') == myDoor['Door Size']);
							if(! (exists && correctModel && correctSize))
							{
								myDoor['Decorative Hardware'] = 'no_decorative_hardware';
							}
							break;
						default : myDoor['Decorative Hardware'] = 'no_decorative_hardware';
							break;
					}
				}
			}
		});		
	}

	// Reset the door options to the defaults
	function resetDoor()
	{
		// Hide all the menus
		$('#facade_menu').css('display', 'none');
		$('#door_construction_menu').css('display', 'none');
		$('#door_model_menu').css('display', 'none');
		$('#panel_style_menu').css('display', 'none');
		$('#color_menu').css('display', 'none');
		$('#window_design_menu').css('display', 'none');	
		
		// Show the introduction
		$('#introduction').css('display', 'block');
	
		// Set the door back to its defaults
		myDoor['Facade'] 			= 'White_Siding';
		myDoor['Door Construction'] = 'Insulated';
		myDoor['Door Model'] 		= '730';
		myDoor['Panel Style'] 		= 'Ranch';
		myDoor['Door Size'] 		= 'door_1';
		myDoor['Color'] 			= 'Almond_Steel';
		myDoor['Window Design'] 	= 'No_Windows';
		
		// Set the display to its defaults
		currentSpecs['Door Construction'] 	= 'Insulated';
		currentSpecs['Door Model'] 			= '730';
		currentSpecs['Panel Style'] 		= 'Ranch';
		currentSpecs['Color'] 				= 'Almond Steel';
		currentSpecs['Window Design'] 		= 'No Windows';
		
		//doorImages['facade']		= 'White_Siding';
		//doorImages['door']			= '730';
		//doorImages['window']		= 'No_Windows';
		//doorImages['hdw']			= 'no_decorative_hardwre';

		// Rebuild the door using the defaults
		buildDoor();
	}
	
	function checkForHardware()
	{
		if( myDoor['Panel Style'] == 'Carriage' )
		{
			switch( myDoor['Door Model'] )
			{
				case '730' :
				case '755' :
				case '770' :
				case '790' : $('.decorative_hardware').css('display', 'block');
					break;
				default : $('.decorative_hardware').css('display', 'none');
					break;
			}
		}
	}
	
})(jQuery);
