var price_setting = "high";
var selected_door = 0;
var selected_vent = 0;
var selected_color = 0;
var selected_glass = 0;
var selected_door_size = 0;
var available_groups = [7,30,33554431,32767];
// 33554431 - All 25
// 32767 - All 15
// 255 - All 8
// 30 - 2,3,4,5
// 28 - 3,4,5
// 15 - All 4
// 14 - 2,3,4
// 7 - All 3
// 3 - All 2

// Set 3 dimensional array to keep records of available colors and sizes for each door.
var sizeColors = new Array();
for (var i=1; i<=28; i++)
{
	sizeColors[i] = new Array();
	for (var j=1; j<=25; j++)
	{
		sizeColors[i][j] = new Array();
		for (var k=30; k<=36; k++)
		{
			sizeColors[i][j][k] = 0;
		}
	}
}
// Door / Color / Size
sizeColors[1][1][32] = 1;
sizeColors[1][1][34] = 1;
sizeColors[1][1][36] = 1;
sizeColors[1][2][32] = 1;
sizeColors[1][2][36] = 1;
sizeColors[1][3][32] = 1;
sizeColors[1][3][36] = 1;
sizeColors[1][4][32] = 1;
sizeColors[1][4][36] = 1;
sizeColors[1][5][32] = 1;
sizeColors[1][5][36] = 1;
sizeColors[1][6][32] = 1;
sizeColors[1][6][36] = 1;
sizeColors[1][7][32] = 1;
sizeColors[1][7][36] = 1;
sizeColors[1][8][32] = 1;
sizeColors[1][8][36] = 1;
sizeColors[2][1][32] = 1;
sizeColors[2][1][34] = 1;
sizeColors[2][1][36] = 1;
sizeColors[2][2][36] = 1;
sizeColors[2][3][36] = 1;
sizeColors[2][4][36] = 1;
sizeColors[2][5][36] = 1;
sizeColors[2][6][36] = 1;
sizeColors[2][7][36] = 1;
sizeColors[2][8][36] = 1;
sizeColors[3][1][30] = 1;
sizeColors[3][1][32] = 1;
sizeColors[3][1][34] = 1;
sizeColors[3][1][36] = 1;
sizeColors[3][2][36] = 1;
sizeColors[3][3][36] = 1;
sizeColors[3][4][36] = 1;
sizeColors[3][5][36] = 1;
sizeColors[3][6][36] = 1;
sizeColors[3][7][36] = 1;
sizeColors[3][8][36] = 1;
sizeColors[4][1][33] = 1;
sizeColors[4][1][34] = 1;
sizeColors[4][1][36] = 1;
sizeColors[4][2][33] = 1;
sizeColors[4][2][34] = 1;
sizeColors[4][2][36] = 1;
sizeColors[4][3][33] = 1;
sizeColors[4][3][34] = 1;
sizeColors[4][3][36] = 1;
sizeColors[4][4][33] = 1;
sizeColors[4][4][34] = 1;
sizeColors[4][4][36] = 1;
sizeColors[4][5][36] = 1;
sizeColors[4][6][36] = 1;
sizeColors[4][7][36] = 1;
sizeColors[4][8][36] = 1;
sizeColors[5][1][32] = 1;
sizeColors[5][1][33] = 1;
sizeColors[5][1][34] = 1;
sizeColors[5][1][36] = 1;
sizeColors[5][2][32] = 1;
sizeColors[5][2][33] = 1;
sizeColors[5][2][34] = 1;
sizeColors[5][2][36] = 1;
sizeColors[5][3][32] = 1;
sizeColors[5][3][33] = 1;
sizeColors[5][3][34] = 1;
sizeColors[5][3][36] = 1;
sizeColors[5][4][32] = 1;
sizeColors[5][4][33] = 1;
sizeColors[5][4][34] = 1;
sizeColors[5][4][36] = 1;
sizeColors[5][5][32] = 1;
sizeColors[5][5][36] = 1;
sizeColors[5][6][32] = 1;
sizeColors[5][6][36] = 1;
sizeColors[5][7][32] = 1;
sizeColors[5][7][36] = 1;
sizeColors[5][8][32] = 1;
sizeColors[5][8][36] = 1;
sizeColors[6][1][33] = 1;
sizeColors[6][1][34] = 1;
sizeColors[6][1][36] = 1;
sizeColors[6][2][33] = 1;
sizeColors[6][2][34] = 1;
sizeColors[6][2][36] = 1;
sizeColors[6][3][33] = 1;
sizeColors[6][3][34] = 1;
sizeColors[6][3][36] = 1;
sizeColors[6][4][33] = 1;
sizeColors[6][4][34] = 1;
sizeColors[6][4][36] = 1;
sizeColors[6][5][33] = 1;
sizeColors[6][5][34] = 1;
sizeColors[6][5][36] = 1;
sizeColors[6][6][33] = 1;
sizeColors[6][6][34] = 1;
sizeColors[6][6][36] = 1;
sizeColors[6][7][33] = 1;
sizeColors[6][7][34] = 1;
sizeColors[6][7][36] = 1;
sizeColors[6][8][33] = 1;
sizeColors[6][8][34] = 1;
sizeColors[6][8][36] = 1;
sizeColors[7][1][33] = 1;
sizeColors[7][1][34] = 1;
sizeColors[7][1][36] = 1;
sizeColors[7][2][36] = 1;
sizeColors[7][3][36] = 1;
sizeColors[7][4][36] = 1;
sizeColors[7][5][36] = 1;
sizeColors[8][1][30] = 1;
sizeColors[8][1][32] = 1;
sizeColors[8][1][33] = 1;
sizeColors[8][1][34] = 1;
sizeColors[8][1][36] = 1;
sizeColors[8][2][32] = 1;
sizeColors[8][2][36] = 1;
sizeColors[8][3][36] = 1;
sizeColors[8][4][32] = 1;
sizeColors[8][4][36] = 1;
sizeColors[8][5][32] = 1;
sizeColors[8][5][36] = 1;
sizeColors[9][1][32] = 1;
sizeColors[9][1][34] = 1;
sizeColors[9][1][36] = 1;
sizeColors[9][2][32] = 1;
sizeColors[9][2][34] = 1;
sizeColors[9][2][36] = 1;
sizeColors[9][3][32] = 1;
sizeColors[9][3][34] = 1;
sizeColors[9][3][36] = 1;
sizeColors[9][4][32] = 1;
sizeColors[9][4][34] = 1;
sizeColors[9][4][36] = 1;
sizeColors[9][5][32] = 1;
sizeColors[9][5][36] = 1;
sizeColors[9][6][32] = 1;
sizeColors[9][6][36] = 1;
sizeColors[9][7][32] = 1;
sizeColors[9][7][36] = 1;
sizeColors[9][8][32] = 1;
sizeColors[9][8][36] = 1;
sizeColors[10][1][32] = 1;
sizeColors[10][1][33] = 1;
sizeColors[10][1][34] = 1;
sizeColors[10][1][36] = 1;
sizeColors[10][2][32] = 1;
sizeColors[10][2][33] = 1;
sizeColors[10][2][34] = 1;
sizeColors[10][2][36] = 1;
sizeColors[10][3][32] = 1;
sizeColors[10][3][33] = 1;
sizeColors[10][3][34] = 1;
sizeColors[10][3][36] = 1;
sizeColors[10][4][32] = 1;
sizeColors[10][4][33] = 1;
sizeColors[10][4][34] = 1;
sizeColors[10][4][36] = 1;
sizeColors[10][5][32] = 1;
sizeColors[10][5][36] = 1;
sizeColors[10][6][32] = 1;
sizeColors[10][6][36] = 1;
sizeColors[10][7][32] = 1;
sizeColors[10][7][36] = 1;
sizeColors[10][8][32] = 1;
sizeColors[10][8][36] = 1;
sizeColors[11][1][30] = 1;
sizeColors[11][1][32] = 1;
sizeColors[11][1][33] = 1;
sizeColors[11][1][34] = 1;
sizeColors[11][1][36] = 1;
sizeColors[11][2][32] = 1;
sizeColors[11][2][33] = 1;
sizeColors[11][2][34] = 1;
sizeColors[11][2][36] = 1;
sizeColors[11][3][32] = 1;
sizeColors[11][3][33] = 1;
sizeColors[11][3][34] = 1;
sizeColors[11][3][36] = 1;
sizeColors[11][4][32] = 1;
sizeColors[11][4][33] = 1;
sizeColors[11][4][34] = 1;
sizeColors[11][4][36] = 1;
sizeColors[11][5][32] = 1;
sizeColors[11][5][36] = 1;
sizeColors[12][1][30] = 1;
sizeColors[12][1][32] = 1;
sizeColors[12][1][36] = 1;
sizeColors[12][2][32] = 1;
sizeColors[12][2][36] = 1;
sizeColors[13][1][30] = 1;
sizeColors[13][1][32] = 1;
sizeColors[13][1][36] = 1;
sizeColors[14][1][32] = 1;
sizeColors[14][1][34] = 1;
sizeColors[14][1][36] = 1;
sizeColors[14][2][32] = 1;
sizeColors[14][2][36] = 1;
sizeColors[14][3][32] = 1;
sizeColors[14][3][36] = 1;
sizeColors[14][4][32] = 1;
sizeColors[14][4][36] = 1;
sizeColors[14][5][32] = 1;
sizeColors[14][5][36] = 1;
sizeColors[15][1][32] = 1;
sizeColors[15][1][33] = 1;
sizeColors[15][1][34] = 1;
sizeColors[15][1][36] = 1;
sizeColors[15][2][32] = 1;
sizeColors[15][2][33] = 1;
sizeColors[15][2][34] = 1;
sizeColors[15][2][36] = 1;
sizeColors[15][3][32] = 1;
sizeColors[15][3][33] = 1;
sizeColors[15][3][34] = 1;
sizeColors[15][3][36] = 1;
sizeColors[15][4][32] = 1;
sizeColors[15][4][33] = 1;
sizeColors[15][4][34] = 1;
sizeColors[15][4][36] = 1;
sizeColors[15][5][32] = 1;
sizeColors[15][5][33] = 1;
sizeColors[15][5][34] = 1;
sizeColors[15][5][36] = 1;
sizeColors[16][1][32] = 1;
sizeColors[16][1][36] = 1;
sizeColors[16][2][32] = 1;
sizeColors[16][2][36] = 1;
sizeColors[16][3][32] = 1;
sizeColors[16][3][36] = 1;
sizeColors[16][4][32] = 1;
sizeColors[16][4][36] = 1;
sizeColors[16][5][32] = 1;
sizeColors[16][5][36] = 1;
sizeColors[17][1][32] = 1;
sizeColors[17][1][33] = 1;
sizeColors[17][1][34] = 1;
sizeColors[17][1][36] = 1;
sizeColors[17][2][32] = 1;
sizeColors[17][2][33] = 1;
sizeColors[17][2][34] = 1;
sizeColors[17][2][36] = 1;
sizeColors[17][4][32] = 1;
sizeColors[17][4][33] = 1;
sizeColors[17][4][34] = 1;
sizeColors[17][4][36] = 1;
sizeColors[18][1][30] = 1;
sizeColors[18][1][32] = 1;
sizeColors[18][1][33] = 1;
sizeColors[18][1][34] = 1;
sizeColors[18][1][36] = 1;
sizeColors[18][2][32] = 1;
sizeColors[18][2][33] = 1;
sizeColors[18][2][34] = 1;
sizeColors[18][2][36] = 1;
sizeColors[18][4][32] = 1;
sizeColors[18][4][33] = 1;
sizeColors[18][4][34] = 1;
sizeColors[18][4][36] = 1;
sizeColors[19][1][30] = 1;
sizeColors[19][1][32] = 1;
sizeColors[19][1][33] = 1;
sizeColors[19][1][34] = 1;
sizeColors[19][1][36] = 1;
sizeColors[19][2][30] = 1;
sizeColors[19][2][32] = 1;
sizeColors[19][2][33] = 1;
sizeColors[19][2][34] = 1;
sizeColors[19][2][36] = 1;
sizeColors[19][3][30] = 1;
sizeColors[19][3][32] = 1;
sizeColors[19][3][33] = 1;
sizeColors[19][3][34] = 1;
sizeColors[19][3][36] = 1;
sizeColors[20][1][30] = 1;
sizeColors[20][1][32] = 1;
sizeColors[20][1][33] = 1;
sizeColors[20][1][34] = 1;
sizeColors[20][1][36] = 1;
sizeColors[20][2][30] = 1;
sizeColors[20][2][32] = 1;
sizeColors[20][2][33] = 1;
sizeColors[20][2][34] = 1;
sizeColors[20][2][36] = 1;
sizeColors[20][3][30] = 1;
sizeColors[20][3][32] = 1;
sizeColors[20][3][33] = 1;
sizeColors[20][3][34] = 1;
sizeColors[20][3][36] = 1;
sizeColors[21][1][30] = 1;
sizeColors[21][1][32] = 1;
sizeColors[21][1][33] = 1;
sizeColors[21][1][34] = 1;
sizeColors[21][1][36] = 1;
sizeColors[22][1][30] = 1;
sizeColors[22][1][32] = 1;
sizeColors[22][1][33] = 1;
sizeColors[22][1][34] = 1;
sizeColors[22][1][36] = 1;
sizeColors[23][1][30] = 1;
sizeColors[23][1][32] = 1;
sizeColors[23][1][33] = 1;
sizeColors[23][1][34] = 1;
sizeColors[23][1][36] = 1;
sizeColors[24][1][32] = 1;
sizeColors[24][1][36] = 1;
sizeColors[25][1][30] = 1;
sizeColors[25][1][32] = 1;
sizeColors[25][1][33] = 1;
sizeColors[25][1][34] = 1;
sizeColors[25][1][36] = 1;
sizeColors[25][4][30] = 1;
sizeColors[25][4][32] = 1;
sizeColors[25][4][33] = 1;
sizeColors[25][4][34] = 1;
sizeColors[25][4][36] = 1;
sizeColors[26][1][30] = 1;
sizeColors[26][1][32] = 1;
sizeColors[26][1][33] = 1;
sizeColors[26][1][34] = 1;
sizeColors[26][1][36] = 1;
sizeColors[26][4][30] = 1;
sizeColors[26][4][32] = 1;
sizeColors[26][4][33] = 1;
sizeColors[26][4][34] = 1;
sizeColors[26][4][36] = 1;
sizeColors[27][1][30] = 1;
sizeColors[27][1][32] = 1;
sizeColors[27][1][33] = 1;
sizeColors[27][1][34] = 1;
sizeColors[27][1][36] = 1;
sizeColors[27][4][30] = 1;
sizeColors[27][4][32] = 1;
sizeColors[27][4][33] = 1;
sizeColors[27][4][34] = 1;
sizeColors[27][4][36] = 1;

