// These are some cross-browser frontends for common functions.


// Preserve existing onload
//   Use in place of "window.onLoad"
function addOnload(func) {
  if (typeof(func) != 'function') {
    alert("addOnLoad: Invalid argument");
    return;
  }
  var prevOnload = window.onload;
  window.onload = function() {
    if(prevOnload != null && typeof(prevOnload) == 'function') {
      prevOnload();
    }
    func();
  }
}


function setCookie(name,value,days,path) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = '; expires='+date.toGMTString();
  }
  else var expires = '';
  if (!path || path == '') path = '/';
  document.cookie = encodeURIComponent(name)+'='+encodeURIComponent(value)+expires+'; path='+ path;
}

