//  SRVGS Utility JavaScript Sheet 

/*  *************   onLoad Event Function   *************  */

/*  ********  (See "JavaScript & Ajax" p. 221.)  ********  */

 function addLoadEvent(newFunction)
    {
       var oldonload = window.onload;

       if ( typeof oldonload == "function")
            {
              window.onload = function()
                 {
                   if ( oldonload )
                         {
                           oldonload();
                         }
                   newFunction();
                 }
            } else
                 {
                   window.onload = newFunction;
                 }
     }


/*  ****************************************************  */



/*  *************   insertAfter Function   *************  */

/*  **********  (See "DOM Scripting" p. 257.)  *********  */

 function insertAfter(newElement,targetElement) {
    var parent = targetElement.parentNode;
    if (parent.lastChild == targetElement) {
           parent.appendChild(newElement);
       }  else  {
           parent.insertBefore(newElement,targetElement.nextSibling);
       }
    }


/*  ****************************************************  */




/*  *************   hasClass Function   *************  */

/*  ***********  (my original function)  ************  */

 function hasClass(element,class_name)
    {
       if (element.className)
          {
            var has_it = element.className.indexOf(class_name);
            if ( has_it != -1 )
               {
                 return true;
               }  
                 else 
               {
                 return false;
               }
          }
    }

/*  ****************************************************  */


/*  ***********  (my original function)  ************  */

  function showItems(list) {
       var element = document.getElementById(list);
       element.style.display = "block";
       }

  function hideItems(list) {
       var element = document.getElementById(list);
       element.style.display = "none";
       }

/*  ****************************************************  */