var doors= [{},
			{title:"Full Light Door",image:"img/configurator_door_0.gif",image_med:"img/configurator_door_med_0.gif",summary:"Provides full glass or screen from top to bottom allowing maximum light into your home.",x:"218",y:"104",limiters:[1,14,33554431,32767]},
			{title:"Partial Light Door",image:"img/configurator_door_1.gif",image_med:"img/configurator_door_med_1.gif",summary:"Select storm doors offer decorative panels and grills for a more traditional look.",x:"218",y:"144",limiters:[2,28,31,1]},
			{title:"Specialty Door",image:"img/configurator_door_2.gif",image_med:"img/configurator_door_med_2.gif",summary:"Storm doors designed for unique purchase criteria. For example, enhanced energy efficiency, enhanced security or special pet requirements.",x:"218",y:"191",limiters:[4,10,255,24577]}];

var vents = [{},
			{title:"Full Vent",image:"img/configurator_vent_0.gif",image_med:"img/configurator_vent_med_0.gif",summary:"Provides the most ventilation when the insect screen is in place.",x:"443",y:"104",limiters:[7,15,33554431,32767]},
			{title:"Full Vent",image:"img/configurator_vent_0.gif",image_med:"img/configurator_vent_med_0.gif",summary:"Provides the most ventilation when the insect screen is in place.",x:"443",y:"104",limiters:[1,2,33554431,32767]},
			{title:"Dual Vent",image:"img/configurator_vent_1.gif",image_med:"img/configurator_vent_med_1.gif",summary:"Are easy to operate and let you ventilate at the top, bottom or both sections simultaneously.",x:"443",y:"144",limiters:[3,4,255,1]},
			{title:"Single Vent",image:"img/configurator_vent_2.gif",image_med:"img/configurator_vent_med_2.gif",summary:"Offer either retractable insect screen or glass panel that raises or lowers to let in fresh air.",x:"443",y:"187",limiters:[7,8,255,1]},
			{title:"Store-in-Door&trade;",image:"img/configurator_vent_3.gif",image_med:"img/configurator_vent_med_3.gif",summary:"Doors let you slide the glass panel or insect screen into the bottom of the door, out of site.",x:"443",y:"231",limiters:[2,16,3,1]}];

var colors = [{},
			  {title:"White",image:"img/configurator_color_0.gif",image_med:"img/configurator_color_med_0.gif",limiters:[7,30,1,32767]},
			  {title:"Almond",image:"img/configurator_color_1.gif",image_med:"img/configurator_color_med_1.gif",limiters:[3,14,2,32767]},
			  {title:"Sandtone&reg;",image:"img/configurator_color_2.gif",image_med:"img/configurator_color_med_2.gif",limiters:[1,14,4,32767]},
			  {title:"Bronze",image:"img/configurator_color_4.gif",image_med:"img/configurator_color_med_4.gif",limiters:[3,14,8,32767]},
			  {title:"Forest Green",image:"img/configurator_color_5.gif",image_med:"img/configurator_color_med_5.gif",limiters:[3,14,16,32767]},
			  {title:"Terratone&reg;",image:"img/configurator_color_3.gif",image_med:"img/configurator_color_med_3.gif",limiters:[1,14,32,32767]},
			  {title:"Wineberry",image:"img/configurator_color_6.gif",image_med:"img/configurator_color_med_6.gif",limiters:[1,14,64,32767]},
			  {title:"Black",image:"img/configurator_color_7.gif",image_med:"img/configurator_color_med_7.gif",limiters:[1,14,128,32767]},
			  {title:"Eggshell",image:"img/configurator_color_8.gif",image_med:"img/configurator_color_med_8.gif",limiters:[1,2,256,1]},
			  {title:"Coffee Bean",image:"img/configurator_color_9.gif",image_med:"img/configurator_color_med_9.gif",limiters:[1,2,512,1]},
			  {title:"Clay Canyon",image:"img/configurator_color_10.gif",image_med:"img/configurator_color_med_10.gif",limiters:[1,2,1024,1]},
			  {title:"Dark Ash",image:"img/configurator_color_11.gif",image_med:"img/configurator_color_med_11.gif",limiters:[1,2,2048,1]},
			  {title:"Cinnamon Toast",image:"img/configurator_color_12.gif",image_med:"img/configurator_color_med_12.gif",limiters:[1,2,4096,1]},
			  {title:"Elephant",image:"img/configurator_color_13.gif",image_med:"img/configurator_color_med_13.gif",limiters:[1,2,8192,1]},
			  {title:"Sierra Bronze	",image:"img/configurator_color_14.gif",image_med:"img/configurator_color_med_14.gif",limiters:[1,2,16384,1]},
			  {title:"Mystic Gray",image:"img/configurator_color_15.gif",image_med:"img/configurator_color_med_15.gif",limiters:[1,2,32768,1]},
			  {title:"Moss",image:"img/configurator_color_16.gif",image_med:"img/configurator_color_med_16.gif",limiters:[1,2,65536,1]},
			  {title:"Hot Chocolate",image:"img/configurator_color_17.gif",image_med:"img/configurator_color_med_17.gif",limiters:[1,2,131072,1]},
			  {title:"Sage",image:"img/configurator_color_18.gif",image_med:"img/configurator_color_med_18.gif",limiters:[1,2,262144,1]},
			  {title:"Cappuccino",image:"img/configurator_color_19.gif",image_med:"img/configurator_color_med_19.gif",limiters:[1,2,524288,1]},
			  {title:"Burst Rust",finish:"Textured Finish",image:"img/configurator_color_20.gif",image_med:"img/configurator_color_med_20.gif",limiters:[1,2,1048576,1]},
			  {title:"Copper Pebble",finish:"Textured Finish",image:"img/configurator_color_21.gif",image_med:"img/configurator_color_med_21.gif",limiters:[1,2,2097152,1]},
			  {title:"Pewter Pebble",finish:"Textured Finish",image:"img/configurator_color_22.gif",image_med:"img/configurator_color_med_22.gif",limiters:[1,2,4194304,1]},
			  {title:"Champagne",finish:"Anodized Finish",image:"img/configurator_color_23.gif",image_med:"img/configurator_color_med_23.gif",limiters:[1,2,8388608,1]},
			  {title:"Medium Bronze",finish:"Anodized Finish",image:"img/configurator_color_24.gif",image_med:"img/configurator_color_med_24.gif",limiters:[1,2,16777216,1]}];

