﻿var onload_procs = new Array();

window.onload = window_onload;

function window_onload(){
  for(var x = 0; x < onload_procs.length; x++){
    onload_procs[x]();
  }
}

function getElement(id){ 
  try{
    if (document.getElementById) return document.getElementById(id);
    else return eval("document.all." + id);
  }catch(e){
    return null;
  }
} 

// Standard trimming procedure
if (!String.prototype.trim){
  String.prototype.trim = function(){
    // Trim leading and trailing spaces -- will work on multi-line strings as well
    return this.replace(/^ +| +$/gm, "");
  };
}

// Effects the same results as .Net format method (C# or VB)
if (!String.prototype.format){
  String.prototype.format = function(){
    var ret = this;
    
    for(x = 0; x < arguments.length; x++){
      var re = new RegExp("\\{" + x + "}", "g");
      ret = ret.replace(re, arguments[x]);
    }
    
    return ret;
  };
}