function setfavorite(siteurl,sitename) {
  var name = navigator.appName;
  var useragent = navigator.userAgent;
  var version = parseInt(navigator.appVersion);
  var needtoknow = 1;

  if ( useragent.indexOf("MSIE") != -1) {
      var index = navigator.userAgent.indexOf("MSIE ");
      if ( index != -1 ) {
        version = parseInt(navigator.userAgent.substring(index+5,index+6));
      }
      if ( version > 4) {
        window.external.AddFavorite(siteurl,sitename);
        needtoknow = 0;
      }
  }
  if (needtoknow != 0) {
    openBrWindow('/help/add2favorites.html','winAddFavorites','location=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=450');
  }
}
function sethome(o,siteurl,sitename) {
  var name = navigator.appName;
  var useragent = navigator.userAgent;
  var version = parseInt(navigator.appVersion);
  var needtoknow = 1;

  if ( useragent.indexOf("MSIE") != -1) {
      var index = navigator.userAgent.indexOf("MSIE ");
      if ( index != -1 ) {
        version = parseInt(navigator.userAgent.substring(index+5,index+6));
      }
      if ( version > 4) {
        o.style.behavior='url(#default#homepage)'; o.setHomePage(siteurl);
        needtoknow = 0;
      }
  }
  if (needtoknow != 0) {
    openBrWindow('/help/makehomepage.html','winMakeHomepage','location=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=450');
  }
}
function initLayout() {
    for ( i = 0; i < onLoadFunctions.length; i++ ) {
        var callback = onLoadFunctions[i];
        callback();
    }
}
function resizeLayout() {
    for ( i = 0; i < onResizeFunctions.length; i++ ) {
        var callback = onResizeFunctions[i];
        callback();
    }    
}
function attachLockToSubmits() {
    for (var i = 0; i < document.forms.length; i ++) {
        for (var j = 0; j < document.forms[i].elements.length; j ++) {
            var notLockable = document.forms[i].elements[j].getAttribute('notLockable');

            if (notLockable == null) {
                if (document.forms[i].elements[j].type == 'submit') {
                    Event.observe(document.forms[i].elements[j], 'click', function(event){ event.srcElement.form.submit(); event.srcElement.disabled = true; });
                }

                if (document.forms[i].elements[j].type == 'button') {
                    Event.observe(document.forms[i].elements[j], 'click', function(event){ event.srcElement.click(event); event.srcElement.disabled = true; });
                }
            }
        }
    }
}
function focusThisWindow() {
    window.focus();
}
function openSimpleWindow(url, w, h) {
    window.open(url, null, "height="+h+",width="+w+",status=yes,toolbar=no,menubar=no,location=no");
}
var onLoadFunctions = new Array();
var onResizeFunctions = new Array();
onLoadFunctions.push(attachLockToSubmits);
Event.observe(window, 'load', function(event){ initLayout() });
Event.observe(window, 'resize', function(event){ resizeLayout() });