// JavaScript Document

var params;

function getParams()
{
	params = document.location.search.substring(1).split('&');
	for (var i=0; i<params.length; i++)
	{
		var param = params[i].split('=');
		params[param[0]] = param[1]; 
	} 
}
function okButtonClick(id) {
	parent.returnValue=id;
	parent.close();
}

function okButtonClick_5P(Control,door,outline,inside,applied,panel) 
{
	var stileW = "DSW[1]=" + dsw.value;
	var railtopH = "DRHT[1]=" + drht.value;
	var railbottomH = "DRHB[1]=" + drhb.value;
		
	var strValueElementVars		= door;
			strValueElementVars		+= ";";
			strValueElementVars		+= stileW;
			strValueElementVars		+= ";";
			strValueElementVars		+= railtopH;
			strValueElementVars		+= ";";
			strValueElementVars		+= railbottomH;
			strValueElementVars		+= ";";
			strValueElementVars		+= outline;
			strValueElementVars		+= ";";
			strValueElementVars		+= inside;
			strValueElementVars		+= ";";
			strValueElementVars		+= applied;
			strValueElementVars		+= ";";
			strValueElementVars		+= panel;
			strValueElementVars		+= ";";
			Control.vars = "";

	for (var i=1; i < 5; i++)
	{
			if(i == 1 && doortype.base.checked)
			{
				var newtxt = strValueElementVars;
				Control.vars = newtxt + doortype.base.value + ";";
			}
			if(i == 2 && doortype.wall.checked)
			{
				var indice = "2";
				var newtxt = Replace(strValueElementVars, "1", indice);
				Control.vars += newtxt + doortype.wall.value + ";";
			}
			if(i == 3 && doortype.tall.checked)
			{
				var indice = "3";
				var newtxt = Replace(strValueElementVars, "1", indice);
				Control.vars += newtxt + doortype.tall.value + ";";
			}
			if(i == 4 && doortype.drawer.checked)
			{
				var indice = "4";
				var newtxt = Replace(strValueElementVars, "1", indice);
				Control.vars += newtxt + doortype.drawer.value + ";";
			}
				
	}
	
	//alert(Control.vars);
	parent.close();
}

function okButtonClick_mit(Control,door,outline,applied,panel) 
{
	var railbottomH = "DRHB[1]=" + drhb.value;
		
	var strValueElementVars		= door;
			strValueElementVars		+= ";";
			strValueElementVars		+= railbottomH;
			strValueElementVars		+= ";";
			strValueElementVars		+= outline;
			strValueElementVars		+= ";";
			strValueElementVars		+= applied;
			strValueElementVars		+= ";";
			strValueElementVars		+= panel;
			strValueElementVars		+= ";";
			Control.vars = "";

	for (var i=1; i < 5; i++)
	{
			if(i == 1 && doortype.base.checked)
			{
				var newtxt = strValueElementVars;
				Control.vars = newtxt + doortype.base.value + ";";
			}
			if(i == 2 && doortype.wall.checked)
			{
				var indice = "2";
				var newtxt = Replace(strValueElementVars, "1", indice);
				Control.vars += newtxt + doortype.wall.value + ";";
			}
			if(i == 3 && doortype.tall.checked)
			{
				var indice = "3";
				var newtxt = Replace(strValueElementVars, "1", indice);
				Control.vars += newtxt + doortype.tall.value + ";";
			}
			if(i == 4 && doortype.drawer.checked)
			{
				var indice = "4";
				var newtxt = Replace(strValueElementVars, "1", indice);
				Control.vars += newtxt + doortype.drawer.value + ";";
			}
				
	}
	
	//alert(Control.vars);
	parent.close();
}

function okButtonClick_slab(Control,door,outline) 
{
	var strValueElementVars		= door;
			strValueElementVars		+= ";";
			strValueElementVars		+= outline;
			strValueElementVars		+= ";";
			Control.vars = "";

	for (var i=1; i < 5; i++)
	{
			if(i == 1 && doortype.base.checked)
			{
				var newtxt = strValueElementVars;
				Control.vars = newtxt + doortype.base.value + ";";
			}
			if(i == 2 && doortype.wall.checked)
			{
				var indice = "2";
				var newtxt = Replace(strValueElementVars, "1", indice);
				Control.vars += newtxt + doortype.wall.value + ";";
			}
			if(i == 3 && doortype.tall.checked)
			{
				var indice = "3";
				var newtxt = Replace(strValueElementVars, "1", indice);
				Control.vars += newtxt + doortype.tall.value + ";";
			}
			if(i == 4 && doortype.drawer.checked)
			{
				var indice = "4";
				var newtxt = Replace(strValueElementVars, "1", indice);
				Control.vars += newtxt + doortype.drawer.value + ";";
			}
				
	}
	
	//alert(Control.vars);
	parent.close();
}

