/* Easy undefined... */
Function.undefined = function() { return arguments[0]; }
var undefined = Function.undefined();

/* Object property check */
if (!Object.prototype.hasOwnProperty) {
   Object.prototype.hasOwnProperty = function(p) {
      return this.constructor.prototype[p] === undefined;
   };
}

/* Function object check */
Function.is = function(a) {
   return Object.prototype.toString.call(a) === "[object Function]";
};

/* Array(-like) object check */
Array.is = function(a, like)
{
   if (Object.prototype.toString.call(a) === "[object Array]") return true;
   /* try array-like object (arguments) */
   if (!like || a == null || typeof a.length != "number") return false;
   if (a === null || typeof a == "string" || Function.is(a)) return false;
   for (var k in a) if (a.hasOwnProperty(k) && k != "length") return false;
   return like;
};

/* General object to array conversion */
Array.to = function()
{
   var i = -1, li = arguments.length,
         o = Array.is(arguments[0]) ? arguments[i++] : [];
   while (++i < li) {
      if (Array.is(arguments[i], true)) Array.prototype.push.apply(o, arguments[i]);
      else o.push(arguments[i]);
   }
   return o;
};
