// Adds an event handler to the onload event of the window object
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}


//Added by Paul 7/11/2007 to put ticker on the home page as requested in Fogbugz 2183 (adapted from the site suggested there)
function StartTicker (tickerid) {RunTicker (tickerid, document.getElementById(tickerid).innerHTML, 1);} //start the ticker
function RunTicker (tickerid, tickertext, tickerclear) {
    var ticker_anchor = document.getElementById(tickerid); //get the ticker element
    if (tickerclear) ticker_anchor.innerHTML = ''; //clear the ticker text
    var tickertextnow = ticker_anchor.innerHTML; //the ticker text at the moment
    ticker_anchor.innerHTML = tickertext.substring (0, tickertextnow.length+1) + ((tickertextnow.length+1<tickertext.length) ? "_" : ""); //increase the length by one and add an underscore
    var action_timeout = 100; tickerclear = 0; //default is to wait 50ms and not clear the text
    if (tickertextnow.length+1>=tickertext.length) {action_timeout = 5000; tickerclear = 1;} //if we're at the end, then wait longer and clear next time
    setTimeout ("RunTicker ('" + tickerid + "','" + tickertext + "', " + tickerclear + ")", action_timeout); //run again
}
