Function.prototype.createCallback = function(obj, args) {
    var method = this;
    return function() {
        var callArgs = args || arguments;
        return method.apply(obj || window, callArgs);
        };
};

function sortRandom() {
	return (Math.round(Math.random())-0.5);
}

// TAKEN FROM: http://phrogz.net/JS/Classes/OOPinJS2.html
Function.prototype.inheritsFrom = function( parentClassOrObject ) {
    if ( parentClassOrObject.constructor == Function )
    {
        //Normal Inheritance
        this.prototype = new parentClassOrObject;
        this.prototype.constructor = this;
        this.prototype.parent = parentClassOrObject.prototype;
    }
    else
    {
        //Pure Virtual Inheritance
        this.prototype = parentClassOrObject;
        this.prototype.constructor = this;
        this.prototype.parent = parentClassOrObject;
    }
}