function Bouton_DrwDim(Control)
{ 
	var Hauteur = "";
	var Profondeur = "";
	var BClear = "";
	
	if(MINBC.value>0)
	{
	var strValueElementVars = "DBTCC=";
	strValueElementVars += MINBC.value;
	strValueElementVars		+= ";";
	BClear = strValueElementVars;
	//alert(BClear);
	}
	if(CVARD21.value>0)
	{
	var strValueElementVars		= "CVARD[21]=";
			strValueElementVars		+= CVARD21.value;
			strValueElementVars		+= ";";
		if(CVARD22.value>0)
			{
			strValueElementVars		+= "CVARD[22]=";
			strValueElementVars		+= CVARD22.value;
			strValueElementVars		+= ";";
				if(CVARD23.value>0)
				{
				strValueElementVars		+= "CVARD[23]=";
				strValueElementVars		+= CVARD23.value;
				strValueElementVars		+= ";";
					if(CVARD24.value>0)
					{
					strValueElementVars		+= "CVARD[24]=";
					strValueElementVars		+= CVARD24.value;
					strValueElementVars		+= ";";
						if(CVARD25.value>0)
						{
						strValueElementVars		+= "CVARD[25]=";
						strValueElementVars		+= CVARD25.value;
						strValueElementVars		+= ";";
							if(CVARD26.value>0)
							{
							strValueElementVars		+= "CVARD[26]=";
							strValueElementVars		+= CVARD26.value;
							strValueElementVars		+= ";";
								if(CVARD27.value>0)
								{
								strValueElementVars		+= "CVARD[27]=";
								strValueElementVars		+= CVARD27.value;
								strValueElementVars		+= ";";
									if(CVARD28.value>0)
									{
									strValueElementVars		+= "CVARD[28]=";
									strValueElementVars		+= CVARD28.value;
									strValueElementVars		+= ";";
										if(CVARD29.value>0)
										{
										strValueElementVars		+= "CVARD[29]=";
										strValueElementVars		+= CVARD29.value;
										strValueElementVars		+= ";";
										}
									}
								}
							}
						}
					}
				}
			}
			Hauteur = strValueElementVars;
			//alert(Hauteur);
	}
	if(CVARD11.value>0)
	{
	var strValueElementVars		= "CVARD[11]=";
			strValueElementVars		+= CVARD11.value;
			strValueElementVars		+= ";";
		if(CVARD12.value>0)
			{
			strValueElementVars		+= "CVARD[12]=";
			strValueElementVars		+= CVARD12.value;
			strValueElementVars		+= ";";
				if(CVARD13.value>0)
				{
				strValueElementVars		+= "CVARD[13]=";
				strValueElementVars		+= CVARD13.value;
				strValueElementVars		+= ";";
					if(CVARD14.value>0)
					{
					strValueElementVars		+= "CVARD[14]=";
					strValueElementVars		+= CVARD14.value;
					strValueElementVars		+= ";";
						if(CVARD15.value>0)
						{
						strValueElementVars		+= "CVARD[15]=";
						strValueElementVars		+= CVARD15.value;
						strValueElementVars		+= ";";
							if(CVARD16.value>0)
							{
							strValueElementVars		+= "CVARD[16]=";
							strValueElementVars		+= CVARD16.value;
							strValueElementVars		+= ";";
								if(CVARD17.value>0)
								{
								strValueElementVars		+= "CVARD[17]=";
								strValueElementVars		+= CVARD17.value;
								strValueElementVars		+= ";";
									if(CVARD18.value>0)
									{
									strValueElementVars		+= "CVARD[18]=";
									strValueElementVars		+= CVARD18.value;
									strValueElementVars		+= ";";
										if(CVARD19.value>0)
										{
										strValueElementVars		+= "CVARD[19]=";
										strValueElementVars		+= CVARD19.value;
										strValueElementVars		+= ";";
										}
									}
								}
							}
						}
					}
				}
			}
			Profondeur = strValueElementVars;
			//alert(Profondeur);
	}
	if(Hauteur && Profondeur==0 && BClear==0)
	{
	Control.vars = Hauteur;
	//alert('Hauteur='+ Control.vars);
	}
	else if(Hauteur==0 && Profondeur && BClear==0)
	{
	Control.vars = Profondeur;
	//alert('Profondeur='+ Control.vars);
	}
	else if(Hauteur && Profondeur && BClear==0)
	{
	Control.vars = Hauteur + Profondeur;
	//alert('Hauteur et Prondeur='+ Control.vars);
	}
	else if(BClear && Hauteur == 0 && Profondeur ==0)
	{
	Control.vars = BClear;
	//alert('Drawer Box='+ Control.vars);
	}
	else if(BClear && Hauteur && Profondeur ==0 || BClear && Hauteur ==0 && Profondeur || BClear && Hauteur && Profondeur)
	{
	Control.vars = "";
	alert('Les validations prédomine sur la clearance arrière')
	}
	else
	{
	alert('Aucune dimensions entrées')
	Control.vars = "";
	}
	//alert(Control.vars);
	parent.close();
}