var glass = [{},
			{title:"Standard",image:"img/configurator_glass_0.gif",image_med:"img/configurator_glass_med_0.gif",image_cs:"img/configurator_glass_cs_0.gif",image_cs_med:"img/configurator_glass_cs_med_0.gif",limiters:[7,30,33554431,1]},
			{title:"Curved Etching",image:"img/configurator_glass_1.gif",image_med:"img/configurator_glass_med_1.gif",image_cs:"img/configurator_glass_cs_1.gif",image_cs_med:"img/configurator_glass_cs_med_1.gif",limiters:[1,2,255,2]},
			{title:"Straight Brass",image:"img/configurator_glass_2.gif",image_med:"img/configurator_glass_med_2.gif",image_cs:"img/configurator_glass_cs_2.gif",image_cs_med:"img/configurator_glass_cs_med_2.gif",limiters:[1,2,255,4]},
			{title:"Straight Nickel",image:"img/configurator_glass_3.gif",image_med:"img/configurator_glass_med_3.gif",image_cs:"img/configurator_glass_cs_3.gif",image_cs_med:"img/configurator_glass_cs_med_3.gif",limiters:[1,2,255,8]},
			{title:"Oval Brass with Etching",image:"img/configurator_glass_4.gif",image_med:"img/configurator_glass_med_4.gif",image_cs:"img/configurator_glass_cs_4.gif",image_cs_med:"img/configurator_glass_cs_med_4.gif",limiters:[1,2,255,16]},
			{title:"Oval Nickel with Etching",image:"img/configurator_glass_5.gif",image_med:"img/configurator_glass_med_5.gif",image_cs:"img/configurator_glass_cs_5.gif",image_cs_med:"img/configurator_glass_cs_med_5.gif",limiters:[1,2,255,32]},
			{title:"Diamond Lights",image:"img/configurator_glass_6.gif",image_med:"img/configurator_glass_med_6.gif",image_cs:"img/configurator_glass_cs_6.gif",image_cs_med:"img/configurator_glass_cs_med_6.gif",limiters:[1,2,255,64]},
			{title:"Curved Brass",image:"img/configurator_glass_7.gif",image_med:"img/configurator_glass_med_7.gif",image_cs:"img/configurator_glass_cs_7.gif",image_cs_med:"img/configurator_glass_cs_med_7.gif",limiters:[1,2,255,128]},
			{title:"Curved Nickel",image:"img/configurator_glass_8.gif",image_med:"img/configurator_glass_med_8.gif",image_cs:"img/configurator_glass_cs_8.gif",image_cs_med:"img/configurator_glass_cs_med_8.gif",limiters:[1,2,255,256]},
			{title:"Arched Brass",image:"img/configurator_glass_9.gif",image_med:"img/configurator_glass_med_9.gif",image_cs:"img/configurator_glass_cs_9.gif",image_cs_med:"img/configurator_glass_cs_med_9.gif",limiters:[1,2,255,512]},
			{title:"Arched Nickel",image:"img/configurator_glass_10.gif",image_med:"img/configurator_glass_med_10.gif",image_cs:"img/configurator_glass_cs_10.gif",image_cs_med:"img/configurator_glass_cs_med_10.gif",limiters:[1,2,255,1024]},
			{title:"Regency",image:"img/configurator_glass_11.gif",image_med:"img/configurator_glass_med_11.gif",image_cs:"img/configurator_glass_cs_11.gif",image_cs_med:"img/configurator_glass_cs_med_11.gif",limiters:[1,2,255,2048]},
			{title:"Grey Tint",image:"img/configurator_glass_12.gif",image_med:"img/configurator_glass_med_12.gif",image_cs:"img/configurator_glass_cs_12.gif",image_cs_med:"img/configurator_glass_cs_med_12.gif",limiters:[1,2,255,4096]},
			{title:"Laminated Safety Glass",image:"img/configurator_glass_13.gif",image_med:"img/configurator_glass_med_13.gif",image_cs:"img/configurator_glass_cs_13.gif",image_cs_med:"img/configurator_glass_cs_med_13.gif",limiters:[4,0,255,8192]},
			{title:"Thermal Insulating Glass",image:"img/configurator_glass_14.gif",image_med:"img/configurator_glass_med_14.gif",image_cs:"img/configurator_glass_cs_14.gif",image_cs_med:"img/configurator_glass_cs_med_14.gif",limiters:[4,2,255,16384]}];
			
var handles = [{},
			{title:"Contemporary Brass",image:"img/handles/ContemporaryBrass.gif",image_med:"img/handles/ContemporaryBrassMED.jpg"},
			{title:"Contemporary Nickel",image:"img/handles/ContemporaryNickel.gif",image_med:"img/handles/ContemporaryNickelMED.jpg"},
			{title:"Contemporary Oil Rubbed Bronze",image:"img/handles/ContemporaryORB.gif",image_med:"img/handles/ContemporaryORBMED.jpg"},
			{title:"Traditional Brass",image:"img/handles/TraditionalBrass.gif",image_med:"img/handles/TraditionalBrassMED.jpg"},
			{title:"Traditional Nickel",image:"img/handles/TraditionalNickel.gif",image_med:"img/handles/TraditionalNickelMED.jpg"},
			{title:"Traditional Oil Rubbed Bronze",image:"img/handles/TraditionalORB.gif",image_med:"img/handles/TraditionalORBMED.jpg"},
			{title:"Estate&trade; Brass",image:"img/handles/ClassicBrass.gif",image_med:"img/handles/ClassicBrassMED.jpg"},
			{title:"Estate&trade; Nickel",image:"img/handles/ClassicNickel.gif",image_med:"img/handles/ClassicNickelMED.jpg"},
			{title:"Estate&trade; Oil Rubbed Bronze",image:"img/handles/ClassicORB.gif",image_med:"img/handles/ClassicORBMED.jpg"},
			{title:"Modern",image:"img/handles/Modern.gif",image_med:"img/handles/ModernMED.jpg"},
			{title:"Traditional Brass Knob",image:"img/handles/TraditionalBrassKnob.gif",image_med:"img/handles/TraditionalBrassKnobMED.jpg"},
			{title:"Crossbuck Black Knob",image:"img/handles/CrossbuckBrassKnob.gif",image_med:"img/handles/CrossbuckBrassKnobMED.jpg"},
			{title:"Colonial Style Brass",image:"img/handles/ColonialBrass.gif",image_med:"img/handles/ColonialBrassMED.jpg"},
			{title:"Triple-Track Brass",image:"img/handles/TripleTrackBrass.gif",image_med:"img/handles/TripleTrackBrassMED.jpg"},
			{title:"Contemporary Black Push-Button",image:"img/handles/ContemporaryPushButton.gif",image_med:"img/handles/ContemporaryPushButtonMED.jpg"},
			{title:"Black Push Button",image:"img/handles/BlackPushButton.gif",image_med:"img/handles/BlackPushButtonMED.jpg"}];
			
var sweeps = [{},
			{title:"Nickel",image:"img/sweeps/dme_sweep_1.gif",image_med:"img/sweeps/dme_sweep_med_1.gif"},
			{title:"Matching",image:"img/sweeps/dme_sweep_2.gif",image_med:"img/sweeps/dme_sweep_med_2.gif"},
			{title:"Brass",image:"img/sweeps/dme_sweep_3.gif",image_med:"img/sweeps/dme_sweep_med_3.gif"}];
			
