function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
function createParamsString(o) {
  var val = '';
  var result = '';
  var st = '';
  for (var i=0; i<o.length; i++) {
    x = o.elements[i];
    if (x.name!='') {
      switch (x.type.toLowerCase()) {
        case 'select-one':
        case 'select-multiple':
          st = "";
          for (var j=0; j<x.length; j++) if (x.options[j].selected) st += ',' + x.options[j].value;
          if (st.charAt(0) == ',') st = st.substring(1, st.length);
          result += '&' + x.name + '=' + encodeURIComponent(st)
          break;
        case 'radio':
          if (x.checked) result += '&' + x.name + '=' + encodeURIComponent(x.value)
          break;
        case 'checkbox':
          if (x.checked)
            if (x.value.length==0) result += '&' + x.name + '=yes';
            else result += '&' + x.name + '=' + encodeURIComponent(x.value);
          break;
        default: {
          result += '&' + x.name + '=' + encodeURIComponent(x.value);
        }
      }
    }
  }
  if (result.charAt(0) == '&') result = result.substring(1, result.length);
  return result
}
function getScreenSize() {
  var r = new Array(1);
  r[0] = 0
  r[1] = 0
  r[2] = self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop)
  r[3] = document.width || (document.documentElement && document.documentElement.scrollWidth) || (document.body && document.body.scrollWidth)
  r[4] = document.height || (document.documentElement && document.documentElement.scrollHeight) || (document.body && document.body.scrollHeight)
  if (typeof(window.innerWidth )=='number') {
    r[0] = window.innerWidth;
    r[1] = window.innerHeight;
  } else if (document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    r[0] = document.documentElement.clientWidth;
    r[1] = document.documentElement.clientHeight;
  } else if (document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    r[0] = document.body.clientWidth;
    r[1] = document.body.clientHeight;
  }
  return r;
}