function Bouton_Reset(Control)
{
	var strValueElementVars = "CVARD[11]=0;";
			strValueElementVars += "CVARD[12]=0;";
			strValueElementVars += "CVARD[13]=0;";
			strValueElementVars += "CVARD[14]=0;";
			strValueElementVars += "CVARD[15]=0;";
			strValueElementVars += "CVARD[16]=0;";
			strValueElementVars += "CVARD[17]=0;";
			strValueElementVars += "CVARD[18]=0;";
			strValueElementVars += "CVARD[19]=0;";
			strValueElementVars += "CVARD[20]=0;";
			strValueElementVars += "CVARD[21]=0;";
			strValueElementVars += "CVARD[22]=0;";
			strValueElementVars += "CVARD[23]=0;";
			strValueElementVars += "CVARD[24]=0;";
			strValueElementVars += "CVARD[25]=0;";
			strValueElementVars += "CVARD[26]=0;";
			strValueElementVars += "CVARD[27]=0;";
			strValueElementVars += "CVARD[28]=0;";
			strValueElementVars += "CVARD[29]=0;";
			strValueElementVars += "CVARD[30]=0;";
			strValueElementVars += "DBTCC=2";
			Control.vars = strValueElementVars;
			
		//alert(Control.vars);
		parent.close();			
}

function Replace(txt, ser, rep)
{
    var pattern = new RegExp("\\[" + ser + "\\]", "g");
 
    return txt.replace(pattern, "[" + rep + "]");
}

function okButtonClick_Overlay(Control) 
{	
					if(ovlt[1].checked)
					{
						var ovtype = ovlt[1].value;
						var OVLAY = def1.value;
					}
					else if(ovlt[2].checked)
					{
						var ovtype = ovlt[2].value;
						var OVLAY = def2.value;
					}
					else if(ovlt[3].checked)
					{
						var ovtype = ovlt[3].value;
						var OVLAY = def3.value;
					}
					else if(ovlt[4].checked)
					{
						var ovtype = ovlt[4].value;
						var OVLAY = def4.value;
					}
					else if(ovlt[5].checked)
					{
						var ovtype = ovlt[5].value;
						var OVLAY = def5.value;
					}
					else if(ovlt[6].checked)
					{
						var ovtype = ovlt[6].value;
						var OVLAY = def6.value;
					}
					else
					{
						var ovtype = ovlt[0].value;
						var OVLAY = def.value;
					}
	var index = parseInt(ovtype)+1;
	var OVLV = "OVLV[" + index + "]=" + OVLAY;
	var strValueElementVars		= "FOVL=";
			strValueElementVars		+= ovtype;
			strValueElementVars		+= ";";
			strValueElementVars		+= OVLV;
			strValueElementVars		+= ";";
			Control.vars = strValueElementVars;
			if(chtop1.checked)
			{
				Control.vars += "OVL[" + 3 + index + "]=" + top1.value +";";
			}
			if(chbot.checked)
			{
				Control.vars += "OVL[" + index + "]=" + bot.value +";";
			}
			if(chmid.checked)
			{
				Control.vars += "OVL[" + 1 + index + "]=" + mid.value +";";
			}
			if(chside.checked)
			{
				Control.vars += "OVL[" + 2 + index + "]=" + side.value +";";
			}
			if(chintt.checked)
			{
				Control.vars += "OVL[" + 6 + index + "]=" + intt.value +";";
			}
			if(chintb.checked)
			{
				Control.vars += "OVL[" + 5 + index + "]=" + intb.value +";";
			}
			if(chconft.checked)
			{
				Control.vars += "OVL[" + 9 + index + "]=" + conft.value +";";
			}
			if(chconfb.checked)
			{
				Control.vars += "OVL[" + 8 + index + "]=" + confb.value +";";
			}
	//alert(Control.vars);
	//alert(ovlt[1].value);
	parent.close();
}

