/**
 * Class to hold util functions for XML
 *
 * @author: Akshay Bhurtun (27-11-2008)
 */

function XMLUtils()
{
};

/**
 * Function to return a list of child nodes with tagname specified by nodeName
 */
XMLUtils.getChildNodesByTagName=function getChildNodesByTagName(xmlDoc, nodeName)
{
   if(xmlDoc == null)
   {
      return new Array();
   }
   var childNodes = xmlDoc.childNodes;
   
   if(childNodes == null)
      return null;
   var nodes = new Array();
   for(var i=0; i<childNodes.length; i++)
   {
      if(childNodes[i].nodeName == nodeName)
         nodes[nodes.length] = childNodes[i];
   }
   return nodes;
};

/**
 * Function to be used to retrieve form elements. This should be used when 
 * dealing with Safari
 */
XMLUtils.getFormElementByName=function getFormElementByName(inputColl, inputName)
{
   var fnName = "XMLUtils.getFormElementByName() ";
   for(var i=0; i<inputColl.length; i++)
   {
      if(inputColl[i].name == inputName)
         return inputColl[i];
   }
   return null;
}; 
