	<!--

		/* --------------------------- STANDARD ROUTINES --------------------------- */

		var ns4 = (document.layers);
		var ie4 = (document.all && !document.getElementById);
		var ie5 = (document.all && document.getElementById);
		var ns6 = (!document.all && document.getElementById);

		function showMenu(where) {
			if (ns4) {
				document.layers[where].style.visibility="visible";
			} else if (ie4) {
				document.all[where].style.visibility="visible";
			} else if (ie5 || ns6) {
				document.getElementById(where).style.visibility="visible";
			}
		}

		function hideMenu(where) {
			if (ns4) {
				document.layers[where].style.visibility="hidden";
			} else if (ie4) {
				document.all[where].style.visibility="hidden";
			} else if (ie5 || ns6) {
				document.getElementById(where).style.visibility="hidden";
			}
		}

		function SwapText(where, what) {
			if (ns4) {
				document.layers[where].innerHTML=what;
			} else if (ie4) {
				document.all[where].innerHTML=what;
			} else if (ie5 || ns6) {
				document.getElementById(where).innerHTML=what;
			}
		}

		function SwapStyles(where, what) {
			if (ns4) {
				document.layers[where].className=what;
			} else if (ie4) {
				document.all[where].className=what;
			} else if (ie5 || ns6) {
				document.getElementById(where).className=what;
			}
		}

		function GetText(where) {
			if (ns4) {
				var what = document.layers[where].innerHTML;
			} else if (ie4) {
				var what = document.all[where].innerHTML;
			} else if (ie5 || ns6) {
				var what = document.getElementById(where).innerHTML;
			}
			return what;
		}

		function GetValue(where) {
			if (ns4) {
				var what = document.layers[where].value;
			} else if (ie4) {
				var what = document.all[where].value;
			} else if (ie5 || ns6) {
				var what = document.getElementById(where).value;
			}
			return what;
		}

		function ClearThis(frm, fld) {
			document[frm][fld].value = "";
		}

		function GetMonths() {
			var moList = {
				"1" : "January",
				"2" : "February",
				"3" : "March",
				"4" : "April",
				"5" : "May",
				"6" : "June",
				"7" : "July",
				"8" : "August",
				"9" : "September",
				"10" : "October",
				"11" : "November",
				"12" : "December"
			}
			return moList;
		}

		function ClearIt(frm, tmp) {
			document[frm][tmp].value = "";
		}

		function DoBox(url,w,h,top,left) {
			window.open(url,'popup','height=' + h + ',width=' + w + ',top=' + top + ',left=' + left + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no');
		}

		function DoBox2(url,w,h,top,left) {
			window.open(url,'popup','height=' + h + ',width=' + w + ',top=' + top + ',left=' + left + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes');
		}

		function CheckRadio(dname,fname,msg,num) {
			var isOk = false;
			for (i = 0; i < num; i++) {
				if (document[dname][fname][i].checked==true) {
					isOk = true;
					break;
				}
			}
			if (isOk == false) {
				alert(msg);
				return true;
			}
		}

		function CheckEmail(dname,fname,msg) {
			var frmName = dname;
			var fldName = fname;
			var alertText = msg;
			var string1 = document[frmName][fldName].value;
			if ((string1.indexOf("@")==-1) || (string1.indexOf(".")==-1)) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
		}

		function CheckNull(dname,fname,msg) {
			var frmName = dname;
			var fldName = fname;
			var alertText = msg;
			var string1 = document[frmName][fldName].value;
			var string2 = string1.replace(/ /g, "");
			if (string2=="") {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
		}

		function CheckDate(dname,fname,msg) {
			var frmName = dname;
			var fldName = fname;
			var alertText = msg;
			var string1 = document[frmName][fldName].value;
			if (string1.indexOf("/")==-1) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
		        var dateArray = string1.split('/');
			if (dateArray.length !== 3) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
			if ((isNaN(dateArray[0])) || (isNaN(dateArray[1])) || (isNaN(dateArray[2]))) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
			var vMonth = dateArray[0];
			var vDay = dateArray[1];
			var vYear = dateArray[2];
			if ((vMonth > 12) || (vMonth < 1)) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
			if ((vDay < 1) || (vDay > 31)) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
			if (vMonth == 2) {
				var febMax = 28;
				var startYear = 1004;
				for (count = 0; count < 1000; count++) {
					startYear = startYear + 4;
					if (vYear == startYear) {
						febMax = 29;
						break;
					}
				}
				if (vDay > febMax) {
					alert(alertText);
					document[frmName][fldName].focus();
					return true;
				}
			}
			if ((vMonth == 4) || (vMonth == 6) || (vMonth == 9) || (vMonth == 11)) {
				if (vDay > 30) {
					alert(alertText);
					document[frmName][fldName].focus();
					return true;
				}
			}
			if ((vMonth == 1) || (vMonth == 3) || (vMonth == 5) || (vMonth == 7) || (vMonth == 8) || (vMonth == 10) || (vMonth == 12)) {
				if (vDay > 31) {
					alert(alertText);
					document[frmName][fldName].focus();
					return true;
				}
			}
			if ((vYear < 1000) || (vYear > 9999)) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
		}


		function NotHere() {
			alert("This item is coming soon. Check back often.  ");
		}


		/* ------------------------------ STANDARD AJAX ---------------------------- */


		function PostItem(theScript, frmName, div) {
			frmName = document.forms[frmName];
			var fld;
			var theData = "";
			for (i = 0; i < frmName.elements.length; i++) {
				fld = frmName.elements[i];
				if ((fld.type !== "button") && (fld.type !== "submit")) {
					if ((fld.type == "radio") || (fld.type == "checkbox")) {
						if (fld.checked) {
							if (i > 0) {
								theData += "&" + fld.name + "=" + escape(fld.value);
							} else {
								theData += fld.name + "=" + escape(fld.value);
							}
						}
					} else {
						if (i > 0) {
							theData += "&" + fld.name + "=" + escape(fld.value);
						} else {
							theData += fld.name + "=" + escape(fld.value);
						}
					}
				}
			}
			var xmlHttp;
			if (xmlHttp = startAjax()) {
				xmlHttp.open("POST", theScript, true);
				xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				xmlHttp.onreadystatechange = function() {
					if (xmlHttp.readyState == 4) {
						var theText = xmlHttp.responseText;
						showMenu(div);
						SwapText(div, theText);
					}
				}
				xmlHttp.send(theData);
			}
		}

		function GetItem(scrp, div, tmp) {
			var theScript = scrp + tmp;
			var xmlHttp;
			if (xmlHttp = startAjax()) {
				xmlHttp.onreadystatechange = function() {
					if(xmlHttp.readyState == 4) {
						var theText = xmlHttp.responseText;
						showMenu(div);
						SwapText(div, theText);
					}
				}
				xmlHttp.open("GET", theScript, true);
				xmlHttp.send(null);
			}
			if (tmp.indexOf("#") == 0) {
				document.location.href = tmp;
			}
		}

		function startAjax() {
			var xmlHttp;
			try {
				xmlHttp = new XMLHttpRequest();
			//	xmlHttp.overrideMimeType("text/xml");
			}
			catch (e) {
				try {
					xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e) {
					try {
						xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch (e) {
						alert("Your browser does not support AJAX.");
						return false;
					}
				}
			}
			return xmlHttp;
		}


		/* ------------------------------ FAUX DB ENGINE --------------------------- */

		function DoQuery1(table, fields, limit) {
			var dataArray = new Array();
			var testArray = new Array();
			var matchArray = new Array();
			var theCount = 0;
			var theData = document.frmData[table].value;
			if (theData.indexOf("||")) {
				bigArray = theData.split("||");
				for (i = 0; i < bigArray.length; i++) {
					if (i == 0) {
						fieldArray = bigArray[i].split("==");
						if (fields !== "all") {
							for (z = 0; z < fieldArray.length; z++) {
								matchArray[fieldArray[z]] = "_";
							}
						}
					} else {
						rowArray = bigArray[i].split("==");
						if (fields == "all") {
							for (f = 0; f < fieldArray.length; f++) {
								dataArray[(i - 1) + fieldArray[f]] = rowArray[f];
							}
							theCount++;
						} else {
							var matchCount = 0;
							if (fields.indexOf("&") > -1) {
								tempArray = fields.split("&");
								for (x = 0; x < tempArray.length; x++) {
									smallArray = tempArray[x].split("=");
									matchArray[smallArray[0]] = smallArray[1];
									matchCount++;
								}
							} else {
								smallArray = fields.split("=");
								matchArray[smallArray[0]] = smallArray[1];
								matchCount++;
							}
							for (x = 0; x < rowArray.length; x++) {
								testArray[fieldArray[x]] = rowArray[x];
							}
							var matched = 0;
							for (z = 0; z < fieldArray.length; z++) {
								if (matchArray[fieldArray[z]] !== "_") {
									if (testArray[fieldArray[z]] == matchArray[fieldArray[z]]) {
										matched++;
									}
								}
							}
							if (matched == matchCount) {
								theCount++;
								for (f = 0; f < fieldArray.length; f++) {
									dataArray[(theCount - 1) + fieldArray[f]] = rowArray[f];
								}
							}
						}
					}
					if ((limit > 0) && (theCount == limit)) {
						dataArray["Count"] = theCount;
						return dataArray;
					}
				}
			}
			dataArray["Count"] = theCount;
			return dataArray;
		}


		/* -------------------------------- EDITOR TOY ----------------------------- */

		function GetSortForm(place, extraid) {
			var theScript = "../modules/moEditorSort.php?itemplace=" + place + "&extraid=" + extraid + "&r=" + Math.random();
			GetItem(theScript, "itemlist", "");
			SwapText("newform", "");
		}

		function GetNewForm(type, place, extraid) {
			if (type == 'image') {
				var theWhere = "../vasdf/admEditorPic.php?itemplace=" + place + "&extraid=" + extraid;
				document.location.href = theWhere;
			} else {
				var newText = "../modules/moEditorNewT.php";
				var newBullets = "../modules/moEditorNewB.php";
				switch (type) {
					case "text":
						theScript = newText;
						break;
					case "bullets":
						theScript = newBullets;
						break;
					default:
						alert("Error!");
						return false;
				}
				theScript += "?itemplace=" + place + "&extraid=" + extraid;
				GetItem(theScript, "newform", "");
				EditorRefresh(place, extraid);
			}
		}

		function GetEmbedForm(id, place, extraid) {
			var theWhere = "../vasdf/admEditorEmbed.php?itemplace=" + place + "&extraid=" + extraid + "&id=" + id + "&r=" + Math.random();
			document.location.href = theWhere;
		}

		function KillEmbed(id) {
			if (confirm("This is permanent and can\'t be reversed!")) {
				GetItem("../modules/moEditorKillEmbed.php?id=" + id + "&r=" + Math.random(), "item" + id, "");
			}
		}

		function EditorUpdate(id, typeid) {
			if (typeid == 0) {
				if (CheckNull('frmText','itemtext','Please enter the Item Text first.')) {
					return false;
				}
				if (!document.frmText.nopic) {
					var theMax = (document.frmText.halfpage.value * 1);
					var picW = document.frmText.picwidth.value;
					var msg = "The image width must be a numeric value from 40 to " + document.frmText.halfpage.value;
					picW = picW.replace(/ /g, "");
					if (isNaN(picW)) {
						alert(msg);
						document.frmText.picwidth.focus();
						return false;
					}
					picW = (picW * 1);
					if ((picW < 40) || (picW > theMax)) {
						alert(msg);
						document.frmText.picwidth.focus();
						return false;
					}
				}
				var theScript = "../modules/moEditorWriteT.php";
			} else if (typeid == 3) {
				var theMax = (document.frmText.pagewidth.value * 1);
				var picW = document.frmText.picwidth.value;
				var msg = "The image width must be a numeric value from 40 to " + document.frmText.pagewidth.value;
				picW = picW.replace(/ /g, "");
				if (isNaN(picW)) {
					alert(msg);
					document.frmText.picwidth.focus();
					return false;
				}
				picW = (picW * 1);
				if ((picW < 40) || (picW > theMax)) {
					alert(msg);
					document.frmText.picwidth.focus();
					return false;
				}
				var theScript = "../modules/moEditorWriteT.php";
			} else if (typeid == 1) {
				var isOK = 0;
				var theField = "";
				var theLimit = document.frmText.bulletcount.value;
				for (i = 1; i < theLimit; i++) {
					theField = document.frmText["bullet" + i].value;
					theField = theField.replace(/ /g, "");
					if (theField !== "") {
						isOK = 1;
						break;
					}
				}
				if (isOK == 0) {
					alert("Please enter at least one bullet-point item.");
					document.frmText.bullet1.focus();
					return false;
				}
				var theScript = "../modules/moEditorWriteB.php";
			}
			PostItem(theScript, "frmText", "item" + id);
		}

		function CheckEditorT() {
			if (CheckNull('frmText','itemtext','Please enter the Item Text first.')) {
				return false;
			}
			var thePlace = document.frmText.itemplace.value;
			var theExtra = document.frmText.extraid.value;
			var theList = "../modules/moEditorList.php?itemplace=" + thePlace + "&extraid=" + theExtra;
			PostItem("../modules/moEditorWriteT.php", "frmText", "trashcan");
			SwapText("newform", "");
			hideMenu("newform");
			SwapText("itemlist", "");
			GetItem(theList, "itemlist", "");
			GetItem(theList, "itemlist", "");
		}

		function CheckEditorB() {
			var bulletMax = 9;
			var isOK = 0;
			var theField = "";
			for (i = 1; i < bulletMax; i++) {
				theField = document.frmText["bullet" + i].value;
				theField = theField.replace(/ /g, "");
				if (theField !== "") {
					isOK = 1;
					break;
				}
			}
			if (isOK == 0) {
				alert("Please enter at least one bullet-point item.");
				document.frmText.bullet1.focus();
				return false;
			}
			var thePlace = document.frmText.itemplace.value;
			var theExtra = document.frmText.extraid.value;
			var theList = "../modules/moEditorList.php?itemplace=" + thePlace + "&extraid=" + theExtra;
			PostItem("../modules/moEditorWriteB.php", "frmText", "trashcan");
			SwapText("newform", "");
			hideMenu("newform");
			SwapText("itemlist", "");
			GetItem(theList, "itemlist", "");
			GetItem(theList, "itemlist", "");
		}

		function EditorRefresh(itemplace, extraid) {
			var theList = "../modules/moEditorList.php?itemplace=" + itemplace + "&extraid=" + extraid;
			GetItem(theList, "itemlist", "");
			SwapText("newform", "");
		}

		function EditorDelete(tmp) {
			if (confirm("This will permanently remove the item!")) {
				GetItem("../modules/moEditorDelete.php?id=" + tmp, "trashcan", "");
				SwapText("item" + tmp, "");
				hideMenu("item" + tmp);
			}
		}

		function EditorDoSort() {
			var numString = document.frmSort.numstring.value;
			var theNum = "";
			if (numString.indexOf(",") > 0) {
				numArray = numString.split(",");
				for (i = 0; i < numArray.length; i++) {
					theNum = document.frmSort["sort" + numArray[i]].value;
					theNum = theNum.replace(/ /g, "");
					if ((isNaN(theNum)) || (theNum == "") || (theNum < 0) || (theNum.indexOf(".") > -1)) {
						document.frmSort["sort" + numArray[i]].value = "0";
					}
				}
			} else {
				theNum = document.frmSort["sort" + numString].value;
				theNum = theNum.replace(/ /g, "");
				if ((isNaN(theNum)) || (theNum == "") || (theNum < 0) || (theNum.indexOf(".") > -1)) {
					document.frmSort["sort" + numString].value = "0";
				}
			}
			var thePlace = document.frmSort.itemplace.value;
			var theExtra = document.frmSort.extraid.value;
			var theList = "../modules/moEditorList.php?itemplace=" + thePlace + "&extraid=" + theExtra;
			PostItem("../modules/moEditorSortWrite.php", "frmSort", "trashcan");
			SwapText("itemlist", "");
			GetItem(theList, "itemlist", "");
			GetItem(theList, "itemlist", "");
		}

		function EditorGetForm(tmp) {
			GetItem("../modules/moEditorItemForm.php?id=" + tmp + "&r=" + Math.random(), "item" + tmp, "");
		}


		/* ------------------------------- CONTACT FORM ---------------------------- */


		function GetContact() {
			GetItem("../modules/moContactForm.php?r=" + Math.random(), "contactbox", "");
		}

		function WriteContact() {
			if (CheckNull('frmContact','gname','Please enter your Name.')) {
				return false;
			}
			var phone = document.frmContact.phone.value;
			var email = document.frmContact.email.value;
			phone = phone.replace(/ /g, "");
			email = email.replace(/ /g, "");
			if ((phone == "") && (email == "")) {
				alert("Please provide either a Phone or an Email address so we can contact you.");
				document.frmContact.email.focus();
				return false;
			}
			if (email !== "") {
				if (CheckEmail('frmContact','email','That Email address doesn\'t look valid.')) {
					return false;
				}
			}
			if (CheckNull('frmContact','msg','Please enter your Message.')) {
				return false;
			}
			PostItem("../modules/moContactWrite.php", "frmContact", "contactbox");
			setTimeout("GetContact()", 6000);
		}

		/* --------------------------- WOOD PICTURE POPUPS ------------------------- */

		function KillPop() {
			SwapText("inner", "");
		}

		function StartPop(pic, top) {

			var theThing = "DoPop('2','" + pic + "','" + top + "')";
			setTimeout(theThing, 250);

			DoPop("1", pic, top);
		}

		function NoPop(pic, top) {
			DoPop("1", pic, top);
		}

		function DoPop(size, pic, top) {

			var theStuff = "";

			var theCenter = (document.frmHide.wide.value / 2);
			var theLeft = (theCenter - Math.round(485 / 2));
			var theGhost = Math.round(theLeft + 7);

			var picWide = document.frmHide["wide-" + pic].value;
			var ghostWide = (picWide - 15);

			if ((size == "1") || (size == "3")) {
				var posLeft = theLeft;
				var tableWide = 485;
				var tableHigh = 336;
				var bgcode = "big";
			} else {
				var posLeft = theGhost;
				var tableWide = 470;
				var tableHigh = 325;
				var bgcode = "small";
				picWide = ghostWide;
			}

			var where = "inner";

			document.getElementById(where).style.visibility = "visible";
			document.getElementById(where).style.position = "absolute";
			document.getElementById(where).style.top = top + "px";
			document.getElementById(where).style.left = posLeft + "px";

			theStuff += "<div id=\"thing\" style=\"background-image: url(../graphics/bg-pop-" + bgcode + ".png); background-position: top left; background-repeat: no-repeat; z-index: 1\">";
			theStuff += "<table width=\"" + tableWide + "\" cellpadding=\"0\" cellspacing=\"0\">";
			theStuff += "<tr height=\"" + tableHigh + "\"><td align=\"center\" valign=\"top\">";


			theStuff += "<table width=\"" + tableWide + "\" cellpadding=\"0\" cellspacing=\"0\">";
			theStuff += "<tr><td onClick=\"KillPop();\" style=\"cursor: pointer\"><img src=\"../graphics/spacer.gif\" height=\"30\" width=\"" + tableWide + "\"></td></tr>";

			theStuff += "<tr><td align=\"center\" valign=\"center\"><!-- ARROW --></td>";
			theStuff += "<tr><td align=\"center\" valign=\"center\">";

			theStuff += "<table width=\"" + picWide + "\" cellpadding=\"2\" cellspacing=\"0\">";
			theStuff += "<tr><td align=\"center\"><div id=\"picture\"><img src=\"../wood/w-" + pic + ".jpg\" width=\"" + picWide + "\"></div></td></tr>";

			if (size == "1") {
				theStuff += "<tr><td class=\"footerCopy\"><div id=\"caption\">" + document.frmHide[pic].value + "</div></td></tr>";
			}

			theStuff += "</table>";

			theStuff += "</td></tr>";
			theStuff += "<tr><td align=\"center\" valign=\"center\"><!-- ARROW --></td></tr>";

			theStuff += "</table>";

			theStuff += "</td></tr>";
			theStuff += "</table>";
			theStuff += "</div>";

			SwapText("inner", theStuff);
			showMenu("inner");

			if (size == "2") {
				var theThing = "NoPop('" + pic + "','" + top + "')";
				setTimeout(theThing, 250);
			}
		}



		/* ----------------------------- SCRIPT SPECIFIC --------------------------- */

		function GetRegister() {
			GetItem("../modules/moRegisterForm.php?r=" + Math.random(), "registerbox", "");
		}

		function WriteRegister() {

			if (CheckNull('frmRegister','gname','Please enter your Name.')) {
				return false;
			}
			if (CheckNull('frmRegister','addr','Please enter your Address.')) {
				return false;
			}
			if (CheckNull('frmRegister','city','Please enter your City.')) {
				return false;
			}
			if (CheckNull('frmRegister','state','Please enter your State.')) {
				return false;
			}
			if (CheckNull('frmRegister','zip','Please enter your Zip code.')) {
				return false;
			}
			if (CheckNull('frmRegister','email','Please enter your Email address.')) {
				return false;
			}
			if (CheckEmail('frmRegister','email','That email address doesn\'t look valid.')) {
				return false;
			}
			if (CheckNull('frmRegister','phone','Please enter your Phone number.')) {
				return false;
			}
			if (CheckNull('frmRegister','store','Please tell us where you bought your flooring.')) {
				return false;
			}
			if (CheckRadio('frmRegister','age','Please tell us the age of your home.', 5)) {
				return false;
			}

			var theNum = document.frmRegister.adults.value;
			theNum = theNum.replace(/ /g, "");
			if ((isNaN(theNum)) || (theNum < 0) || (theNum.indexOf(".") > -1)) {
				alert("The number of adults in your household must \nbe a whole number of zero or greater.");
				document.frmRegister.adults.focus();
				return false;
			}

			theNum = document.frmRegister.children.value;
			theNum = theNum.replace(/ /g, "");
			if ((isNaN(theNum)) || (theNum < 0) || (theNum.indexOf(".") > -1)) {
				alert("The number of children in your household must \nbe a whole number of zero or greater.");
				document.frmRegister.children.focus();
				return false;
			}

			if (CheckRadio('frmRegister','color','Please identify the species/color of your flooring',3)) {
				return false;
			}

			if (CheckNull('frmRegister','feet','Please provide the number of square feet of flooring installed.')) {
				return false;
			}

			theNum = document.frmRegister.feet.value;
			theNum = theNum.replace(/ /g, "");
			if ((isNaN(theNum)) || (theNum < 1) || (theNum.indexOf(".") > -1)) {
				alert("The square footage must be a whole number of greater than 1.");
				document.frmRegister.feet.focus();
				return false;
			}

			var isOk = 0;
			for (i = 1; i < 8; i++) {
				if (document.frmRegister["room" + i].checked == true) {
					isOk++;
					break;
				}
			}
			if (isOk == 0) {
				alert("Please identify at least one room in which your flooring is installed.");
				return false;
			}

			if (document.frmRegister.room7.checked == true) {
				var stuff = document.frmRegister.other.value;
				stuff = stuff.replace(/ /g, "");
				if (stuff == "") {
					alert("Please tell us what \"Other\" is under Rooms Installed.");
					document.frmRegister.other.focus();
					return false;
				}
			}

			PostItem("../modules/moRegisterWrite.php", "frmRegister", "registerbox");
			document.location.href = "#top";
			setTimeout("GetRegister()", 6000);
		}

		function DoSearch() {
			var theStuff = GetValue("query");
			theStuff = theStuff.replace(/ /g, "");
			if (theStuff == "") {
				alert("Please enter a Zip Code first.");
				return false;
			}
			document.frmQuery.query.value = theStuff;
			document.frmQuery.submit();
		}

		function DoBar() {
			var theStuff = "<img src=\"../graphics/waiting.gif\">";
			SwapText("statusbar", theStuff);
		}


	-->
