//Empties out drop down lists, except for the 0th item, which usually shows -- Select --
function EmptyOutDropDownList(objDropDownList) {
	with (objDropDownList) {
		for (var i=options.length-1 ;  i > 0 ; i-- ) {
			options[i] = null
		}
	}
	return;
}

function FormatAndDisplayErrorMessage(objDoc) {
	var FailureMsg = "System Error Occurred.\n\n\n"
	FailureMsg += "Type: " + AJAX_FetchXML_TagAttributeValue(objDoc, 'Error', "ErrorType") +'\n\n'
	FailureMsg += "Description: " + AJAX_FetchXML_TagValue(objDoc, 'Error') + '\n\n'
	//FailureMsg += "Context: " + AJAX_FetchXML_TagValue(objDoc, 'contextStatement') + '\n\n'
	FailureMsg += "SQL: " +  AJAX_FetchXML_TagAttributeValue(objDoc, 'Error', "SQL") + '\n\n'
	alert(FailureMsg)
	return
}

// Check the Results tag of the returned XML document.  If the Results say FAILED,
// format and display an error message containing details passed by the server routine.
function CheckServerResultsAndReportErrorAsNeeded(objDoc) {
	var Results = AJAX_FetchXML_TagValue( objDoc, 'Results' );
	if ( Results == "FAILED" ) {
		FormatAndDisplayErrorMessage(objDoc)
		return false;
	}
	else
		return true;
}


