function getFieldType(pField) {
// Purpose:  Return Field Type Category
	var iFieldType = "";
	
	if (pField.type == null) {
		iFieldType = pField[0].type;
	} else {
		iFieldType = pField.type;
	}
	
	if ( iFieldType == "text" ) return ( "text" );
	if ( iFieldType == "textarea" ) return ( "text" );
	if ( iFieldType == "password" ) return ( "text" );
	if ( iFieldType == "hidden" ) return ( "text" ); 
	if ( iFieldType == "file" ) return ( "text" ); 
	if ( iFieldType == "radio" || iFieldType == "checkbox" ) return ( "check" ); 
	if ( iFieldType == "select-one" || iFieldType == "select-multiple" ) return ( "select" );
	return ("other");  
}


function getFieldValue ( theField ) { 

vType = getFieldType( theField );

theValue = ""; 
sep = ";"; 

//checkbox is not currently supported
if ( vType == "checkbox" ) return ( "checkbox-Error" );

//text is the user-entered value as a string
if ( vType == "text" ) return ( theField.value ); 

//textarea is the user-entered value as a string array of one element
//if ( vType == "textarea" ) return ( theField.value ); 

//radio buttons and checkboxes are stored in an array and 'checked' if selected
if ( vType == "check" ) { 

    for ( i = 0; i < theField.length; i++ ) { 
        if ( theField[i].checked ) theValue += theField[i].value + sep 
    } 
    if ( theValue.length == 0 ) return("");
    return ( theValue.substring(0, theValue.length - 1) );
} 

//select is an array of selection pointers to an array of strings representing the choices
if ( vType == "select" ) { 

    for ( i = 0; i < theField.options.length; i++ ) {
        if ( theField.options[i].selected ) theValue += theField.options[i].text + sep 
    } 
    if ( theValue.length == 0 ) return("");
    return ( theValue.substring(0, theValue.length - 1) );
}
}