window.defaultStatus="";

function windy2() {
	window.open('../colorchart.html','windy2','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=570,height=440');
}

function windy3() {
	window.open('../viewlayout.html','windy3','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=570,height=440');
}

function windy4() {
	window.open('../help.html','windy4','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=570,height=440');
}

function windy5() {
	window.open('../library.html','windy5','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=570,height=440');
}

function ow(sName, sUrl, iWidth, iHeight, oCaller) {
	//	Set an object on the form to the name of the calling button.
	var oForm = oCaller.form;
	oForm["PickImage"].value = oCaller.name;
	var oWin = window.open(sUrl, sName, "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=" + iWidth + ",height=" + iHeight);
//	alert(oCaller.name);
//	alert(sName);
//	alert(oWin.document.forms[0].name);
	//	12/21/2004: Commented this as it cause error, but is no longer
	//	functionally needed.
//	for (ii = 0; ii < 100; ii++) {
//		oWin.document.forms[0].Caller.value = oCaller.name;
//	}
}

function ShowImage(oSelect, sFolder) {
	var oForm = oSelect.form;
	var sCurrent = (sFolder == "site") ? "Site" : "User";
	var sImg = oSelect.options[oSelect.selectedIndex].value;
//	alert(sImg);
	for (ii = 0; ii < 100; ii++) {
		var oImg = document.images[sCurrent + "View"];
	}
//	alert(oImg.src);
	if (sFolder == "site") {
		oImg.src = "../" + sImg;
	}
	else {
		oImg.src = sImg;
	}
	oImg.title = sImg + " (" + oImg.width + 'x' + oImg.height + ")";
//	alert(oImg.title);
//	alert(oImg.width + 'x' + oImg.height);
	oForm[sCurrent + "Height"].value = oImg.height;
	oForm[sCurrent + "Width"].value = oImg.width;
}

function SetImage(oThis) {
	var oForm = oThis.form;
	var oOpenForm = opener.document.forms[0];
	var sCurrent = (oThis.name == "SiteChoose") ? "Site" : "User";
//	var sIndex = oForm["Caller"].value;
	var sIndex = oOpenForm["PickImage"].value;
	var oSelect = oForm[sCurrent + "Image"];
//	alert("Vars assigned");
	if (sIndex == "") {
		alert("Caller is undefined. Close window and try again.");
		return false;
	}
//	alert(sIndex);
	var iIndex = sIndex.substr(4, 2);
//	alert(iIndex);
	var sImg = oSelect.options[oSelect.selectedIndex].value;
	if (sImg == "") {
		alert("No image has been selected.");
		return false;
	}
//	alert(iIndex);
//	alert(sImg);
	var oImg = document.images[sCurrent + "View"];
	//	Assign the image file name to the calling form's input field
	//	and erase the alternate image file name.
	if (oOpenForm["BannerImg" + iIndex]) {
		oOpenForm["BannerImg" + iIndex].value = sImg;
	}
	else {
		if (sCurrent == "Site") {
	//		alert(oOpenForm["ourgraphic" + iIndex].value);
			oOpenForm["ourgraphic" + iIndex].value = sImg;
			oOpenForm["visitorgraphic" + iIndex].value = "";
		}
		else {
			oOpenForm["ourgraphic" + iIndex].value = "";
			oOpenForm["visitorgraphic" + iIndex].value = sImg;
		}
	}
	//	Set the dimensions of the image into the calling form.
//	oOpenForm["Height" + iIndex].value = oForm[sCurrent + "Height"].value;
//	oOpenForm["Width" + iIndex].value = oForm[sCurrent + "Width"].value;
	oOpenForm["Height" + iIndex].value = oImg.height;
	oOpenForm["Width" + iIndex].value = oImg.width;

	//	When finished reset the value to blank.
//	oOpenForm["PickImage"].value = "";	//	12/21/2004: We won't reset this.
	return true;
}

function BrowseLayout(oList) {
	var oImg = document.images["LayoutImage"];
//	alert(oImg.src);
// 	alert(oList.options[oList.selectedIndex].value);
 	var s = oList.options[oList.selectedIndex].value;
 	var aVal = s.split("|");
// 	alert(aVal);
 	var sImg =  aVal[1];
//	alert(sImg);
	oImg.src = sImg;
}

function ValidateForm(oForm) {
	var oList = oForm["layoutlist"];
	var sLayout = "";

	if (oForm["setlayout"].value == "set") {
		sLayout = oList.options[oList.selectedIndex].value;
		aLayout = sLayout.split("|");
		oForm["layout"].value = aLayout[0];
	}
//	alert(oForm["layout"].value);
	if (oForm["setlayout"].value == "set" && oList.options[oList.selectedIndex].value == "") {
		alert("You must choose a layout from the list.");
		return false;
	}
	else if (oForm["setlayout"].value == "set" && oList.options[oList.selectedIndex].value != "") {
		//	Pressed the Set Layout button with a value selected.
	}
	else if (oForm["layout"].value == "") {
		alert("You must choose a layout before continuing.");
		return false;
	}
	return true;
}
