
// set the hidden "action" field of a form to a specified String value
// the form index starts at 0
// example:  setAction('search',1);

function setAction(actionKey, formIndex)
{
	if (arguments.length < 2)
	{
		formIndex = 0;
	}
	document.forms[formIndex].action.value = actionKey;
}

function setDirtyFlag(formIndex)
{
	if (arguments.length < 2)
	{
		formIndex = 0;
	}
	document.forms[formIndex].dirty.value = 'true';
}



// set the hidden "pagesubmitByUser" field of a form to TRUE
// the form index starts at 0
// example:  setPageSubmitByUser();

function setPageSubmitByUser(formIndex)
{
	if (arguments.length == 0)
	{
		formIndex = 0;
	}
	document.forms[formIndex].pageSubmitByUser.value = 'true';
}



// required by the <tabs> taglib
function submitIfFormValid(tabIdentifier, url) 
{
	document.location.href = url;
}



// expand or collapse a DIV element with a particular ID
// used for category/specialty select fields
function expandIt(whichEl) 
{
	if (navigator.appName == 'Microsoft Internet Explorer')	
	{
			whichEl.style.display = (whichEl.style.display == "block" ) ? "none" : "block";
	}
	else
	{ 
		return;
	}
}



// called before expandIt()
// writes the proper browser-specific style in the page
function writeExpandStyles()
{
	with (document) 
	{
		write("<STYLE TYPE='text/css'>");
		if (navigator.appName == 'Microsoft Internet Explorer')	
		{
			write(".hiddentext {display:none}  .outline {cursor:hand}");
		}
		write("</STYLE>");
	}
}



// clears a multi-select field a resets the default option
function clearMultiSelect(fieldName, defaultText)
{
	document.forms[0].elements[fieldName].options.length = 0;
	document.forms[0].elements[fieldName].options[0] = new Option(defaultText, '', false, false);
}


