///
/// Schedule.js
///
/// Modification History
/// 11/27/2007 bf Added code to use AddEvent() to fix problems with IE browser compatibility.
///

function schedule(objectID, functionCall, iteration)
{
	if (iteration == null)
	{
		iteration = 0;
	}
	if (objectID == "window")
	{
	    addEvent(window, "load", functionCall, false)
	}
	else if (document.getElementById(objectID))
	{
		functionCall();
	}
	else if (iteration < 300)
	{
		setTimeout(function(){schedule(objectID, functionCall, iteration + 1)}, 10);
	}
	
	return true;
}

function addEvent(obj, evType, fn, useCapture){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be attached");
  }
} 