  var floatingBarDiv;
  var dockingBarDiv;  
  var dockingBarDivImages;
  var MSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false;
  var Opera = navigator.userAgent.indexOf('Opera')>=0?true:false;
  var navigatorVersion = navigator.appVersion.replace(/.*?MSIE (\d\.\d).*/g,'$1')/1;
  
  /*  Functions that are executed when buttons are clicked */
  function jsAction1()
  {
    alert('You clicked a button');
  }



    
  function addButtons(initObj)
  {
    for(var no=0;no<toolbarNames.length;no++){
      var newlink = document.createElement('A');
    
      
      newlink.setAttribute('href',toolbarLinks[no]);
      tn = document.createTextNode(toolbarNames[no]);
      newlink.appendChild(tn);
      initObj.appendChild(newlink);
      if(no < toolbarNames.length) {
        var theTextOfTheParagraph = document.createTextNode(' | ');
        initObj.appendChild(theTextOfTheParagraph);
      }
    }
  }
  
  
  function initMenuWithDocking()
  {   
    /* Creating spacer of the same height as the top bar */
    var dockingBarSpacer = document.createElement('DIV');
    dockingBarSpacer.id = 'dockingBarSpacer';   
    document.getElementsByTagName('body')[0].appendChild(dockingBarSpacer);

    /* Creating docking bar */
    dockingBarDiv = document.createElement('DIV');
    dockingBarDiv.id = 'dockingBar';    
    document.body.appendChild(dockingBarDiv);
    
    var spacerRow = document.createElement('DIV');
    spacerRow.innerHTML = '<span></span>';
    spacerRow.style.marginTop = '5px';
    spacerRow.className = 'spacer';
    dockingBarDiv.appendChild(spacerRow);
    
    dockingBarDivImages = document.createElement('DIV');
    dockingBarDivImages.id = 'dockingBarImageHolder';
    dockingBarDiv.appendChild(dockingBarDivImages); 
    
    var spacerRow = document.createElement('DIV');
    spacerRow.innerHTML = '<span></span>';
    spacerRow.className = 'spacer';
    dockingBarDiv.appendChild(spacerRow);
          
    addButtons(dockingBarDivImages);

    // General events
    repositionDockingBar();
    
      window.onscroll = repositionDockingBar;
    window.onresize = repositionDockingBar;
  }
  
  // taken from "http://www.howtocreate.co.uk/tutorials/javascript/browserwindow"
  function returnWindowHeight() 
  {
    var  myHeight = 0;
    if( typeof( window.innerWidth ) == 'number' ) 
    {
      //Non-IE
      myHeight = window.innerHeight;
    } 
    else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
    {
      //IE 6+ in 'standards compliant mode'
      myHeight = document.documentElement.clientHeight;
    }   
    else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
    {
      //IE 4 compatible
      myHeight = document.body.clientHeight;
    }
    
    return myHeight;
  }
  
  function repositionDockingBar()
  {
     
        availH = returnWindowHeight() - 25;

    if(MSIE && navigatorVersion<6){
      dockingBarDiv.style.top = availH  + 'px';
    }else{
      dockingBarDiv.style.top = availH  + 'px';
    }
  }
  
  window.onload = initMenuWithDocking;