// JavaScript Document

// JavaScript Document
//============Create Cookie=====================//
//get values from querystring
	var args = new Object();
	var query = location.search.substring(1); 		// get query string.
	//alert(query);
	var pairs = "";
	var pairs = query.split(",");					//break at comma
	var hairs = "";
	if (query != "") {
		//alert("boo");
		var hairs = query.split("&");
		var firstpart = hairs[1].split("=");
		var twopart = hairs[2].split("=");					//break at &
		var threepart = hairs[4].split("=");
		//var modelnum = threepart.split(",")
		//alert("Model is " + threepart[1]);
	}	
	//alert(firstpart);
	
	//alert(firstpart[1]);
	//alert(twopart[1]);
function writeWidth() {
	//alert("works");
	if (hairs == "") {
	document.write("<input name=\"Width\" size=\"5\" maxlength=\"100\" value=\"\" />");
				  }
	else {
	document.write("<input name=\"Width\" size=\"5\" maxlength=\"100\" value=\"" + firstpart[1] + "\" />");	
	}
}
function writeLength() {
	if (hairs == "") {
		document.write("<input name=\"Length\" size=\"5\" maxlength=\"100\" value=\"\" />");
	}
	else {
	document.write("<input name=\"Length\" size=\"5\" maxlength=\"100\" value=\"" + twopart[1] + "\" />");	
	}
}
function writeModel() {
	if (hairs == "") {
		document.writeln("<select name=\"bldgmodel\">");
		document.writeln("<option selected=\"selected\">-- Select Model --</option>");
		document.writeln("<option value=\"P-Model\">P-Model</option>");
		document.writeln("<option value=\"G-Model\">G-Model</option>");
		document.writeln("<option value=\"S-Model\">S-Model</option>");
		document.writeln("<option value=\"Q-Model\">Q-Model</option>");
		document.writeln("</select>");
	}
	else {
		var Nomod, Pmod, Gmod, Smod, Qmod;
		if(threepart[1] == "P") {
			Nomod = "";
			Pmod = "selected";
			Gmod = "";
			Smod = "";
			Qmod = "";
		}
		else if(threepart[1] == "G") {
			Nomod = "";
			Pmod = "";
			Gmod = "selected";
			Smod = "";
			Qmod = "";
		}
		else if(threepart[1] == "S") {
			Nomod = "";
			Pmod = "";
			Gmod = "";
			Smod = "selected";
			Qmod = "";
		}
		else if(threepart[1] == "Q") {
			Nomod = "";
			Pmod = "";
			Gmod = "";
			Smod = "";
			Qmod = "selected";
		}
		else {
			Nomod = "selected";
			Pmod = "";
			Gmod = "";
			Smod = "";
			Qmod = "";
		}
		document.writeln("<select name=\"bldgmodel\">");
		document.writeln("<option " + Nomod + ">-- Select Model --</option>");
		document.writeln("<option value='P-Model' " + Pmod + ">P-Model</option>");
		document.writeln("<option value='G-Model' " + Gmod + ">G-Model</option>");
		document.writeln("<option value='S-Model' " + Smod + ">S-Model</option>");
		document.writeln("<option value='Q-Model' " + Qmod + ">Q-Model</option>");
		document.writeln("</select>");
	}
		
}