var basehref = "";
var popWindowCtr = 0;
var debugtxt;

function relocate(targetform, elemname) {
var newloc = "";
var formElem= targetform.elements[elemname];
var idx = formElem.selectedIndex;
var locval = formElem.options[idx].value;
newloc += locval;
if (locval) {
 document.location.href = basehref + newloc;
 return true;
} else {
 return false;
}

}

function popFAQ(faqterms) {
var params = "width=740,height=500.scrollbars=yes,menubar=no,location=no,status=yes,resizable";
var faqURL = ("/cgi-bin/faq.cgi?mode=search&format=popup&query=" + faqterms);
var newWindow = window.open(faqURL,'faq',params);
newWindow.opener = this.window;
return(false);
}


function popWindow(inWindowname, opener, URL, inParams) {
var defaultParams = "width=600,height=500.scrollbars=yes,menubar=0,location=0,status=0,resizable";
var defaultWindowname = "Popup Window";
var params;
var windowname;

if (!inParams) {
 params = defaultParams;
} else {
 params = inParams;
}
if (!inWindowname) {
 windowname = defaultWindowname;
} else {
 windowname = inWindowname;
}
var uWindow = window.open(URL,windowname,params);
return(false);
}

function writeWindow(inWindowname, opener, htmltext, inParams, focus) {
var defaultParams = "width=600,height=500.scrollbars=yes,menubar=0,location=0,status=0,resizable";
var defaultWindowname = "Write Window";
var params;
var windowname;

if (!inParams) {
 params = defaultParams;
} else {
 params = inParams;
}
if (!inWindowname) {
 windowname = defaultWindowname;
} else {
 windowname = inWindowname;
}
sWindow = window.open('',windowname,params);
sWindow.document.open();
sWindow.document.write("<html><body>");
sWindow.document.write(htmltext);
sWindow.document.write("</body></html>");
sWindow.document.close();
if (!focus)  opener.focus(); 
if (focus) opener.blur();
return (sWindow);
}



function InfoboxWindow(objid) {
var infoURL = ("/cgi-bin/descript_cont.cgi?objid=" + objid);
uWindow = window.open(infoURL,'InfoBox','width=550,height=300,resizable,scrollbars=yes');
return (false);
}


function popWizard(wizard) {
var params = "width=700,height=700,resizable,status,scrollbars";
var wizardURL = ("/html/eng/man/colorcards/" + wizard);
var newWindow = window.open(wizardURL,'wizard',params);
newWindow.opener = this.window;
return(false);
}



function getAll(theForm) {
	var i;
	for (i=0;i<theForm.elements.length;i++) {
		//debugtxt += (theForm.elements[i].name + "\n");
		if (theForm.elements[i].name.substring(0,5) == "quant") {
			theForm.elements[i].value = "1";
		}
	}
	//alert(debugtxt);
	theForm.submit();
return(false);
}

function trashAll(theForm) {
	var i;
	if (theForm.elements) {
		for (i=0;i<theForm.elements.length;i++) {
			//debugtxt += (theForm.elements[i].name + "\n");
			if (theForm.elements[i].name.substring(0,6) == "remove") {
				theForm.elements[i].checked = "true";
			}
		}
	}
	//alert(debugtxt);
return(false);
}

function getNone(theForm) {
	var i;
	for (i=0;i<theForm.elements.length;i++) {
		if (theForm.elements[i].name.substring(0,5) == "quant") {
			theForm.elements[i].value = "";
		}
	}
return(false);
}


