function isAlien(a) {
   return isObject(a) && typeof a.constructor != 'function';
}

function isArray(a) {
    return isObject(a) && a.constructor == Array;
}

function isBoolean(a) {
    return typeof a == 'boolean';
}

function isEmpty(o) {
    var i, v;
    if (isObject(o)) {
        for (i in o) {
            v = o[i];
            if (isUndefined(v) && isFunction(v)) {
                return false;
            }
        }
    }
    return true;
}

function isFunction(a) {
    return typeof a == 'function';
}

function isNull(a) {
    return typeof a == 'object' && !a;
}

function isNumber(a) {
    return typeof a == 'number' && isFinite(a);
}

function isObject(a) {
    return (a && typeof a == 'object') || isFunction(a);
}

function isString(a) {
    return typeof a == 'string';
}

function isUndefined(a) {
    return typeof a == 'undefined';
} 

if (!isFunction(Function.apply)) {
/**
* Function::apply()
* 
* apply a function on a target objec
* 
* @param        Function        __function__    function to apply
* @param        Object            __object__        target object
* @param        Array            __arguments__    an array of arguments to pass to the function
* @return        variant            Returns what __function__ returns
* @access        public
* @author        Gwano
* @static
*/
    Function.apply = function(__function__, __object__,  __arguments__) {
        // check the original type of __function__, must be Function
        if (__function__.constructor.toString().indexOf("Function") == -1) return;
        // name of a temporary method created for __object__
        var name = "f";
        // check to prevent the temporary method doesn't already exist
        while (typeof(__object__[name]) != "undefined") {
            // get a random value between 97 and 122, ASCII codes of a to z chars
            var j = Math.floor(Math.random() * 26) + 97;
            // new name for the temporary method
            name += String.fromCharCode(j);
        }
        // temporary method creation 
        __object__[name] = __function__;
        // arguments to pass
        var params = "";
        for (var i=0; i < __arguments__.length; i++) {
            params += "__arguments__[" + (i) + "],";
        }
        params = params.substring(0, params.length-1);
        // method call
        var result = eval("__object__[name](" + params + ")");
        // delete the method (it was temporary)
        delete __object__[name];
        // return the result
        return result;
    }
} 

if (!isFunction(Array.prototype.splice)) {
  Array.prototype.splice=function(i,k)
  {
    for (var z=i; z<this.length-k; z++)
      this[z] = this[z+k];
    this.length = this.length - k;
  }
}

if (!isFunction(Array.prototype.pop)) {
    Array.prototype.pop=function()
    {
	    lastElement = this[this.length-1];
		this.length = Math.max(this.length-1,0);
	    return lastElement;
    };
}

if (!isFunction(Array.prototype.push)) {
    Array.prototype.push=function()
    {
		for(var i=0;i<arguments.length;i++){
            
			this[this.length]=arguments[i]
		};
		return this.length;
    };
}

if (!isFunction(Array.prototype.shift)) {
    Array.prototype.shift=function()
    {
		firstElement = this[0];
		this.reverse();
		this.length = Math.max(this.length-1,0);
		this.reverse();
		return firstElement;
    };
}

if (!isFunction(Array.prototype.unshift)) {
    Array.prototype.unshift=function()
    {
		this.reverse();
		for(var i=arguments.length-1;i>=0;i--){
			this[this.length]=arguments[i]
		}
		this.reverse();
		return this.length
    };
}     