function SelectType(Otype)
{	
	if(Otype == 1)
	{
		ovtype.src = "Overlay/full.gif";
		def1.value = "1.25";
		var defd = def1.value;
		top1.defaultvalue = defd;
		bot.defaultvalue = defd;
		mid.defaultvalue = defd;
		side.defaultvalue = defd;
		intt.defaultvalue = defd * 0.5;
		intb.defaultvalue = defd * 0.5;
		conft.defaultvalue = defd;
		confb.defaultvalue = defd;
		top1.value = defd;
		bot.value = defd;
		mid.value = defd;
		side.value = defd;
		intt.value = defd * 0.5;
		intb.value = defd * 0.5;
		conft.value = defd;
		confb.value = defd;
		def.style.display = "none";
		def1.style.display = "inline";
		def2.style.display = "none";
		def3.style.display = "none";
		def4.style.display = "none";
		def5.style.display = "none";
		def6.style.display = "none";
		ovlt.value = 1;
				
	}
	else if(Otype == 2)
	{	
		ovtype.src = "Overlay/semi.gif";
		def2.value = "0.625";
		var defd = def2.value;
		top1.defaultvalue = defd;
		bot.defaultvalue = defd;
		mid.defaultvalue = defd;
		side.defaultvalue = defd;
		intt.defaultvalue = defd * 0.5;
		intb.defaultvalue = defd * 0.5;
		conft.defaultvalue = defd;
		confb.defaultvalue = defd;
		top1.value = defd;
		bot.value = defd;
		mid.value = defd;
		side.value = defd;
		intt.value = defd * 0.5;
		intb.value = defd * 0.5;
		conft.value = defd;
		confb.value = defd;
		def.style.display = "none";
		def1.style.display = "none";
		def2.style.display = "inline";
		def3.style.display = "none";
		def4.style.display = "none";
		def5.style.display = "none";
		def6.style.display = "none";
		ovlt.value = 2;
	}
	else if(Otype == 3)
	{	
		ovtype.src = "Overlay/inset.gif";
		def3.value = "-0.0625";
		var defd = def3.value;
		top1.defaultvalue = defd;
		bot.defaultvalue = defd;
		mid.defaultvalue = defd;
		side.defaultvalue = defd;
		intt.defaultvalue = defd * 0.5;
		intb.defaultvalue = defd * 0.5;
		conft.defaultvalue = defd;
		confb.defaultvalue = defd;
		top1.value = defd;
		bot.value = defd;
		mid.value = defd;
		side.value = defd;
		intt.value = defd;
		intb.value = defd;
		conft.value = defd;
		confb.value = defd;
		def.style.display = "none";
		def1.style.display = "none";
		def2.style.display = "none";
		def3.style.display = "inline";
		def4.style.display = "none";
		def5.style.display = "none";
		def6.style.display = "none";
		ovlt.value = 3;
	}
	else if(Otype == 4)
	{	
		ovtype.src = "Overlay/user.gif";
		def4.value = "0.50";
		var defd = def4.value;
		top1.defaultvalue = defd;
		bot.defaultvalue = defd;
		mid.defaultvalue = defd;
		side.defaultvalue = defd;
		intt.defaultvalue = defd * 0.5;
		intb.defaultvalue = defd * 0.5;
		conft.defaultvalue = defd;
		confb.defaultvalue = defd;
		top1.value = defd;
		bot.value = defd;
		mid.value = defd;
		side.value = defd;
		intt.value = defd * 0.5;
		intb.value = defd * 0.5;
		conft.value = defd;
		confb.value = defd;
		def.style.display = "none";
		def1.style.display = "none";
		def2.style.display = "none";
		def3.style.display = "none";
		def4.style.display = "inline";
		def5.style.display = "none";
		def6.style.display = "none";
		ovlt.value = 4;
	}
	else if(Otype == 5)
	{	
		ovtype.src = "Overlay/user.gif";
		def5.value = "0.50";
		var defd = def5.value;
		top1.defaultvalue = defd;
		bot.defaultvalue = defd;
		mid.defaultvalue = defd;
		side.defaultvalue = defd;
		intt.defaultvalue = defd * 0.5;
		intb.defaultvalue = defd * 0.5;
		conft.defaultvalue = defd;
		confb.defaultvalue = defd;
		top1.value = defd;
		bot.value = defd;
		mid.value = defd;
		side.value = defd;
		intt.value = defd * 0.5;
		intb.value = defd * 0.5;
		conft.value = defd;
		confb.value = defd;
		def.style.display = "none";
		def1.style.display = "none";
		def2.style.display = "none";
		def3.style.display = "none";
		def4.style.display = "none";
		def5.style.display = "inline";
		def6.style.display = "none";
		ovlt.value = 5;
	}
	else if(Otype == 6)
	{	
		ovtype.src = "Overlay/user.gif";
		def6.value = "0.50";
		var defd = def6.value;
		top1.defaultvalue = defd;
		bot.defaultvalue = defd;
		mid.defaultvalue = defd;
		side.defaultvalue = defd;
		intt.defaultvalue = defd * 0.5;
		intb.defaultvalue = defd * 0.5;
		conft.defaultvalue = defd;
		confb.defaultvalue = defd;
		top1.value = defd;
		bot.value = defd;
		mid.value = defd;
		side.value = defd;
		intt.value = defd * 0.5;
		intb.value = defd * 0.5;
		conft.value = defd;
		confb.value = defd;
		def.style.display = "none";
		def1.style.display = "none";
		def2.style.display = "none";
		def3.style.display = "none";
		def4.style.display = "none";
		def5.style.display = "none";
		def6.style.display = "inline";
		ovlt.value = 6;
	}
	else
	{
		ovtype.src = "Overlay/standard.gif";
		def.value = "0.50";
		var defd = def.value;
		top1.defaultvalue = defd;
		bot.defaultvalue = defd;
		mid.defaultvalue = defd;
		side.defaultvalue = defd;
		intt.defaultvalue = defd * 0.5;
		intb.defaultvalue = defd * 0.5;
		conft.defaultvalue = defd;
		confb.defaultvalue = defd;
		top1.value = defd;
		bot.value = defd;
		mid.value = defd;
		side.value = defd;
		intt.value = defd * 0.5;
		intb.value = defd * 0.5;
		conft.value = defd;
		confb.value = defd;
		def.style.display = "inline";
		def1.style.display = "none";
		def2.style.display = "none";
		def3.style.display = "none";
		def4.style.display = "none";
		def5.style.display = "none";
		def6.style.display = "none";
		ovlt.value = 0;
	}
	//alert(Otype);
}

