/**********************************************************/
/* Copyright © 2004 IntegraSoft Inc. All Rights Reserved. */
/**********************************************************/

      function getNode(parent, tagName, index)
      {
        // Get the Nth node of a certain type within the specified parent node.

        var i;
        var current = -1;
        var max = parent.childNodes.length;

        for(i = 0; i < max; i++)
        {
          if(parent.childNodes[i].tagName)
          {
            if(parent.childNodes[i].tagName.toUpperCase() == tagName.toUpperCase())
            {
              current += 1;
              if(current == index)
              {
                return parent.childNodes[i];
              }
            }
          }
        }

        return null;
      }

      function getLastNode(parent, tagName)
      {
        // Get the last node of a certain type within the specified parent node.

        var i;

        for(i = parent.childNodes.length - 1; i >= 0; i--)
        {
          if(parent.childNodes[i].tagName)
          {
            if(parent.childNodes[i].tagName.toUpperCase() == tagName.toUpperCase())
            {
              return parent.childNodes[i];
            }
          }
        }

        return null;
      }

      function getNodeCount(parent, tagName)
      {
        // Get the number of nodes of a certain type within the specified parent node.

        var i;
        var max = parent.childNodes.length;
        var count = 0;

        for(i = 0; i < max; i++)
        {
          if(parent.childNodes[i].tagName)
          {
            if(parent.childNodes[i].tagName.toUpperCase() == tagName.toUpperCase())
            {
              count += 1;
            }
          }
        }

        return count;
      }

      function getPredecessor(childNode, tagName)
      {
        // Get the first predecessor of the specified node of the specified type.

        var node = childNode.parentNode;
        while(node)
        {
          if(node.tagName && node.tagName.toUpperCase() == tagName.toUpperCase())
          {
            break;
          }
          node = node.parentNode;
        }
        return node;
      }

      function getSource(e)
      {
        // Get the event source.

        if(!e)
        {
          return event.srcElement;
        }
        else
        {
          if(e.srcElement)
          {
            return e.srcElement;
          }
          else
          {
            return e.target;
          }
        }
      }

      function findPosX(obj)
      {
        var x = 0;
        while(obj.offsetParent)
        {
          x += obj.offsetLeft;
          obj = obj.offsetParent;
        }
        return x;
      }

      function findPosY(obj)
      {
        var y = 0;
        while(obj.offsetParent)
        {
          y += obj.offsetTop;
          obj = obj.offsetParent;
        }
        return y;
      }
      
   /*
    *  Javascript from header1.html
    */
  
    // The window to use for popups.
    var window1;    
    function showtour()
    {
        if(window1 != null && (!window1.closed))
        {
            // The popup window has already been opened; just give it focus.
            window1.focus();
        }
        else
        {
            // Create a new popup window.
            var width = 760;
            var height = 700;
            var left = (screen.width - width) / 2;
            var top = (screen.height - height) / 2;
            var features = 'resizable=yes,toolbar=no,status=no,scrollbars=yes,height=' + height + ',width=' + width + ',screenX=' + left + ',screenY=' + top + ',left=' + left + ',top=' + top;
            window1 = window.open('tour/tour1.php', 'DevEngineTour', features);
            window1.opener = self;
        }
    }
    
    //define an array of images to cycle through.
    var imgs = new Array(8);
     imgs[0]="toolBar1.gif";
     imgs[1]="toolBar2.gif";
     imgs[2]="toolBar3.gif";
     imgs[3]="toolBar4.gif";
     imgs[4]="toolBar5.gif";
     imgs[5]="toolBar6.gif";
     imgs[6]="toolBar7.gif";
     imgs[7]="toolBar9.gif";
     
    
    //get a random number
    function get_random()
    {
        var ranNum = Math.round(Math.random()*1000) % imgs.length; 
        return ranNum;
    }
    
    //change toolbar graphic to it
    function newImg()
    {        
        var imgNum=get_random();
        changecss('.toolbarGraphicTD', 'background', 'url(images/toolBarGraphics/' + imgs[imgNum] + ') no-repeat top left');
      }    
    
    //Custom JavaScript Functions by Shawn Olson
    function changecss(theClass,element,value) {
      //documentation for this script at http://www.shawnolson.net/a/503/
       var cssRules;
       if (document.all) {
        cssRules = 'rules';
       }
       else if (document.getElementById) {
        cssRules = 'cssRules';
       }
       
       for (var S = 0; S < document.styleSheets.length; S++){       
        for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {            
         if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
          //alert(document.styleSheets[S][cssRules][R].selectorText + ": " + value);
          document.styleSheets[S][cssRules][R].style[element] = value;
          
         }
        }
       }	
   }
