// GSL JAVAScript Utils...

/*
	These functions allow us to parse the XML response of AJAX messages.
*/

// Returns an array of values. The delimiter is the ',' character
function getGSLNodeValues (content, nodeName) {
	var tag = "<" + nodeName + ">";
	var start = content.indexOf (tag);
	var end   = content.indexOf ("</" + nodeName + ">");
	
	if (start < end) {
	    var values = content.substring (start + tag.length, end);
		return values.split (";;");
	} else {
		return new Array (0);
	}
}

// Returns the value of an XML tag
function getGSLNodeValue (content, nodeName) {
	var tag = "<" + nodeName + ">";
	var start = content.indexOf (tag);
	var end   = content.indexOf ("</" + nodeName + ">");
	
	if (start < end) {
		return content.substring (start + tag.length, end);
	} else {
		return null;
	}
}

// Clears a form selection.

function clearSelection(formName, elementName) {
	document.forms[formName].elements[elementName].selectedIndex = -1;
}