function SelectDef(Overd)
{	
	if(Overd == def)
	{
		top1.value = def.value;
		bot.value = def.value;
		mid.value = def.value;
		side.value = def.value;
		intt.value = def.value * 0.5;
		intb.value = def.value * 0.5;
		conft.value = def.value;
		confb.value = def.value;
	}
	else if(Overd == def1)
	{
		top1.value = def1.value;
		bot.value = def1.value;
		mid.value = def1.value;
		side.value = def1.value;
		intt.value = def1.value * 0.5;
		intb.value = def1.value * 0.5;
		conft.value = def1.value;
		confb.value = def1.value;
	}
	else if(Overd == def2)
	{
		top1.value = def2.value;
		bot.value = def2.value;
		mid.value = def2.value;
		side.value = def2.value;
		intt.value = def2.value * 0.5;
		intb.value = def2.value * 0.5;
		conft.value = def2.value;
		confb.value = def2.value;
	}
	else if(Overd == def3)
	{
		top1.value = def3.value;
		bot.value = def3.value;
		mid.value = def3.value;
		side.value = def3.value;
		intt.value = def3.value * 0.5;
		intb.value = def3.value * 0.5;
		conft.value = def3.value;
		confb.value = def3.value;
	}
	else if(Overd == def4)
	{
		top1.value = def4.value;
		bot.value = def4.value;
		mid.value = def4.value;
		side.value = def4.value;
		intt.value = def4.value * 0.5;
		intb.value = def4.value * 0.5;
		conft.value = def4.value;
		confb.value = def4.value;
	}
	else if(Overd == def5)
	{
		top1.value = def5.value;
		bot.value = def5.value;
		mid.value = def5.value;
		side.value = def5.value;
		intt.value = def5.value * 0.5;
		intb.value = def5.value * 0.5;
		conft.value = def5.value;
		confb.value = def5.value;
	}
	else if(Overd == def6)
	{
		top1.value = def6.value;
		bot.value = def6.value;
		mid.value = def6.value;
		side.value = def6.value;
		intt.value = def6.value * 0.5;
		intb.value = def6.value * 0.5;
		conft.value = def6.value;
		confb.value = def6.value;
	}
	else if(Overd == top1)
	{	
		elvo.src = "Overlay/tovl.gif";
		chtop1.checked = "checked";
	}
	else if(Overd == bot)
	{	
		elvo.src = "Overlay/bovl.gif";
		chbot.checked = "checked";
	}
	else if(Overd == mid)
	{	
		elvo.src = "Overlay/movl.gif";
		chmid.checked = "checked";
	}
	else if(Overd == side)
	{	
		elvo.src = "Overlay/sovl.gif";
		chside.checked = "checked";
	}
	else if(Overd == intt)
	{	
		elvo.src = "Overlay/iovlt2.gif";
		chintt.checked = "checked";
	}
	else if(Overd == intb)
	{	
		elvo.src = "Overlay/iovlb1.gif";
		chintb.checked = "checked";
	}
	else if(Overd == conft)
	{	
		elvo.src = "Overlay/conft.gif";
		chconft.checked = "checked";
	}
	else if(Overd == confb)
	{	
		elvo.src = "Overlay/confb.gif";
		chconfb.checked = "checked";
	}
	if(chtop1.checked == true && chbot.checked == true && chmid.checked == true && chside.checked == true && chintt.checked == true
			&& chintb.checked == true && chconft.checked == true && chconfb.checked == true)
		{
			checkall.checked = "checked";
		}
	//alert(Overd.vars);
	//alert(Overd.name);
}