var handle_groups = [[0],[0,1,2,3],[0,1,2,3],[0,1,2,3],[0,4,5,6],[0,4,5,6],[0,1,2,3,4,5,6,7,8,9,10],[0,7,8],[0,7,8],[0,4,5,6],[0,4,5,6],[0,7,8],[0,11],[0,12],[0,4,5],[0,4,5],[0,4,5],[0,13],[0,14],[0,15],[0,15],[0,15],[0,15],[0,15],[0,15],[0,16],[0,16],[0,16],[0,4,5,6]];


	var mqs_object = {
		"door_id_1":{
			"handle_1":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","4000 Fullview Safety with Brass Handle"],
				["Product Config:","Single Door"]
			],
			"handle_2":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","4000 Fullview Safety with Nickel Handle"],
				["Product Config:","Single Door"]
			],
			"handle_3":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","4000 Fullview Safety with Oil Rubbed Bronze Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_2":{
			"handle_1":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","4000 Fullview with Insulating Glass with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_2":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","4000 Fullview with Insulating Glass with Nickel Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_3":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","4000 Fullview with Insulating  Glass with Oil Rubbed Bronze Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_3":{
			"handle_1":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","4000 Fullview with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_2":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","4000 Fullview with Nickel Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_3":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","4000 Fullview with Oil Rubbed Bronze Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_4":{
			"handle_4":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Decorative"],
				["Product Style:","3000 Etched Glass with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_5":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Decorative"],
				["Product Style:","3000 Etched Glass with Nickel Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_6":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Decorative"],
				["Product Style:","3000 Etched Glass with Oil rubbed Bronze Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_5":{
			"handle_4":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","3000 Fullview with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_5":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","3000 Fullview with Nickel Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_6":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","3000 Fullview with Oil Rubbed Bronze Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_7":{
			"handle_7":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Decorative"],
				["Product Style:","2000 Etched Glass with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_8":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Decorative"],
				["Product Style:","2000 Etched Glass with Nickel Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_8":{
			"handle_7":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","2000 Fullview with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_8":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","2000 Fullview with Nickel Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_9":{
			"handle_4":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Ventilating"],
				["Product Style:","3000 Tru-Ease with TruScene with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_5":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Ventilating"],
				["Product Style:","3000 Tru-Ease with TruScene with Nickel Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_6":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Ventilating"],
				["Product Style:","3000 Tru-Ease with TruScene with Oil Rubbed Bronze Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_10":{
			"handle_4":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Ventilating"],
				["Product Style:","3000 Self-Storing with Retractable Screen and Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_5":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Ventilating"],
				["Product Style:","3000 Self-Storing with Retractable Screen and Nickel Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_6":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Ventilating"],
				["Product Style:","3000 Self-Storing with Retractable Screen and Oil Rubbed Bronze Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_11":{
			"handle_7":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Ventilating"],
				["Product Style:","2000 Self-Storing with Retractable Screen with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_8":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Ventilating"],
				["Product Style:","2000 Self-Storing with Retractable Screen with Nickel Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_12":{
			"handle_11":[
				["Product Category:","Storm Door"],
				["Product:","Forever by Andersen"],
				["Product Type:","Ventilating"],
				["Product Style:","Traditional"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_13":{
			"handle_12":[
				["Product Category:","Storm Door"],
				["Product:","Forever by Andersen"],
				["Product Type:","Ventilating"],
				["Product Style:","Crossbuck"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_14":{
			"handle_4":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","400 Colonial Self Storing with Retractable Screen with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_5":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","400 Colonial Self Storing with Retractable Screen with Nickel Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_15":{
			"handle_4":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","400 Self Storing with Retractable Screen with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_5":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","400 Self Storing with Retractable Screen with Nickel Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_16":{
			"handle_4":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","400 Traditional Self-Storing with Retractable Screen with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_5":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","400 Traditional Self-Storing with Retractable Screen with Nickel Hardware"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_17":{
			"handle_13":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","300 Colonial Triple Track"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_18":{
			"handle_14":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","300 Triple Track"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_19":{
			"handle_15":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","200 Self-Storing with Retractable Screen"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_20":{
			"handle_15":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","200 Triple Track"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_21":{
			"handle_15":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","200 Traditional"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_22":{
			"handle_15":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","200 Crossbuck"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_23":{
			"handle_15":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","100 Self-Storing"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_24":{
			"handle_15":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","K900 Pet Door"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_25":{
			"handle_16":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Fullview"],
				["Product Style:","75 Fullview"],
				["Product Config:","Single Door"]
			]
		},	
		"door_id_26":{
			"handle_16":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","75 Self-Storing"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_27":{
			"handle_16":[
				["Product Category:","Storm Door"],
				["Product:","EMCO"],
				["Product Type:","Ventilating"],
				["Product Style:","75 Crossbuck"],
				["Product Config:","Single Door"]
			]
		},
		"door_id_28":{
			"handle_4":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","3000 Fullview with Brass Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_5":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","3000 Fullview with Nickel Hardware"],
				["Product Config:","Single Door"]
			],
			"handle_6":[
				["Product Category:","Storm Door"],
				["Product:","Andersen"],
				["Product Type:","Fullview"],
				["Product Style:","3000 Fullview with Oil Rubbed Bronze Hardware"],
				["Product Config:","Single Door"]
			]
		}
	};


var standard_color_button_rollover = false;
var standard_color_div_rollover = false;
var premium_color_button_rollover = false;
var premium_color_div_rollover = false;
var designer_finish_button_rollover = false;
var designer_finish_div_rollover = false;
var standard_glass_button_rollover = false;
var standard_glass_div_rollover = false;
var designer_glass_button_rollover = false;
var designer_glass_div_rollover = false;

var highlight_color_index = -1;

/*
function highlightButtonOver(image,path,div){
	swapImage(image,path);
	var text_div = document.getElementById(div);
	if (text_div != null){
		text_div.style.visibility = "visible";
	}
}
*/

/*
function highlightButtonOff(image,path,div){
	swapImage(image,path);
	var text_div = document.getElementById(div);
	if (text_div != null){
		text_div.style.visibility = "hidden";
	}
}
*/

function highlightButtonOver(type,index,column){
	//'door_1_btn_highlight','img/configurator_highlight_bg.png','door_1_learn_more'
	var available = 1;
	if (type=="door"){
		available = (1<<(index-1))&available_groups[0];
	} else if (type=="vent"){
		available = (1<<(index-1))&available_groups[1];
	} else if (type=="color"){
		available = (1<<(index-1))&available_groups[2];
	} else if (type=="glass"){
		available = (1<<(index-1))&available_groups[3];
	}
	if (available){
		if (type=="door"){
			swapImage(type+"_"+index+"_btn_highlight",'img/configurator_highlight_column_1_'+index+'.gif');
		} else {
			swapImage(type+"_"+index+"_btn_highlight",'img/configurator_highlight_column_2_'+index+'.gif');
		}
		var text_div = document.getElementById(type+"_"+index+"_learn_more");
		if (text_div != null){
			text_div.style.visibility = "visible";
		}
	}
}
 
function highlightButtonOff(type,index){
	//'door_1_btn_highlight','img/configurator_highlight_bg.png','door_1_learn_more'
	swapImage(type+"_"+index+"_btn_highlight",'img/spacer.gif');
	var text_div = document.getElementById(type+"_"+index+"_learn_more");
	if (text_div != null){
		text_div.style.visibility = "hidden";
	}
}
 
function swapImage(image,path){
	var img = document.getElementById(image);
	if (img != null && path != null && path != ""){
		img.src = path;
	}
}

function setAvailableConfigurationTools(){
	//alert("Setting Available Configuration Tools: "+selected_door+" "+selected_vent+" "+selected_color+" "+selected_glass);
	var updated_available_groups = [7,30,33554431,32767];
	if (selected_door > 0){
		updated_available_groups[0] = updated_available_groups[0] & doors[selected_door].limiters[0];
		updated_available_groups[1] = updated_available_groups[1] & doors[selected_door].limiters[1];
		updated_available_groups[2] = updated_available_groups[2] & doors[selected_door].limiters[2];
		updated_available_groups[3] = updated_available_groups[3] & doors[selected_door].limiters[3];
	}
	if (selected_vent > 0){
		updated_available_groups[0] = updated_available_groups[0] & vents[selected_vent].limiters[0];
		updated_available_groups[1] = updated_available_groups[1] & vents[selected_vent].limiters[1];
		updated_available_groups[2] = updated_available_groups[2] & vents[selected_vent].limiters[2];
		updated_available_groups[3] = updated_available_groups[3] & vents[selected_vent].limiters[3];
	}
	if (selected_color > 0){
		updated_available_groups[0] = updated_available_groups[0] & colors[selected_color].limiters[0];
		updated_available_groups[1] = updated_available_groups[1] & colors[selected_color].limiters[1];
		updated_available_groups[2] = updated_available_groups[2] & colors[selected_color].limiters[2];
		updated_available_groups[3] = updated_available_groups[3] & colors[selected_color].limiters[3];
	}
	if (selected_glass > 0){
		updated_available_groups[0] = updated_available_groups[0] & glass[selected_glass].limiters[0];
		updated_available_groups[1] = updated_available_groups[1] & glass[selected_glass].limiters[1];
		updated_available_groups[2] = updated_available_groups[2] & glass[selected_glass].limiters[2];
		updated_available_groups[3] = updated_available_groups[3] & glass[selected_glass].limiters[3];
	}
	available_groups[0] = updated_available_groups[0];
	available_groups[1] = updated_available_groups[1];
	available_groups[2] = updated_available_groups[2];
	available_groups[3] = updated_available_groups[3];
	//"#454342";
	//"#454342";
//	alert(available_groups[0]);
	var btn_text_field;
	var cover_div;
	var btn_name;
	var cover_name;
	var bit;
	
	for (i=1;i<4;i++){
		btn_name = "door_"+i+"_btn_text";
		cover_name = "door_"+i+"_cover";
		btn_text_field = document.getElementById(btn_name);
		cover_div = document.getElementById(cover_name);
		bit = 1<<(i-1);
		if (available_groups[0] & bit){
			btn_text_field.style.color = "#454342";
			cover_div.style.display = "none";
		} else {
			btn_text_field.style.color = "#666666";
			cover_div.style.display = "block";
		}
	}

	for (i=2;i<6;i++){
		btn_name = "vent_"+i+"_btn_text";
		cover_name = "vent_"+i+"_cover";
		btn_text_field = document.getElementById(btn_name);
		cover_div = document.getElementById(cover_name);
		bit = 1<<(i-1);
		if (available_groups[1] & bit){
			btn_text_field.style.color = "#454342";
			cover_div.style.display = "none";
		} else {
			btn_text_field.style.color = "#666666";
			cover_div.style.display = "block";
		}
	}
	for (i=1;i<4;i++){
		btn_name = "color_"+i+"_btn_text";
		cover_name = "color_"+i+"_cover";
		btn_text_field = document.getElementById(btn_name);
		cover_div = document.getElementById(cover_name);
		if (i==1){
			bit=255;
		} else if (i==2){
			bit=1048320;
		} else {
			bit=32505856;
		}
		if (available_groups[2] & bit){
			btn_text_field.style.color = "#454342";
			cover_div.style.display = "none";
		} else {
			btn_text_field.style.color = "#666666";
			cover_div.style.display = "block";
		}
	}
	for (i=1;i<3;i++){
		btn_name = "glass_"+i+"_btn_text";
		cover_name = "glass_"+i+"_cover";
		btn_text_field = document.getElementById(btn_name);
		cover_div = document.getElementById(cover_name);
		if (i==1){
			bit=24577;
		} else if (i==2){
			bit=8190;
		}
		if (available_groups[3] & bit){
			btn_text_field.style.color = "#454342";
			cover_div.style.display = "none";
		} else {
			btn_text_field.style.color = "#666666";
			cover_div.style.display = "block";
		}
	}
}

function resetConfigurator(){
	var l_div = document.getElementById("customizer_cover");
	if (l_div != null){
		l_div.style.display = "none";
		l_div = document.getElementById("main_customizer");
		l_div.style.display = "block";
	}
	resetDoors();
	resetVents();
	resetColors();
	resetGlass();
}

function selectDoor(index){
	var door_sel = document.getElementById("door_selected");
	var door_sel2 = document.getElementById("door_selector");

	available = (1<<(index-1))&available_groups[0];

	if (available){
		selected_door = index;
		if (door_sel != null && door_sel2 != null){
			var door_image = document.getElementById("door_image");
			if (door_image != null) {
				door_image.src = doors[index].image;
			}
			var door_text = document.getElementById("door_selected_text");
			if (door_text != null){
				door_text.innerHTML = "Your Choice: <span style=\"color:#454342\">"+doors[index].title+"</span>";
			}
	
			door_sel.style.display="inline";
			door_sel2.style.display="none";
			updateSearch();
		}
	}
}

function resetDoors(){
	var door_sel = document.getElementById("door_selected")
	var door_sel2 = document.getElementById("door_selector")
	selected_door = 0;
	if (door_sel != null && door_sel2 != null){
		door_sel.style.display="none";
		door_sel2.style.display="inline";
		updateSearch();
	}
}

function selectVent(index){
	var vent_sel = document.getElementById("vent_selected")
	var vent_sel2 = document.getElementById("vent_selector")
	selected_vent = index;

	available = (1<<(index-1))&available_groups[1];

	if (available){
		if (vent_sel != null && vent_sel2 != null){
			var vent_image = document.getElementById("vent_image");
			if (vent_image != null) {
				vent_image.src = vents[index].image;
			}
			var vent_text = document.getElementById("vent_selected_text");
			if (vent_text != null){
				vent_text.innerHTML = "Your Choice: <span style=\"color:#454342\">"+vents[index].title+"</span>";
			}
	
			vent_sel.style.display="inline";
			vent_sel2.style.display="none";
			updateSearch();
		}
	}
}

function resetVents(){
	selected_vent = 0;
	var vent_sel = document.getElementById("vent_selected")
	var vent_sel2 = document.getElementById("vent_selector")
	if (vent_sel != null && vent_sel2 != null){
		vent_sel.style.display="none";
		vent_sel2.style.display="inline";
		updateSearch();
	}
}

function showDoorInfo(index){
	var door_info_window = document.getElementById("door_info_window");
	if (door_info_window != null){
		var door_image = document.getElementById("door_info_window_image");
		if (door_image != null) door_image.src = doors[index].image_med;
		var door_text = document.getElementById("door_info_window_text");
		if (door_text != null)
			door_text.innerHTML = "<strong>"+doors[index].title+"</strong><br /><br />"+doors[index].summary;
		door_info_window.style.top = doors[index].y+"px";
		door_info_window.style.left = doors[index].x+"px";
		door_info_window.style.display = "block";
	}
}

function hideDoorInfo(){
	var door_info_window = document.getElementById("door_info_window");
	if (door_info_window != null){
		door_info_window.style.display = "none";
		var door_image = document.getElementById("door_info_window_image");
		if (door_image != null) door_image.src = "img/spacer.gif";
	}
}

function showVentInfo(index){
	var vent_info_window = document.getElementById("door_info_window");
	if (vent_info_window != null){
		var vent_image = document.getElementById("door_info_window_image");
		if (vent_image != null) vent_image.src = vents[index].image_med;
		var vent_text = document.getElementById("door_info_window_text");
		if (vent_text != null)
			vent_text.innerHTML = "<strong>"+vents[index].title+"</strong><br /><br />"+vents[index].summary;
		vent_info_window.style.top = vents[index].y+"px";
		vent_info_window.style.left = vents[index].x+"px";
		vent_info_window.style.display = "block";
	}
}

function hideVentInfo(){
	var vent_info_window = document.getElementById("door_info_window");
	if (vent_info_window != null){
		vent_info_window.style.display = "none";
	}
}

function showStandardColors(curtarget){
//	alert("showing "+curtarget);
	var available = (255&available_groups[2]);
	if (available){
		var i,color_div,value;
	//	alert(available_groups[2]);
		for (i=1;i<=8;i++){
			value = (1<<(i-1));
			color_div = document.getElementById("color_swatch_"+i);
			if (color_div != null){
				if (available_groups[2]&value){
					color_div.style.display = "block";
				} else {
					color_div.style.display = "none";
				}
			}
		}
		var st_clr_div = document.getElementById("standard_color_selector");
		if (st_clr_div != null){
			if (curtarget == "button"){
				standard_color_button_rollover = true;
			} else {
				standard_color_div_rollover = true;
			}
			st_clr_div.style.display="block";
			swapImage("color_0_btn_highlight","img/configurator_highlight_column_3_1.gif");
		}
	}
}

function checkHideStandardColors(curtarget){
//	alert("hiding "+curtarget);
	var st_clr_div = document.getElementById("standard_color_selector");
	if (st_clr_div != null){
		if (curtarget == "button"){
			standard_color_button_rollover = false;
		} else {
			standard_color_div_rollover = false;
		}
		if (!(standard_color_button_rollover && standard_color_div_rollover)){
			st_clr_div.style.display="none";
			swapImage("color_0_btn_highlight","img/spacer.gif");
		}
	}
}

function selectColor(index){
	var sc = document.getElementById("configurator_window");
	var color_sel = document.getElementById("color_selected")
	var color_sel2 = document.getElementById("color_selector")
	var color_image = document.getElementById("color_image");
	var color_text = document.getElementById("color_selected_text");
	if (sc != null && sc.style.display != "none"){
		color_image = document.getElementById("cs_color_image");
		color_text = document.getElementById("cs_color_selected_text");
		selected_color = index;
		cs_selected_color = index;
		if (color_image != null) {
			color_image.src = colors[index].image;
		}
		if (color_text != null){
			color_text.innerHTML = "Your Choice: <span style=\"color:#454342\">"+colors[index].title+"</span>";
		}
		color_sel = document.getElementById("cs_standard_color_selector");
		if (color_sel != null){
			color_sel.style.display="none";
		}

	} else if (color_sel != null && color_sel2 != null){
		selected_color = index;
		cs_selected_color = index;
		if (color_image != null) {
			color_image.src = colors[index].image;
		}
		if (color_text != null){
			color_text.innerHTML = "Your Choice: <span style=\"color:#454342\">"+colors[index].title+"</span>";
		}

		color_sel.style.display="inline";
		color_sel2.style.display="none";
		standard_color_button_rollover = false;
		checkHideStandardColors("div");
		premium_color_button_rollover = false;
		checkHidePremiumColors("div");
		designer_finishes_button_rollover = false;
		checkHideDesignerFinishes("div");
		updateSearch();
	}
}

function resetColors(){
	selected_color = 0;
	cs_selected_color = 0;
	var door_sel = document.getElementById("color_selected")
	var door_sel2 = document.getElementById("color_selector")
	if (door_sel != null && door_sel2 != null){
		door_sel.style.display="none";
		door_sel2.style.display="inline";
		updateSearch();
	}
}

function setStandardColorText(index){
	var sc = document.getElementById("configurator_window");
	var txtfield = document.getElementById("standard_color_selector_text");
	if (sc != null && sc.style.display != "none"){
		txtfield = document.getElementById("cs_standard_color_selector_text");
	}
	if (txtfield != null){
		highlight_color_index = index;
		txtfield.innerHTML = "Color: <span style=\"color:#000000\">"+colors[index].title+"</span>";
	}
}

function hideStandardColorText(index){
	var sc = document.getElementById("configurator_window");
	var txtfield = document.getElementById("standard_color_selector_text");
	if (sc != null && sc.style.display != "none"){
		txtfield = document.getElementById("cs_standard_color_selector_text");
	}
	var txtfield = document.getElementById("standard_color_selector_text");
	if (txtfield != null && highlight_color_index == index){
		highlight_color_index = -1;
		txtfield.innerHTML = "Color:";
	}
}

function showPremiumColors(curtarget){
//	alert("showing "+curtarget);
	var available = (1048320&available_groups[2]);
	if (available){
		var st_clr_div = document.getElementById("premium_color_selector");
		if (st_clr_div != null){
			if (curtarget == "button"){
				premium_color_button_rollover = true;
			} else {
				premium_color_div_rollover = true;
			}
			st_clr_div.style.display="block";
			swapImage("color_1_btn_highlight","img/configurator_highlight_column_3_2.gif");
		}
	}
}

function checkHidePremiumColors(curtarget){
//	alert("hiding "+curtarget);
	var st_clr_div = document.getElementById("premium_color_selector");
	if (st_clr_div != null){
		if (curtarget == "button"){
			premium_color_button_rollover = false;
		} else {
			premium_color_div_rollover = false;
		}
		if (!(premium_color_button_rollover && premium_color_div_rollover)){
			st_clr_div.style.display="none";
			swapImage("color_1_btn_highlight","img/spacer.gif");
		}
	}
}

function setPremiumColorText(index){
	var txtfield = document.getElementById("premium_color_selector_text");
	if (txtfield != null){
		highlight_color_index = index;
		txtfield.innerHTML = "Color: <span style=\"color:#000000\">"+colors[index].title+"</span>";
	}
}

function hidePremiumColorText(index){
	var txtfield = document.getElementById("premium_color_selector_text");
	if (txtfield != null && highlight_color_index == index){
		highlight_color_index = -1;
		txtfield.innerHTML = "Color:";
	}
}


function showDesignerFinishes(curtarget){
	var available = (32505856&available_groups[2]);
	if (available){
		var st_clr_div = document.getElementById("designer_finish_selector");
		if (st_clr_div != null){
			if (curtarget == "button"){
				designer_finish_button_rollover = true;
			} else {
				designer_finish_div_rollover = true;
			}
			st_clr_div.style.display="block";
			swapImage("color_2_btn_highlight","img/configurator_highlight_column_3_3.gif");
		}
	}
}

function checkHideDesignerFinishes(curtarget){
//	alert("hiding "+curtarget);
	var st_clr_div = document.getElementById("designer_finish_selector");
	if (st_clr_div != null){
		if (curtarget == "button"){
			designer_finish_button_rollover = false;
		} else {
			designer_finish_div_rollover = false;
		}
		if (!(designer_finish_button_rollover && designer_finish_div_rollover)){
			st_clr_div.style.display="none";
			swapImage("color_2_btn_highlight","img/spacer.gif");
		}
	}
}

function setDesignerFinishText(index){
	var txtfield = document.getElementById("designer_finish_selector_text");
	if (txtfield != null){
		highlight_color_index = index;
		txtfield.innerHTML = "Finish:<br /><span style=\"color:#000000\">"+colors[index].title+"</span> <span style=\"color:#000000;font-weight:normal;\">"+colors[index].finish+"</span>";
	}
}

function hideDesignerFinishText(index){
	var txtfield = document.getElementById("designer_finish_selector_text");
	if (txtfield != null && highlight_color_index == index){
		highlight_color_index = -1;
		txtfield.innerHTML = "Finish:";
	}
}


function showDecorativeGlass(curtarget){
	var available = (8190&available_groups[3]);
	if (available){
		var st_clr_div = document.getElementById("dglass_selector");
		if (st_clr_div != null){
			if (curtarget == "button"){
				designer_glass_button_rollover = true;
			} else {
				designer_glass_button_rollover = true;
			}
			st_clr_div.style.display="block";
			swapImage("glass_1_btn_highlight","img/configurator_highlight_column_4_1.gif");
		}
		checkHideStandardGlass("div");
	}
}

function checkHideDecorativeGlass(curtarget){
	var st_clr_div = document.getElementById("dglass_selector");
	if (st_clr_div != null){
		if (curtarget == "button"){
			designer_glass_button_rollover = false;
		} else {
			designer_glass_div_rollover = false;
		}
		if (!(designer_glass_button_rollover && designer_glass_div_rollover)){
			st_clr_div.style.display="none";
			swapImage("glass_1_btn_highlight","img/spacer.gif");
		}
	}
}

function showStandardGlass(curtarget){
	var available = (24577&available_groups[3]);
	if (available){
		var glass_div = document.getElementById("glass_type_1");
		if (available_groups[3]&1){
			glass_div.style.display = "block";
		} else {
			glass_div.style.display = "none";
		}
		glass_div = document.getElementById("glass_type_14");
		if (available_groups[3]&8192){
			glass_div.style.display = "block";
		} else {
			glass_div.style.display = "none";
		}
		glass_div = document.getElementById("glass_type_15");
		if (available_groups[3]&16384){
			glass_div.style.display = "block";
		} else {
			glass_div.style.display = "none";
		}

		var st_clr_div = document.getElementById("sglass_selector");
		if (st_clr_div != null){
			if (curtarget == "button"){
				standard_glass_button_rollover = true;
			} else {
				standard_glass_div_rollover = true;
			}
			st_clr_div.style.display="block";
			swapImage("glass_0_btn_highlight","img/configurator_highlight_column_4_2.gif");
		}
		checkHideDecorativeGlass("div");
	}
}

function checkHideStandardGlass(curtarget){
	var st_clr_div = document.getElementById("sglass_selector");
	if (st_clr_div != null){
		if (curtarget == "button"){
			standard_glass_button_rollover = false;
		} else {
			standard_glass_div_rollover = false;
		}
		if (!(standard_glass_button_rollover && standard_glass_div_rollover)){
			st_clr_div.style.display="none";
			swapImage("glass_0_btn_highlight","img/spacer.gif");
		}
	}
}

function selectGlass(index){
	var glass_sel = document.getElementById("glass_selected")
	var glass_sel2 = document.getElementById("glass_selector")

	selected_glass = index;
	if (glass_sel != null && glass_sel2 != null){
		var glass_image = document.getElementById("glass_image");
		if (glass_image != null) {
			glass_image.src = glass[index].image;
		}
		var glass_text = document.getElementById("glass_selected_text");
		if (glass_text != null){
			glass_text.innerHTML = "Your Choice: <span style=\"color:#454342\">"+glass[index].title+"</span>";
		}

		glass_sel.style.display="inline";
		glass_sel2.style.display="none";

		checkHideDecorativeGlass("div");
		checkHideStandardGlass("div");
		updateSearch();
	}
}

function resetGlass(){
	selected_glass = 0;
	var door_sel = document.getElementById("glass_selected")
	var door_sel2 = document.getElementById("glass_selector")
	if (door_sel != null && door_sel2 != null){
		door_sel.style.display="none";
		door_sel2.style.display="inline";
		updateSearch();
	}
}

function showStandardGlassPreview(index){
	var door_image = document.getElementById("sglass_window_image");
	if (door_image != null) door_image.src = glass[index].image_med;
}

function hideStandardGlassPreview(index){
//	var door_image = document.getElementById("sglass_window_image");
//	if (door_image != null) door_image.src = glass[1].image_med;
}

function showDesignerGlassPreview(index){
	var door_image = document.getElementById("dglass_window_image");
	if (door_image != null) door_image.src = glass[index].image_med;
}

function hideDesignerGlassPreview(index){
//	var door_image = document.getElementById("dglass_window_image");
//	if (door_image != null) door_image.src = "img;
}

function checkSwapPriceImage(setting,image,path){
	var img = document.getElementById(image);
	if (setting != price_setting && img != null && path != null && path != ""){
		img.src = path;
	}
}

function showPricesHighToLow(){
	price_setting = "high";
	swapImage("price_high_to_low","img/btn_price_high_to_low.gif");
	swapImage("price_low_to_high","img/btn_price_low_to_high_dim.gif");
	updateSearch();
}

function showPricesLowToHigh(){
	price_setting = "low";
	swapImage("price_high_to_low","img/btn_price_high_to_low_dim.gif");
	swapImage("price_low_to_high","img/btn_price_low_to_high.gif");
	updateSearch();
}

function updateSearch(){
	var results_div = document.getElementById("search_results");
	var search_loader = document.getElementById("search_loader");
	var parameters = "";
	var order = 1;
	setAvailableConfigurationTools();
	if (price_setting == "low"){
		order = 2;
	}
	parameters = "?order="+order;
	
	results_div.innerHTML = "<div style=\"width:900px;text-align:center;padding-top:100px\"><img src=\"img/ajax-loader.gif\" />"+"<"+"/div>";
	if (selected_door>0){
		parameters = parameters + "&door_type="+selected_door;	
	}
	if (selected_vent>0){
		parameters = parameters + "&vent_type="+selected_vent;	
	}
	if (selected_color>0){
		parameters = parameters + "&color_finish="+selected_color;	
	}
	if (selected_glass>0){
		parameters = parameters + "&glass_option="+selected_glass;	
	}
	search_loader.src = "search_results.php"+parameters;
	//alert(parameters);
}

function setSearchResults(div_text){
	var results_div = document.getElementById("search_results");
	results_div.innerHTML = div_text;
}

function showDoorConfigurator(door_id){
	selected_door = door_id;
	scroll(0,0);
	var results_div = document.getElementById("configurator_holder");
	var search_loader = document.getElementById("configurator_loader");
	var parameters = "";
	
	results_div.innerHTML = "<div style=\"width:100%;text-align:center;padding-top:100px\"><img src=\"img/ajax-loader-dark.gif\" />"+"<"+"/div>";
	parameters = "?door_id="+door_id;
	if (selected_color>0){
		parameters = parameters + "&color="+selected_color;	
	}
	if (selected_glass>0){
		parameters = parameters + "&glass_option="+selected_glass;	
	}
	cs_selected_color = selected_color;
	cs_selected_glass = selected_glass;
	//alert(parameters);
	search_loader.src = "configurator_shell.php"+parameters;
	var shell_div = document.getElementById('configurator_shell');
	shell_div.style.height = getDocHeight()+"px";
	shell_div.style.width = "100%";
	shell_div.style.display = "block";
}

function getDocHeight() {
    var D = document;
    var maxheight = Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
    return (maxheight);
}

function setConfiguratorResults(div_text){
	var leftOffset = document.body.clientWidth / 2 - 425;
	var results_div = document.getElementById("configurator_holder");
	results_div.style.position = "absolute";
	results_div.style.top = "50px";
//	results_div.style.left = leftOffset;
	results_div.innerHTML = div_text;
	updateCSDoor();
    $(document).pngFix(); 
}

function closeConfigurator(){
	var results_div = document.getElementById("configurator_holder");
	var shell_div = document.getElementById('configurator_shell');
	shell_div.style.display = "none";
	results_div.innerHTML = "";
	selected_door=0;
	cs_selected_door_size = 0;
	cs_selected_handle = 0;
	cs_current_highlight_tab = null;
	cs_selected_color = 0;
	cs_selected_glass = 0;
	cs_selected_sweep = 0;
}

/************************************************************************/

	var cs_selected_door_size = 0;
	var cs_selected_handle = 0;
	var cs_current_highlight_tab = null;
	var cs_selected_color = 0;
	var cs_selected_glass = 0;
	var cs_selected_sweep = 0;

	//CSSIZE FUNCTIONS
	function toggleCSSize(door_id){
		//alert(cs_selected_color);
		var div = document.getElementById("cs_size_balloon");
		if (div != null){
			if (div.style.display!="none"){
				hideCSSize();
			} else {
				showCSSize(door_id,cs_selected_color);
			}
		}
	}
	function showCSSize(door_id,door_color){
		//alert(door_id);
		hideCSColors();
		hideCSHandles();
		hideCSSweeps();
		hideCSGlass();
		var div = document.getElementById("cs_size_balloon");
		if (div != null){
			div.style.display="block";
		}
		if (door_color)
		{
			//alert("if" + door_color);
			for (var i=30; i<=36; i++)
			{
				if (sizeColors[door_id][door_color][i] == 1)
				{
					if (document.getElementById("cs_size_available_"+i))
					{
						document.getElementById("cs_size_available_"+i).style.display="";
					}
				}
				else
				{
					if (document.getElementById("cs_size_available_"+i))
					{
						document.getElementById("cs_size_available_"+i).style.display="none";
					}
				}
			}
		}
		else
		{
			//alert("else");
			for (var j=1; j<=25; j++)
			{
				for (var i=30; i<=36; i++)
				{
					if (sizeColors[door_id][j][i] == 1)
					{
						if (document.getElementById("cs_size_available_"+i))
						{
							document.getElementById("cs_size_available_"+i).style.display="";
						}
					}
					else
					{
						if (document.getElementById("cs_size_available_"+i) && document.getElementById("cs_size_available_"+i).style.display!="")
						{
							document.getElementById("cs_size_available_"+i).style.display="none";
						}
					}
				}
			}
		}
	}
	function hideCSSize(){
		var div = document.getElementById("cs_size_balloon");
		if (div != null){
			div.style.display="none";
		}
	}
	function selectCSSize(size){
		hideCSSize();
		var img = document.getElementById("cs_door_size");
		if (img != null){
			cs_selected_door_size = size;
			if (selected_door == 6){
				img.src = "img/dme_size_"+size+"_selected.gif";
			} else {
				img.src = "img/cs_size_"+size+".gif";
			}
		}
		var div = document.getElementById("final_choose_size");
		if (div != null){
			div.style.display="block";
		}
		div = document.getElementById("initial_choose_size");
		if (div != null){
			div.style.display="none";
		}
		updateCSDoor();
	}

	//CSSWEEP FUNCTIONS
	function toggleCSSweeps(){
		var div = document.getElementById("cs_sweep_selector");
		if (div != null){
			if (div.style.display!="none"){
				hideCSSweeps();
			} else {
				showCSSweeps();
			}
		}
	}
	function showCSSweeps(){
		hideCSColors();
		hideCSHandles();
		hideCSSize();
		hideCSGlass();
		var div = document.getElementById("cs_sweep_selector");
		if (div != null){
			div.style.display="block";
		}
	}
	function hideCSSweeps(){
		var div = document.getElementById("cs_sweep_selector");
		if (div != null){
			div.style.display="none";
		}
	}
	function selectCSSweep(index){
		hideCSSweeps();
		var img = document.getElementById("cs_sweep_image");
		if (img != null){
			cs_selected_sweep = index;
			img.src = sweeps[index].image;
		}
		var sweep_text = document.getElementById("cs_sweep_selected_text");
		if (sweep_text != null){
			sweep_text.innerHTML = "Your Choice: <span style=\"color:#454342\">"+sweeps[index].title+"</span>";
		}
		var div = document.getElementById("sweep_selector_final");
		if (div != null){
			div.style.display="block";
		}
		div = document.getElementById("cs_sweep_selector");
		if (div != null){
			div.style.display="none";
		}
		div = document.getElementById("sweep_selector_initial");
		if (div != null){
			div.style.display="none";
		}
		updateCSDoor();
	}
	function setCSSweepText(index){
		var sc = document.getElementById("configurator_window");
		var txtfield = document.getElementById("cs_sweep_selector_text");
		if (txtfield != null && sc != null && sc.style.display != "none"){
//			cs_highlight_color_index = index;
			txtfield.innerHTML = "Color: <span style=\"color:#000000\">"+sweeps[index].title+"</span>";
		}

	}

	//CSCOLORS FUNCTIONS
	function toggleCSColors(door_id){
		var div = document.getElementById("cs_standard_color_selector");
		if (div != null){
			if (div.style.display!="none"){
				hideCSColors();
			} else {
				showCSColors(door_id,cs_selected_door_size);
			}
		}
	}
	function showCSColors(door_id,door_size){
		//alert(door_id);
		hideCSHandles();
		hideCSSize();
		hideCSSweeps();
		hideCSGlass();
		var div = document.getElementById("cs_standard_color_selector");
		if (div != null){
			div.style.display="block";
		}
		if (door_size)
		{
			//alert("if" + door_size);
			for (var i=1; i<=25; i++)
			{
				if (sizeColors[door_id][i][door_size] == 1)
				{
					document.getElementById("cs_color_available_"+i).style.display="";
				}
				else
				{
					if (document.getElementById("cs_color_available_"+i))
					{
						document.getElementById("cs_color_available_"+i).style.display="none";
					}
				}
			}
		}
		else
		{
			//alert("else");
			for (var j=1; j<=25; j++)
			{
				for (var i=30; i<=36; i++)
				{
					if (sizeColors[door_id][j][i] == 1)
					{
						document.getElementById("cs_color_available_"+j).style.display="";
						break;
					}
					else
					{
						if (document.getElementById("cs_color_available_"+j) && document.getElementById("cs_color_available_"+j).style.display!="")
						{
							document.getElementById("cs_color_available_"+j).style.display="none";
						}
					}
				}
			}
		}
	}
	function hideCSColors(){
		var div = document.getElementById("cs_standard_color_selector");
		if (div != null){
			div.style.display="none";
		}
	}

	function selectCSColor(index){
		var sc = document.getElementById("configurator_window");
		if (sc != null && sc.style.display != "none"){
			var color_image = document.getElementById("cs_color_image");
			var color_text = document.getElementById("cs_color_selected_text");
			cs_selected_color = index;
			if (color_image != null) {
				color_image.src = colors[index].image;
			}
			if (color_text != null){
				color_text.innerHTML = "Your Choice: <span style=\"color:#454342\">"+colors[index].title+"</span>";
			}
			var color_sel = document.getElementById("cs_standard_color_selector");
			if (color_sel != null){
				color_sel.style.display="none";
			}
			color_sel = document.getElementById("final_choose_color");
			if (color_sel != null){
				color_sel.style.display="block";
			}
			color_sel = document.getElementById("initial_choose_color");
			if (color_sel != null){
				color_sel.style.display="none";
			}
		}
		updateCSDoor();
	}
	
	function setCSStandardColorText(index){
		var sc = document.getElementById("configurator_window");
		var txtfield = document.getElementById("cs_standard_color_selector_text");
		if (txtfield != null && sc != null && sc.style.display != "none"){
			cs_highlight_color_index = index;
			txtfield.innerHTML = "Color: <span style=\"color:#000000\">"+colors[index].title+"</span>";
		}
	}
	
	function hideCSStandardColorText(index){
		var sc = document.getElementById("configurator_window");
		var txtfield = document.getElementById("cs_standard_color_selector_text");
		if (sc != null && sc.style.display != "none" && txtfield != null && cs_highlight_color_index == index){
			cs_highlight_color_index = -1;
			txtfield.innerHTML = "Color:";
		}
	}

	//CSHANDLES FUNCTIONS
	function toggleCSHandles(){
		var div = document.getElementById("cs_handle_selector");
		if (div != null){
			if (div.style.display!="none"){
				hideCSHandles();
			} else {
				showCSHandles();
			}
		}
	}
	function selectCSHandle(handle_id){
		hideCSHandles();
		var img = document.getElementById("cs_handle_image");
		var handle_text = document.getElementById("cs_handle_selected_text");
		if (handle_text != null){
			handle_text.innerHTML = "Your Choice: <span style=\"color:#454342\">"+handles[handle_id].title+"</span>";
		}
		if (img != null){
			cs_selected_handle = handle_id;
			img.src = handles[handle_id].image;
		}
		var default_handle = document.getElementById("final_choose_handle");
		if (default_handle != null){
			default_handle.style.display="block";
		}
		default_handle = document.getElementById("initial_choose_handle");
		if (default_handle != null){
			default_handle.style.display="none";
		}
		updateCSDoor();
	}
	function showCSSelectorHandle(handle_id){
		var img = document.getElementById("cs_balloon_handle_img");
		if (img != null){
			img.src = handles[handle_id].image_med;
		}
	}
	function showCSHandles(){
		hideCSColors();
		hideCSSize();
		hideCSSweeps();
		hideCSGlass();
		var div = document.getElementById("cs_handle_selector");
		if (div != null){
			div.style.display="block";
		}
	}
	function hideCSHandles(){
		var div = document.getElementById("cs_handle_selector");
		if (div != null){
			div.style.display="none";
		}
	}

	//CSGLASS FUNCTIONS
	function toggleCSGlass(){
		var div = document.getElementById("cs_glass_selector");
		if (div != null){
			if (div.style.display!="none"){
				hideCSGlass();
			} else {
				showCSGlass();
			}
		}
	}
	function selectCSGlass(glass_id){
		hideCSGlass();
		var img = document.getElementById("cs_glass_image");
		var glass_text = document.getElementById("cs_glass_selected_text");
		if (glass_text != null){
			glass_text.innerHTML = "Your Choice: <span style=\"color:#454342\">"+glass[glass_id].title+"</span>";
		}
		if (img != null){
			cs_selected_glass = glass_id;
			img.src = glass[glass_id].image_cs_med;
		}
		var default_glass = document.getElementById("final_choose_glass");
		if (default_glass != null){
			default_glass.style.display="block";
		}
		default_glass = document.getElementById("initial_choose_glass");
		if (default_glass != null){
			default_glass.style.display="none";
		}
		updateCSDoor();
	}
	function showCSSelectorGlass(glass_id){
		var img = document.getElementById("cs_balloon_glass_img");
		if (img != null){
			img.src = glass[glass_id].image_med;
		}
	}
	function showCSGlass(){
		hideCSColors();
		hideCSHandles();
		hideCSSize();
		hideCSSweeps();
 		var div = document.getElementById("cs_glass_selector");
		if (div != null){
			div.style.display="block";
		}
	}
	function hideCSGlass(){
		var div = document.getElementById("cs_glass_selector");
		if (div != null){
			div.style.display="none";
		}
	}

	//CSTABS FUNCTIONS	
	function checkHighlightCSTab(tab){
		if (cs_current_highlight_tab == null){
			cs_current_highlight_tab = document.getElementById("customize_door_tab");
		}
		if (tab != null && tab != cs_current_highlight_tab){
			tab.style.color = "#FFFFFF";
		}
	}
	
	function checkUnhighlightCSTab(tab){
		if (tab != null && tab != cs_current_highlight_tab){
			tab.style.color = "#999999";
		}
	}
	
	function csCustomizeDoor(tab){
		var tmp_tab = cs_current_highlight_tab;
		cs_current_highlight_tab = document.getElementById("customize_door_tab");
		checkUnhighlightCSTab(tmp_tab);
		var div = document.getElementById("product_overview");
		div.style.display = "none";
		div = document.getElementById("cs_tools");
		div.style.display = "block";
		div = document.getElementById("sweep_div");
		div.style.display = "block";
	}
	
	function csProductOverviewSpecs(tab){
		var tmp_tab;
		if (tmp_tab == null){
			cs_current_highlight_tab = document.getElementById("customize_door_tab");
		}
		tmp_tab = cs_current_highlight_tab;
		cs_current_highlight_tab = document.getElementById("product_overview_tab");
		checkUnhighlightCSTab(tmp_tab);
		var div = document.getElementById("cs_tools");
		div.style.display = "none";
		div = document.getElementById("product_overview");
		div.style.display = "block";
		div = document.getElementById("sweep_div");
		div.style.display = "none";
	}
	
	function printDoorSpecs(door_id){
		var pwin=window.open('','print_content','width=800,height=800');
		var spec_div = document.getElementById("product_overview");
		var summary_div = document.getElementById("door_summary_div");
		var content=spec_div.innerHTML;
		var summary=summary_div.innerHTML;
		var img_src = document.getElementById("display_door").src;
		var print_div_text = "<div>";
		var pwin=window.open('','print_content','width=1000,height=800,scrollbars=1,resizable=1');
		pwin.document.open();

		print_size_text = "";
		if (cs_selected_color > 0)
		{
			for (var i=30; i<=36; i++)
			{
				if (sizeColors[door_id][cs_selected_color][i] == 1)
				{
					if (print_size_text == "")
					{
						print_size_text = print_size_text + i;
					}
					else
					{
						print_size_text = print_size_text + "," + i;
					}
				}
			}
		}
		else
		{
			for (var j=1; j<=25; j++)
			{
				for (var i=30; i<=36; i++)
				{
					if (sizeColors[door_id][j][i] == 1)
					{
						if (print_size_text.indexOf(i) == -1)
						{
							if (print_size_text == "")
							{
								print_size_text = print_size_text + i;
							}
							else
							{
								print_size_text = print_size_text + "," + i;
							}
						}
					}
				}
			}
		}
		print_size_text = "<strong>Sizes</strong><br />" + print_size_text;
		print_size_text = print_size_text + "<div style=\"line-height:11px;padding-top:16px;text-align:left;font-size:9px;color:#FFFFFF;\">*Compared to standard Andersen aluminum insect screen</div>";
		content = content.replace("printSpecSizes",print_size_text);
		
//		print_div_text = "<html><head></head><body onload=\"window.print();window.close()\">"
		print_div_text = "<html><head><style type=\"text/css\">.dots_light{display:none};</style></head><body onload=\"window.print();window.close()\" style=\"width:1000px;font-size:14px;font-family:Helvetica, Arial, _sans;color:black\">"
		print_div_text += "<div style=\"width:780px;margin:auto;\">";
		print_div_text += "	<div style=\"width:780px;\">";
		print_div_text += "		<div style=\"float:right;\"><img src=\"img/AWD_Logo_2C_L_Blk.jpg\" /></div><br clear=\"both\" />";
		print_div_text += "		<div style=\"float:left;width:230px;text-align:center;\">";
		print_div_text +=("			<img src=\""+img_src+"\" />");
		print_div_text +="		</div>";
		print_div_text += "		<div style=\"float:left;overflow:visible;background:#ffffff;color:black;font-size:14px;line-height:20px;width:550px;height:\">";
		print_div_text += "			<img src=\"img/black_10_percent_balloon_substitute.gif\" style=\"padding-left:30px;\" width=\"520\" height=\"1\" /><br /><br />";
		print_div_text += (				summary+"<br /><br />");
		if (summary.indexOf("Fullview")>0){
			print_div_text += ("<span style=\"padding-left:30px\">Glass panel and insect screen have a neutral color frame.</span><br /><br />");
		}
		print_div_text += "			<img src=\"img/black_10_percent_balloon_substitute.gif\" style=\"padding-left:30px;\" width=\"520\" height=\"1\" /><br /><br />";

		if (cs_selected_color > 0 || cs_selected_handle > 0 || cs_selected_door_size > 0 || cs_selected_glass > 0 || cs_selected_sweep > 0){
			print_div_text +=("		<div style=\"font-size:16px;line-height:17px;padding-left:30px;\">");
			if (cs_selected_color > 0){
				print_div_text +=("		<div><strong>Selected Color:</strong> "+colors[cs_selected_color].title+"</div>");
			}
			if (cs_selected_handle > 0){
				print_div_text +=("		<div><strong>Selected Handle:</strong> "+handles[cs_selected_handle].title+"</div>");
			}
			if (cs_selected_sweep > 0){
				print_div_text +=("		<div><strong>Selected Sweep:</strong> "+sweeps[cs_selected_sweep].title+"</div>");
			}
			if (cs_selected_glass > 0){
				print_div_text +=("		<div><strong>Selected Glass:</strong> "+glass[cs_selected_glass].title+"</div>");
			}
			if (cs_selected_door_size > 0){
				print_div_text +=("		<div><strong>Selected Size:</strong> "+cs_selected_door_size+"</div>");
			}
			print_div_text +=("		</div>");
			print_div_text += "			<img src=\"img/black_10_percent_balloon_substitute.gif\" style=\"padding-left:30px;padding-top:15px\" width=\"520\" height=\"1\" /><br /><br />";
		}
		print_div_text += "<div style=\"font-size:16px;padding-left:30px;padding-top:10px;\">PRODUCT FEATURES<"+"/div>";
		print_div_text += "<div style=\"font-size:14px;\">"+content+"<"+"/div>";
		print_div_text +=("<br clear=\"right\" />");
		print_div_text +="		</div>";
		print_div_text +="	</div>";
		print_div_text +=("<br clear=\"right\" /><br />");
		print_div_text +=("<div style=\"width:780px;padding-top:20px;\"><br /><br />");
		print_div_text +=("<span style=\"font-size:18px;font-weight:bold;\">All storm doors from The Home Depot&reg; are available through Special Order at no extra charge.<sup>*</sup> Special ordered storm doors arrive in 14 days or less to the store <span style=\"font-size:11px\">(many in 10 days)</span> from the date of your order.<sup>**</sup></span><br /><br />");
		print_div_text +=("<span style=\"font-size:9px;\">*Excludes custom sizes and  25 Colors/Finishes program.</span><br />");
		print_div_text +=("<span style=\"font-size:9px;\">**Excludes custom sizes</span><br /><br />");
		
		if (cs_selected_handle > 0){
			mqs_obj = mqs_object["door_id_"+selected_door];
			if (mqs_obj != null){
				mqs_info = mqs_obj["handle_"+cs_selected_handle];
				if (mqs_info != null){
					print_div_text +="<div style=\"color:#666666;\">PROVIDED FOR THE HOME DEPOT ASSOCIATE:</div>";
					print_div_text +=("<table border=\"0\" cellpadding=\"0\" cellspacing=\"7\" bgcolor=\"#999999\" style=\"width:780px;background-color:#999999;color:black;\">");
					print_div_text +=("<tr><td rowspan=\"8\" width=\"20\">&nbsp;</td><td colspan=\"2\">&nbsp;</td><td rowspan=\"8\" width=\"30\">&nbsp;</td></tr>");
					print_div_text +=("<tr><td width=\"200\">"+mqs_info[0][0]+"</td><td><strong>"+mqs_info[0][1]+"</strong></td></tr>");
					print_div_text +=("<tr><td width=\"200\">"+mqs_info[1][0]+"</td><td><strong>"+mqs_info[1][1]+"</strong></td></tr>");
					print_div_text +=("<tr><td width=\"200\">"+mqs_info[2][0]+"</td><td><strong>"+mqs_info[2][1]+"</strong></td></tr>");
					print_div_text +=("<tr><td width=\"200\">"+mqs_info[3][0]+"</td><td><strong>"+mqs_info[3][1]+"</strong></td></tr>");
					print_div_text +=("<tr><td width=\"200\">"+mqs_info[4][0]+"</td><td><strong>"+mqs_info[4][1]+"</strong></td></tr>");
					if (cs_selected_door_size > 0 && cs_selected_color > 0){
						print_div_text +=("<tr><td width=\"200\">Frame Size:</td><td><strong>"+cs_selected_door_size+"&rdquo;</strong></td></tr>");
						print_div_text +=("<tr><td width=\"200\">Color</td><td><strong>"+colors[cs_selected_color].title+"</strong></td></tr>");
					}
					print_div_text +=("<tr><td colspan=\"2\">&nbsp;</td></tr>");
					print_div_text +=("</table>");
				}
			}
		}
		print_div_text +=("<div style=\"width:780px;font-size:9px;\">EMCO Enterprises, Inc, is a wholly-owned subsidiary of Andersen Corporation. EMCO manufactures Andersen&reg;, and EMCO&reg; doors.  EMCO supports the limited warranties covering Andersen&reg; Storm and Screen Doors. &ldquo;The Home Depot&rdquo; and The Home Depot logo are trademarks of Homer TLC, Inc. &ldquo;Andersen&rdquo;, &ldquo;EMCO&rdquo; and all other marks where denoted are trademarks of Andersen Corporation. &copy;2009 Andersen Corporation. All Rights Reserved.<"+"/div>");
		print_div_text +=("</div>");
		print_div_text +=("</div>");
		print_div_text +="</body></html>";
		
		pwin.document.write(print_div_text);
		pwin.document.close();
	}
	
	function updateCSDoor(){
		var door_name = "";
		var door_image = document.getElementById("display_door");
		var sweep = cs_selected_sweep;
		
//		alert(selected_door);
		if (door_image){
			if (selected_door != 0){
				door_name = "img/doors/door"+selected_door+"_";
//				alert(cs_selected_handle);
				if (selected_door == 6){
					door_name = "img/doors/door6/door"+selected_door+"_";
					if (cs_selected_handle != 0){
						door_name += "h"+cs_selected_handle+"_";
						//if (cs_selected_handle == 1 || cs_selected_handle == 4 || cs_selected_handle == 7){
						//	sweep = 3;
						//} else if (cs_selected_handle == 2 || cs_selected_handle == 5 || cs_selected_handle == 8){
						//	sweep = 1;
						//} else if (cs_selected_handle == 3 || cs_selected_handle == 6 || cs_selected_handle == 9){
						//	sweep = 2;
						//}
					} else {
						if (sweep == 1){
							door_name += "h5_";
						} else if (sweep == 2){
							door_name += "h6_";
						} else if (sweep == 3){
							door_name += "h4_";
						} else {
							door_name += "h5_";
							sweep = 1;
						}
					}
					if (sweep != 0){
						door_name += "s"+sweep+"_";
					} else {
						door_name += "s2_";
					}
					if (cs_selected_color != 0){
						door_name += "c"+cs_selected_color+"_";
					} else {
						door_name += "c1_";
					}
					if (cs_selected_glass != 0){
						door_name += "g"+cs_selected_glass+".jpg";
					} else {
						door_name += "g1.jpg";
					}
					//alert("Door Name: "+door_name);
				} else {
					if (cs_selected_handle != 0){
						door_name += "h"+cs_selected_handle+"_";
					} else {
						door_name += "h"+handle_groups[selected_door][1]+"_";
					}
					if (cs_selected_color != 0){
						door_name += "c"+cs_selected_color+".jpg";
					} else {
						door_name += "c1.jpg";
					}
				}
			} else {
				door_name = "img/doors/door_standin.jpg";
			}
			door_image.src = door_name;
		}
	}

	function showFeatureBalloon(title,body,image,top,left){
		var arrow = document.getElementById("feature_rollover_arrow");
		var content = document.getElementById("feature_rollover_content");
		var balloon = document.getElementById("feature_rollover_balloon");
		
		if (arrow != null){
			if (top > 150){
//				arrow.style.bottom = "0px";
			} else if (top > 90){
//				arrow.style.top = "30px";
			} else {
//				arrow.style.top = "0px";
			}
		}
		if (balloon != null && content != null){
			top -= 45;
			balloon.style.top = top+"px";
			left += 45;
			balloon.style.left = left+"px";

			if (image == ""){
				content.innerHTML = "<strong>"+title+"<"+"/strong><br /><br />"+body;
			} else {
				content.innerHTML = "<div style=\"height:152px;width:100%;text-align:center;\"><img src=\""+image+"\" /></div><br /><strong>"+title+"<"+"/strong><br /><br />"+body;
			}
			balloon.style.display="block";
		}
	}
	
	function hideFeatureBalloon(){
		var balloon = document.getElementById("feature_rollover_balloon");
		if (balloon != null){
			balloon.style.display = "none";
		}
	}

