// This HEAD include file has the basic search scripts required for basic SWG pages
// include syntax: <SCRIPT language="JavaScript" src="/search.js"></SCRIPT>
	
<!-- Note that the HTML encoding command (meta tag) is hidden within a comment so that -->
	<!-- it does not affect the parent template or a user's browser display. -->
	<!-- The actual encoding used when sending this file to the user is admin controlled -->
	<!-- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> -->
	<!-- <META HTTP-EQUIV="Content-Language" CONTENT="en"> -->

var sys_url = location.href.toUpperCase();

if (sys_url.indexOf("WEB55") != "-1") {
    var serv   = "lvc-web55.swgas.com";
} else {
    var serv   = "www.swgas.com";
}

	function onPageLoad(SearchForm, selectQueryField)
	{
		//Start out with the right LoginRequest image
		//Set focus to the query text box
		if (selectQueryField == true)
			SearchForm.query0.focus();
	}

	function doHelp()
	{
		var wLeft  = 0;
		var wTop   = 0;
		if (window.screenX != window.asdf)
		{//Nav
			wLeft  = window.screenX;
			wTop   = window.screenY;
		}
		if (window.screenLeft != window.asdf)
		{//IE
			wLeft  = window.screenLeft;
			wTop   = window.screenTop;
		}
		wLeft = wLeft+25;
		wTop  = wTop+25;
		var location = "location=no,dependent=yes,toolbar=no,menubar=yes,status=yes,scrollbars=yes,resizable=yes,left=" + wLeft + ",top=" + wTop + ",width=700,height=500";
		var w=window.open("/novellsearch/SearchHelp.html",'NWSCHelp',location);
	        w.focus();
	}

	function VerifySearchData(SearchForm)
	{	//return true only if we have a user-entered query
		return (SearchForm.query0.value.length > 0);
	}

	function enable(formElement, activate)
	{
		if (activate == false)
		{
			if (formElement.value == "")
				formElement.disabled = true;
		}
		else
			formElement.disabled = false;
	}

	function doQuery(SearchForm)
	{
            document.SearchForm.action = "http://" + serv + "/qfsearch/SearchServlet?";
            if (document.SearchForm.site.value == "") {document.SearchForm.site.value = serv;}
		if (VerifySearchData(SearchForm) == true)
		{
                  document.SearchForm.site.value = serv;
			//Disable all form elements that are at their current default settings
			for(var x=0;x<SearchForm.elements.length;x++)
				enable(SearchForm.elements[x], false);

	//		var filterCkBoxFld = ( (SearchForm.filter0[0]==document.asdf) ? SearchForm.filter0 : SearchForm.filter0[0] );
	//		if ( (filterCkBoxFld != document.asdf) && (filterCkBoxFld.checked == true) )
//				SearchForm.filteroperator0.value = "0";

			//Submit the form
			SearchForm.submit();
		}
	}

	function write(fldName,fldValue,noWriteValue)
	{
		if (fldValue != noWriteValue)
			document.write("	<INPUT TYPE=\"HIDDEN\" NAME=\"" + fldName + "\" VALUE=\"" + fldValue + "\">\n");
	}
