/*
 * Form Utility function definitions
 */
 
/*
 * getValue() --
 *	to return the value of the given form element if found; otherwise, the defaultValue, if given,  
 *	is returned in String type
 *
 *	element			: a reference to a form element
 *	defaultValue	: the defaultValue to be returned if the element or its value is not available
 */	 
function getValue(element, defaultValue)
{
	var sReturnValue = getString(defaultValue);
	
	if (null != element)
	{
		if (element.type.indexOf("select") >= 0)
		{
			if ((0 <= element.selectedIndex) && (0 < element.length))
			{ sReturnValue = element.options[element.selectedIndex].value; }
		}
		else //text input
		{
			if ((null != element.value) && (0 < element.value.length))
			{ sReturnValue = element.value; }
		}
	}
	
	return sReturnValue;
}