function getRS(rootnode, iCurRec, sFieldName)
	{
	var iField;
	var sData;
	sData = "";
	for (iField = 0 ; iField < rootnode.childNodes.item(iCurRec).childNodes.length ; iField++){
		if (rootnode.childNodes.item(iCurRec).childNodes.item(iField).tagName  == sFieldName){
			if (rootnode.childNodes.item(iCurRec).childNodes.item(iField).childNodes.length > 0){
				sData = rootnode.childNodes.item(iCurRec).childNodes.item(iField).childNodes.item(0).text;
				}
			else {
				sData = "";
				}
			}
		}
	if (sData == "#20") {
		sData = "&nbsp;";
	}
	return(sData);
	}

function GetRootElement(sreq)
  {
	var source = new ActiveXObject("Microsoft.XMLDOM");
	source.async = false;
	source.load(sreq);
	if (source.parseError != 0)
		{
		alert("Error in "+sreq+": XML Error...<br>reason:" + source.parseError.reason + "<br>"
		+"errorCode:" + source.parseError.errorCode + "<br>"
		+"filepos:" + source.parseError.filepos + "<br>"
		+"line:" + source.parseError.line + "<br>"
		+"linepos:" + source.parseError.linepos + "<br>"
		+"reason:" + source.parseError.reason + "<br>"
		+"srcText:" + source.parseError.srcText + "<br>"
		+"<pre>" + source.xml + "</pre><br>");
		return null;
		//throw "Error";
		}
	else 
		{
		var root = source.documentElement;
		if (root != null && root.childNodes.length !=0)
			{
			var err = getRS(root,0,"Error");
			if (err != "")
				{
				alert("Error: "+err);
				return null;
				//throw "Error";
				}
			}
		return root;
		}
	}
	
function GetAttribute(root, row, col, attrName, defVal)
	{
	var val = defVal;
	var attrs = root.childNodes.item(row).childNodes.item(col).attributes;
	for(var i=0; i < attrs.length; i++)
		if(attrName == attrs[i].nodeName)
			{
			val = attrs[i].nodeValue;
			break;
			}
	return val;
	}
	

