
function loadPage() {
  if(document.getElementById('dummyFB')) {
    var dummy=document.getElementById('dummyFB');
    dummy.style.display='block';
    dummy.onclick=function(e) {document.getElementById('dummyFB').style.display='none';document.getElementById('passwordFB').focus();}
    dummy.onkeydown=function(e) {document.getElementById('dummyFB').style.display='none';document.getElementById('passwordFB').focus();}
    dummy.onfocus=function(e) {document.getElementById('dummyFB').style.display='none';document.getElementById('passwordFB').focus();}
    document.getElementById('passwordFB').onfocus=function(e) {document.getElementById('dummyFB').style.display='none';}
  }
}
addLoadEvent(loadPage);

/*
* use JS to hide controls which are only required when JS is not enabled
* - do this by adding hideJS as a class to the css
*/
function hideElements() {
  if (document.styleSheets) {
    if (document.styleSheets[0].addRule) {    // IE
      document.styleSheets[0].addRule('.hideJS','display: none',0);
    } else {    // !IE
      document.styleSheets[0].insertRule('.hideJS {display: none}', 0);
    }
  }

}

/*
* Add the onload function to any other onload function
*/
function addLoadEvent(func) {
  var oldonload = window.onload;

  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(hideElements);

// show the form wait box
function showWait(id) {
  if (document.getElementById(id)) {
    var el=document.getElementById(id);

    el.style.position='absolute';
    el.style.left='50%';
    el.style.top='50%';
    el.style.display='block';
    el.style.marginLeft="-" + parseInt(el.offsetWidth  / 2)+'px';
    el.style.marginTop ="-" + parseInt(el.offsetHeight / 2)+'px';
    // IE has a quirk which means we need to reload the animated gif to make it animate
    if (document.getElementById(id+'wImg')) setTimeout("document.getElementById('"+id+"wImg').src=document.getElementById('"+id+"wImg').src",20);
  }
}