/**
 * Provides the main gears for scripting side of Enjin. Start the bare Enjin
 * Scripting Framework.
 *
 * @copyright	Interval © 2011
 * @author	Jason Valdron <jason@intervalweb.ca>
 *
 * @project	Enjin
 * @package	Enjin.Scripts
 * @see		http://enjin.intervalweb.ca/
 *
 * @access	public
 */

Enjin = {

    /**
     * Provides a way to create function dynamically, by passing the list of
     * arguments and the code, without using eval.
     * @access	public
     * @see     http://phpjs.org/functions/create_function:378
     * @return	void
     */
    createFunction: function(args, code){
        try{
            return Function.apply(null, args.split(',').concat(code));
        }catch(e){
            return false;
        }
    }
}

Starter = function(){

    /**
     * Builds the Enjin Framework and loads the includes.
     * @access	public
     * @return	void
     */
    this.init = function(){

        ClassLoader.include('scripts.string');
        
        if(ClassLoader.includes)
        {
            $.each(ClassLoader.includes, function(){
                ClassLoader.include(this.toString());
            });
        }
    }

    this.init();

}

$(document).ready(function(){
    new Starter;
});
