//=============================================================================
//   Gets/sets DOM element attributes in a browser-independent way
//=============================================================================

   /**
    *  Returns the path to a page element.
    *
    *  Example:
    *     sendBody(domGetPath("mybody"));
    */
   function domGetElementPath(element) {
      var result;
      if (document.getElementById) {
         result = "document.getElementById('" + element + "')";
      } else if (document.layers) {
         result = "document.layers['" + element + "']";
      } else if (document.all) {
         result = "document.all['" + element + "']";
      } else {
         alert("Don't know how to work with your browser.");
         result = "";
      }
      return result;
   }

   /**
    *  Returns the path to a page element.
    *
    *  Example:
    *     getColor(domGetPath("mybody", "style.color"));
    */
   function domGetPath(element, attribute) {
      var prefix, suffix;

      prefix = domGetElementPath(element);
      suffix = (attribute == null || attribute.length == 0) ? "" : "." + attribute;

      return prefix + suffix;
   }

   /**
    *  Returns the value of a page element's attribute.
    *
    *  Example:
    *     alert("mybody's color is " + domGet("mybody", "style.color"));
    */
   function domGet(element, attribute) {
      return eval(domGetPath(element, attribute));
   }

   /**
    *  Sets the value of a page element's attribute.
    *
    *  Example:
    *     domSet("mybody", "style.color", "Green");
    */
   function domSet(element, attribute, value) {
      eval(domGetPath(element, attribute) + " = " + value);
   }

   /**
    *  Gets the value of a page element's attribute.
    *
    *  Example:
    *     domArrayGet("mySelect", i, "style.color");
    */
   function domArrayGet(element, index, attribute) {
      var cmd = domGetElementPath(element) + "[" + index + "]." + attribute;
      return eval(cmd);
   }

   /**
    *  Sets the value of a page element's attribute.
    *
    *  Example:
    *     domSet("mySelect", i, "style.color", "Green");
    */
   function domArraySet(element, index, attribute, value) {
      var cmd = domGetElementPath(element) + "[" + index + "]." + attribute + " = " + value;
      eval(cmd);
   }

   /**
    *  Invokes method of a page element.
    *
    *  Example:
    *     domInvoke("myinput", "focus");
    */
   function domInvoke(element, method) {
      eval(domGetElementPath(element) + "." + method + "()");
   }

   /**
    *  Returns the object named element.
    *
    *  Example:
    *     var obj = domGetObject("myTextField");
    */
   function domGetObject(element) {
      return eval(domGetElementPath(element));
   }

   /**
    *  Sets the value of a page element's content.
    *
    *  Example:
    *     domSetContent("mybody", "This is some text");
    */
   function domSetContent(element, value) {
      if (domGetPath(element, "innerHTML") != null) {
         domSet(element, "innerHTML", value);
      }  else {
         var obj = domGetObject(element);
         obj.document.open();
         obj.document.write(value);
         obj.document.close();
      } 
   } 

   function domGetElementByNames(element){
   	  return document.getElementsByName(element); 
   }