function showhide(theObject)
{
	if (theObject.style.display=="block")
	{
		theObject.style.display="none";
	}
	else
	{
		theObject.style.display="block";
	}
}

function getObject(theObjectID)
// returns the object as element
{
	if (document.all && !document.getElementById)
	{
		return document.all(theObjectID)
	}
	else
	{
		return document.getElementById(theObjectID)
	}
}

function validFields(fieldName, fieldDescription){
	for (i=0;i<(fieldName.length);i++){
		field = getObject(fieldName[i]);
		if (field.value==""){
			window.alert("Please fill "+ fieldDescription[i] +" field");
			field.focus();
			return(false);
		}
	}
	return(true);
}

function clearOptions(theSelect)
// clears(deletes) all options for at theSelect select box
{
	theSelect=getObject(theSelect);
	while (theSelect.options.length>0)
	{
		theSelect.options[theSelect.options.length-1]=null;
	}
}

function addOption(theSelect, theValue, theText)
// adds a new option to theSelect select box
{
	theSelect=getObject(theSelect);
	theSelect.options[theSelect.options.length]=new Option(theText,theValue);
}

function selectOption(theSelect, theValue)
{
	var theSelect = getObject(theSelect);
	var theOptions = theSelect.options;
	var i;

	for(i=0;i<theOptions.length;i++)
	{
		if(theOptions[i].value==theValue)
		{
			theSelect.selectedIndex=i;
			break;
		}
	}
}