/**
 * Extensions to the function prototype
 *
 * @author Nikolai Gjerløff <nikolai@resource-it.dk>
 * @version 1.0
 * @package Resource it Modules
 * @copyright Resource it ApS
 **/

Function.prototype.bind = function(parentObj) {
    var func = this;
    var args = new Array();
    for(var i = 0; i < arguments.length - 1; i++) {
	    args[i] = arguments[i+1];
    }
    var temp = function() {
        return func.apply(parentObj, args);
    }
    return(temp);
}//bind

Function.prototype.eventBind = function(parentObj) {
	var func = this;
	var args = arguments;
	var temp = function(evt) {
		if(evt["target"] != undefined) args[0] = evt["target"];
		else args[0] = evt["srcElement"];
		return func.apply(parentObj, args);
	}
	return(temp);
}//eventBird

Function.prototype.argBind = function(parentObj) {
	var func = this;
	var temp = function() {
		return func.apply(parentObj, arguments);
	}
	return(temp);
}//argBind