function SelectCheckDef(Choix)
{	
	if(checkall.checked == true) 
	{	
		//confirm("Do you want select all overlay?")
		
		
			chtop1.checked = "checked";
			chbot.checked = "checked";
			chmid.checked = "checked";
			chside.checked = "checked";
			chintt.checked = "checked";
			chintb.checked = "checked";
			chconft.checked = "checked";
			chconfb.checked = "checked";
	}
	if(checkall.checked == false && chtop1.checked == true && chbot.checked == true && chmid.checked == true && chside.checked == true && chintt.checked == true
			&& chintb.checked == true && chconft.checked == true && chconfb.checked == true)
		
		{
			chtop1.checked = "";
			chbot.checked = "";
			chmid.checked = "";
			chside.checked = "";
			chintt.checked = "";
			chintb.checked = "";
			chconft.checked = "";
			chconfb.checked = "";
		}
	
}

function CheckDef(Choix)
{	
	if(chtop1.checked == true && chbot.checked == true && chmid.checked == true && chside.checked == true && chintt.checked == true
			&& chintb.checked == true && chconft.checked == true && chconfb.checked == true)
		{
			checkall.checked = "checked";
		}
	else
		{
			checkall.checked = "";
		}
}

function selectDoor(DoorName, StyleSection)
{
	SetCookie("stySec", StyleSection);
	navigate(DoorName);
}

function showOptions(pic, list)
{
	list.style.top = pic.offsetTop;// - 2;
	list.style.left = pic.offsetLeft;// - 2;
	list.style.display = "inline";
}

