if (typeof Util == "undefined" || !Util)
{
   var Util = {};
}

Util.startTick = function(p_when, p_scope, p_fn, p_data)
{
   p_when = p_when || 0; 
   p_scope = p_scope || {};
   var fn = p_fn, data = p_data, f, r;

   if (typeof p_fn == "string")
   {
      fn = p_scope[p_fn];
   }

   if (!fn)
   {
      throw new TypeError("method undefined");
   }

   if (Object.prototype.toString.apply(data) != "[object Array]")
   {
      data = [data];
   }

   f = function()
   {
      fn.apply(p_scope, data);
   };

   r = setInterval(f, p_when);

   return (
   {
      cancel: function()
      {
         clearInterval(r);
      }
   });
};

/**
 * Return a random integer value between low and high values
 */
Util.randomInt = function randomInt(low, high)
{
   return Math.floor(Math.random() * (high - low + 1) + low);
};
