if(typeof onReady != 'function') { 
  onReady = function() { 
    //alert('Generic onload function');
  };
}



//setup onload function
if(typeof window.addEventListener != 'undefined')
{
  //.. gecko, safari, konqueror and standard
  window.addEventListener('load', onReady, false);
}
else if(typeof document.addEventListener != 'undefined')
{
  //.. opera 7
  document.addEventListener('load', onReady, false);
}
else if(typeof window.attachEvent != 'undefined')
{
  //.. win/ie
  window.attachEvent('onload', onReady);
}

//** remove this condition to degrade older browsers
else
{
  //.. mac/ie5 and anything else that gets this far
  
  //if there's an existing onload function
  if(typeof window.onload == 'function')
  {
    //store it
    var existing = onload;
    
    //add new onload handler
    window.onload = function()
    {
      //call existing onload function
      existing();
      
      //call generic onload function
      onReady();
    };
  }
  else
  {
    //setup onload function
    window.onload = onReady;
  }
};


function hasClass(ele,cls) {
  return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
};

function addClass(ele,cls) {
  if (!this.hasClass(ele,cls)) ele.className += " "+cls;
};

function removeClass(ele,cls) {
  if (hasClass(ele,cls)) {
    var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
    ele.className=ele.className.replace(reg,' ');
  }
};