function selectOption2(ctrl)
{
	var list = ctrl.parentNode;
	var listId = list.id;

	if (listId == "interior")
	{
		var img = document.getElementById("inte")
		var imgs = molding.getElementsByTagName("img");
		for (var i = 0; i<imgs.length; i++)
		{
			imgs[i].style.display = ((imgs[i].mtype & ctrl.mtype) == 0) ? "none" : "inline";
			mold.src = "DoorWiz/mold0.gif";
		}
	}
	else if (listId == "cpanel")
	{
		var img = document.getElementById("cpan")
	}
	else if (listId == "doormodel")
	{
		if (ctrl.moldings == 'true')
		{
			moldSelect.style.display="inline";
		}
		else
		{
			moldSelect.style.display = "none";
			mold.src = "DoorWiz/mold0.gif";
			mold.vars = "DSAMLD[1]=0";
		}
		var img = document.getElementById("dm")
		img.mtype = ctrl.mtype;		
	}
	else if (listId == "mitered")
	{
		var img = document.getElementById("mit")
		var imgs = molding.getElementsByTagName("img");
		for (var i = 0; i<imgs.length; i++)
		{
			imgs[i].style.display = ((imgs[i].mtype & ctrl.mtype) == 0) ? "none" : "inline";
			mold.src = "DoorWiz/mold0.gif";
		}
	}
	else if (listId == "molding")
	{
		var img = document.getElementById("mold")
	}
	else
	{
		var img = document.getElementById("ext")
	}

	if (ctrl.pic)
	{
		img.src = ctrl.pic;
	}
	else
	{
		img.src = ctrl.src;
	}
	img.vars = ctrl.vars;
	//alert(img.vars)
	list.style.display = "none";
}

function selectOption(DoorName, StyleSection)
{
	var oldContent = GetCookie("stySec");
	var newContent = oldContent + ";" + StyleSection; 
	SetCookie("stySec", newContent);
	navigate(DoorName);
}
function SelectPage(Page)
{
	navigate(Page);
}

function DoorWizClick(id, StyleSection)
{
	var oldContent = GetCookie("stySec");
	var newContent = oldContent + ";" + StyleSection; 
	SetCookie("stySec", newContent);
	var ctrl = document.getElementById(id);
	ctrl.vars = GetCookie("stySec");
	parent.returnValue=id;
	parent.close();
	javascript:history.back();
}

function SetCookie(sName, sValue)
{
	var date = new Date();
	date.setFullYear(date.getFullYear()+1);
	document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString();
}

function GetCookie(sName)
{
	var aCookie = document.cookie.split("; ");
	for (var i=0; i < aCookie.length; i++)
	{
		var aCrumb = aCookie[i].split("=");
		if (sName == aCrumb[0]) return unescape(aCrumb[1]);
	}
	return null;
}

function DelCookie(sName)
{
	var date = new Date();
	date.setFullYear(date.getFullYear()-1);
	document.cookie = sName + "=; expires=" + date.toGMTString();
}

function decOnly(i)
{	
	if(drhb.value)
	{
	var t = drhb.value;
	if(t.length>0) {
		t = t.replace(/[^\d\.]+/g, ''); 
	}
	var s = t.split('.');
	if(s.length>1) {
		s[1] = s[0] + '.' + s[1];	
		s.shift(s);
	}
	drhb.value = s.join('');
	}
	if(dsw.value)
	{
	var t = dsw.value;
	if(t.length>0) {
		t = t.replace(/[^\d\.]+/g, ''); 
	}
	var s = t.split('.');
	if(s.length>1) {
		s[1] = s[0] + '.' + s[1];	
		s.shift(s);
	}
	dsw.value = s.join('');
	}
	if(drht.value)
	{
	var t = drht.value;
	if(t.length>0) {
		t = t.replace(/[^\d\.]+/g, ''); 
	}
	var s = t.split('.');
	if(s.length>1) {
		s[1] = s[0] + '.' + s[1];	
		s.shift(s);
	}
	drht.value = s.join('');
	}
}

function intOnly(i,value)
{	
	var nomtextbox = i;
	var t = nomtextbox.value;
	if(t.length>0) {
		t = t.replace(/[^\d\.]+/g, ''); 
	}
	var s = t.split('.');
	if(s.length>1) {
		s[1] = s[0] + '.' + s[1];	
		s.shift(s);
	}
	nomtextbox.value = s.join('');
	if(nomtextbox.value == "")
	{
		nomtextbox.value = value;
	}
}