/* Create file on the fly... *//**
 * Copyright 2000-2010 Namics AG. All rights reserved.
 * http://www.namics.com
 * Code licence http://www.namics.com/licence.txt
 *
 * Version @VERSION
 * Date @DATE
 *
 * @module Nx
 */
/* 
 * The Nx namespace.
 */
var Nx = Nx || {};

/*
 * The jQuery object.
 */
Nx.$ = jQuery.noConflict(false);
/**
 * Contains the application base config.
 * The base config can be extended or overwritten either via new Application ($ctx, config)
 * during bootstrapping the application or via /public/js/Nx.Config.js in the project folder.
 *
 * @author Remo Brunschwiler
 * @namespace Nx
 * @class Config
 * @static
 */
Nx.Config = {
    /** 
     * The paths for the different dependency types.
     *
     * @property dependencyPath
     * @type Object
     */
    dependencyPath: {
        library: '/js/libraries/dynamic/',
        plugin: '/js/plugins/dynamic/',
        util: '/js/utils/dynamic/'
    }
};

/* Simple JavaScript Inheritance
 * By John Resig http://ejohn.org/
 * MIT Licensed.
 */
(function(){
    var initializing = false, fnTest = /xyz/.test(function() { xyz; }) ? /\b_super\b/ : /.*/;
    
    // The base Class implementation (does nothing)
    this.Class = function(){
    };
    
    // Create a new Class that inherits from this class
    Class.extend = function(prop){
        var _super = this.prototype;
        
        // Instantiate a base class (but only create the instance,
        // don't run the init constructor)
        initializing = true;
        var prototype = new this();
        initializing = false;
        
        // Copy the properties over onto the new prototype
        for (var name in prop) {
            // Check if we're overwriting an existing function
            prototype[name] = typeof prop[name] == "function" &&
            typeof _super[name] == "function" &&
            fnTest.test(prop[name]) ? (function(name, fn){
                return function(){
                    var tmp = this._super;
                    
                    // Add a new ._super() method that is the same method
                    // but on the super-class
                    this._super = _super[name];
                    
                    // The method only need to be bound temporarily, so we
                    // remove it when we're done executing
                    var ret = fn.apply(this, arguments);
                    this._super = tmp;
                    
                    return ret;
                };
            })(name, prop[name]) : prop[name];
        }
        
        // The dummy class constructor
        function Class(){
            // All construction is actually done in the init method
            if (!initializing && this.init) {
				this.init.apply(this, arguments);
			}
        }
        
        // Populate our constructed prototype object
        Class.prototype = prototype;
        
        // Enforce the constructor to be what we expect
        Class.constructor = Class;
        
        // And make this class extendable
        Class.extend = arguments.callee;
        
        return Class;
    };
})();
/**
 * Blackbird - Open Source JavaScript Logging Utility
 * Author: G Scott Olson
 * Web: http://blackbirdjs.googlecode.com/
 *      http://www.gscottolson.com/blackbirdjs/
 * Version: 1.0
 *
 * The MIT License - Copyright (c) 2008 Blackbird Project
 *
 *
 *
 * @description modification
 * modified as jquery plugin - ernscht
 * call this file at http://lab2.namics.com/frontend/tools/js/debug/jquery.log/jquery.log.js
 * it is not nessessary to include additional files as stylesheets, pictures, ...
 * for productive pages use empty methods instead http://lab2.namics.com/frontend/tools/js/debug/jquery.log/jquery.log.production.js
 * the original blackbird uses now .profile() as timer. not changed in $.log();
 *
 * supported browser: IE6, IE7, FF2, FF3, ...
 * requires: jQuery >= 1.2.6
 * tested with 1.2.6, 1.3.0, 1.3.1, 1.3.2, 1.3.4, 1.5, 1.5.1. 1.5.2, 1.6, 1.6.1
 *
 * @example
 * 	$.log.debug('string');		// log a string as debug message
 * 	$.log.info('string');		// log a string as info
 * 	$.log.warn('string');		// log a string as warn
 * 	$.log.error('string');		// log a string as error
 * 	$.log.time('string'); 		// call two times the method .time()
 * 								// with the same string as param
 * 								// to start and stop the timer
 *
 * 
 * -> copy from http://lab2.namics.com/frontend/tools/js/debug/jquery.log/jquery.log.js
 * -> removed CSS style loading
 *
 * @author namics (ernscht@namics.com)
 * @version 1.0
 *
 */
;(function($) {

	var NAMESPACE = 'log';
	var IE6_POSITION_FIXED = true; // enable IE6 {position:fixed}

	var bbird;
	var outputList;
	var cache = [];

	var state = getState();
	var classes = {};
	var profiler = {};

	var IDs = {
		blackbird: 'blackbird',
		checkbox: 'bbVis',
		filters: 'bbFilters',
		controls: 'bbControls',
		size: 'bbSize'
	};
	var messageTypes = { //order of these properties imply render order of filter controls
		debug: true,
		info: true,
		warn: true,
		error: true,
		time: true
	};


	function generateMarkup() { //build markup
		var spans = [];
		for ( var type in messageTypes ) {
			spans.push( [ '<span class="', type, '" type="', type, '"></span>'].join( '' ) );
		}

		var newNode = document.createElement( 'DIV' );
		newNode.id = IDs.blackbird;
		newNode.style.display = 'none';
		newNode.innerHTML = [
			'<div class="bbheader">',
				'<div class="bbleft">',
					'<div id="', IDs.filters, '" class="filters" title="click to filter by message type">', spans.join( '' ), '</div>',
				'</div>',
				'<div class="bbright">',
					'<div id="', IDs.controls, '" class="controls">',
						'<span id="', IDs.size ,'" title="contract" op="resize"></span>',
						'<span class="clear" title="clear" op="clear"></span>',
						'<span class="close" title="close" op="close"></span>',
					'</div>',
				'</div>',
			'</div>',
			'<div class="bbmain">',
				'<div class="bbleft"></div><div class="bbmainBody">',
					'<ol>', cache.join( '' ), '</ol>',
				'</div><div class="bbright"></div>',
			'</div>',
			'<div class="bbfooter">',
				'<div class="bbleft"><label for="', IDs.checkbox, '"><input type="checkbox" id="', IDs.checkbox, '" />Visible on page load</label></div>',
				'<div class="bbright"></div>',
			'</div>'
		].join( '' );
		return newNode;
	}

	function backgroundImage() { //(IE6 only) change <BODY> tag's background to resolve {position:fixed} support
		var bodyTag = document.getElementsByTagName( 'BODY' )[ 0 ];

		if ( bodyTag.currentStyle && IE6_POSITION_FIXED ) {
			if (bodyTag.currentStyle.backgroundImage == 'none' ) {
				bodyTag.style.backgroundImage = 'url(about:blank)';
			}
			if (bodyTag.currentStyle.backgroundAttachment == 'scroll' ) {
				bodyTag.style.backgroundAttachment = 'fixed';
			}
		}
	}

	function addMessage( type, content ) { //adds a message to the output list
		content = ( content.constructor == Array ) ? content.join( '' ) : content;
		if ( outputList ) {
			var newMsg = document.createElement( 'LI' );
			newMsg.className = type;
			newMsg.innerHTML = [ '<span class="icon"></span>', content ].join( '' );
			outputList.appendChild( newMsg );
			scrollToBottom();
		} else {
			cache.push( [ '<li class="', type, '"><span class="icon"></span>', content, '</li>' ].join( '' ) );
		}
	}

	function clear() { //clear list output
		outputList.innerHTML = '';
	}

	function clickControl( evt ) {
		if (!evt) {
			evt = window.event;
		}
		var el = ( evt.target ) ? evt.target : evt.srcElement;

		if ( el.tagName == 'SPAN' ) {
			switch ( el.getAttributeNode( 'op' ).nodeValue ) {
				case 'resize': resize(); break;
				case 'clear':  clear();  break;
				case 'close':  hide();   break;
			}
		}
	}

	function clickFilter( evt ) { //show/hide a specific message type
		if (!evt) {
			evt = window.event;
		}
		var span = ( evt.target ) ? evt.target : evt.srcElement;

		if ( span && span.tagName == 'SPAN' ) {

			var type = span.getAttributeNode( 'type' ).nodeValue;

			if ( evt.altKey ) {
				var filters = document.getElementById( IDs.filters ).getElementsByTagName( 'SPAN' );

				var active = 0;
				for ( var entry in messageTypes ) {
					if (messageTypes[entry]) {
						active++;
					}
				}
				var oneActiveFilter = ( active == 1 && messageTypes[ type ] );

				for ( var i = 0; filters[ i ]; i++ ) {
					var spanType = filters[ i ].getAttributeNode( 'type' ).nodeValue;

					filters[ i ].className = ( oneActiveFilter || ( spanType == type ) ) ? spanType : spanType + 'Disabled';
					messageTypes[ spanType ] = oneActiveFilter || ( spanType == type );
				}
			}
			else {
				messageTypes[ type ] = ! messageTypes[ type ];
				span.className = ( messageTypes[ type ] ) ? type : type + 'Disabled';
			}

			//build outputList's class from messageTypes object
			var disabledTypes = [];
			for ( type in messageTypes ) {
				if (!messageTypes[type]) {
					disabledTypes.push(type);
				}
			}
			disabledTypes.push( '' );
			outputList.className = disabledTypes.join( 'Hidden ' );

			scrollToBottom();
		}
	}

	function clickVis( evt ) {
		if (!evt) {
			evt = window.event;
		}
		var el = ( evt.target ) ? evt.target : evt.srcElement;

		state.load = el.checked;
		setState();
	}


	function scrollToBottom() { //scroll list output to the bottom
		outputList.scrollTop = outputList.scrollHeight;
	}

	function isVisible() { //determine the visibility
		return ( bbird.style.display == 'block' );
	}

	function hide() {
	  bbird.style.display = 'none';
	}

	function show() {
		var body = document.getElementsByTagName( 'BODY' )[ 0 ];
		body.removeChild( bbird );
		body.appendChild( bbird );
		bbird.style.display = 'block';
	}

	//sets the position
	function reposition( position ) {
		if ( position === undefined || position == null ) {
			position = ( state && state.pos === null ) ? 1 : ( state.pos + 1 ) % 4; //set to initial position ('topRight') or move to next position
		}

		switch ( position ) {
			case 0: classes[ 0 ] = 'bbTopLeft'; break;
			case 1: classes[ 0 ] = 'bbTopRight'; break;
			case 2: classes[ 0 ] = 'bbBottomLeft'; break;
			case 3: classes[ 0 ] = 'bbBottomRight'; break;
		}
		state.pos = position;
		setState();
	}

	function resize( size ) {
		if ( size === undefined || size === null ) {
			size = ( state && state.size == null ) ? 0 : ( state.size + 1 ) % 2;
	  	}

		classes[ 1 ] = ( size === 0 ) ? 'bbSmall' : 'bbLarge';

		var span = document.getElementById( IDs.size );
		span.title = ( size === 1 ) ? 'small' : 'large';
		span.className = span.title;

		state.size = size;
		setState();
		scrollToBottom();
	}

	function setState() {
		var props = [];
		for ( var entry in state ) {
			var value = ( state[ entry ] && state[ entry ].constructor === String ) ? '"' + state[ entry ] + '"' : state[ entry ];
			props.push( entry + ':' + value );
		}
		props = props.join( ',' );

		var expiration = new Date();
		expiration.setDate( expiration.getDate() + 14 );
		document.cookie = [ 'blackbird={', props, '}; expires=', expiration.toUTCString() ,';' ].join( '' );

		var newClass = [];
		for ( var word in classes ) {
			newClass.push( classes[ word ] );
		}
		bbird.className = newClass.join( ' ' );
	}

	function getState() {
		var re = new RegExp( /blackbird=({[^;]+})(;|\b|$)/ );
		var match = re.exec( document.cookie );
		return ( match && match[ 1 ] ) ? eval( '(' + match[ 1 ] + ')' ) : { pos:null, size:null, load:null };
	}

	//event handler for 'keyup' event for window
	function readKey( evt ) {
		if (!evt) {
			evt = window.event;
		}
		var code = 113; //F2 key

		if ( evt && evt.keyCode == code ) {

			var visible = isVisible();

			if (visible && evt.shiftKey && evt.altKey) {
				clear();
			}
			else if (visible && evt.shiftKey) {
				reposition();
			}
			else if (!evt.shiftKey && !evt.altKey) {
				(visible) ? hide() : show();
			}
		}
	}


	$[ NAMESPACE ] = {
		toggle:
			function() { ( isVisible() ) ? hide() : show(); },
		resize:
			function() { resize(); },
		clear:
			function() { clear(); },
		move:
			function() { reposition(); },
		debug:
			function( msg ) { addMessage( 'debug', msg ); },
		warn:
			function( msg ) { addMessage( 'warn', msg ); },
		info:
			function( msg ) { addMessage( 'info', msg ); },
		error:
			function( msg ) { addMessage( 'error', msg ); },
		time:
			function( label ) {
				var currentTime = new Date(); //record the current time when time() is executed

				if ( label == undefined || label == '' ) {
					addMessage( 'error', '<b>ERROR:</b> Please specify a label for your timer statement' );
				}
				else if ( profiler[ label ] ) {
					addMessage( 'time', [ label, ': ', currentTime - profiler[ label ],	'ms' ].join( '' ) );
					delete profiler[ label ];
				}
				else {
					profiler[ label ] = currentTime;
					addMessage( 'time', label );
				}
				return currentTime;
			}
	};


	$(window).load(function(){

		var body = document.getElementsByTagName( 'BODY' )[ 0 ];
		bbird = body.appendChild( generateMarkup() );
		var $bbird = $(bbird);
		outputList = bbird.getElementsByTagName( 'OL' )[ 0 ];

		backgroundImage();

		// try to make draggable
		try{
			$bbird.draggable({
				handle: '.bbheader',
				containment: 'window',
	            stop: function(e, ui) {
	            	// position
	            }
			});
		}catch(e){}

		//add events
		$('#'+IDs.checkbox).click(clickVis);
		$('#'+IDs.filters).click(clickFilter);
		$('#'+IDs.controls).click(clickControl);
		$(document).keyup(readKey);

		resize( state.size );
		reposition( state.pos );
		if ( state.load ) {
			show();
			document.getElementById( IDs.checkbox ).checked = true;
		}

		scrollToBottom();

		$[ NAMESPACE ].init = function() {
			show();
			$[ NAMESPACE ].error( [ '<b>', NAMESPACE, '</b> can only be initialized once' ] );
		};


		$(window).unload(function(){
			$('#'+IDs.checkbox).unbind('click');
			$('#'+IDs.filters).unbind('click');
			$('#'+IDs.controls).unbind('click');
			$(document).unbind('keyup');
		});

	});

})(Nx.$);(function($) {
    /**
     * Responsible for application wide issues (ie. the creation of modules).
     *
     * @author Remo Brunschwiler
     * @namespace Nx
     * @class Application
     */
    Nx.Application = Class.extend({

        /**
         * Initializes the Application.
         *
         * @method init
         * @return {void}
         * @constructor
         * @param {jQuery} $ctx the jquery context
         * @param {Object} config the configuration
         */
        init: function($ctx, config) {
            /**
             * The configuration.
             *
             * @property config
             * @type Object
             */
            this.config = $.extend(Nx.Config, config);

            /**
             * The jquery context.
             *
             * @property $ctx
             * @type jQuery
             */
            this.$ctx = $ctx || $('body');

            /**
             * Contains references to all modules on the page.
             * -> could be useful ie. when there are interactions between flash <-> js.
             *
             * @property modules
             * @type Array
             */
            this.modules = [];

            /**
             * Contains references to all connectors on the page.
             *
             * @property connectors
             * @type Object
             */
            this.connectors = {};

            /**
             * Contains references to all wilcard components on the page.
             *
             * @property wildcardComponents
             * @type Array
             */
            this.wildcardComponents = [];

            /**
             * The sandbox to get the resources from (shared between all modules).
             *
             * @property sandbox
             * @type Sandbox
             */
            this.sandbox = new Nx.Sandbox(this, this.config);
        },

        /**
         * Registers all modules in the context scope automatically (as long as the modules uses the oocss naming conventions).
         *
         * @method registerModules
         * @param {jQuery} $ctx the jquery context.
         * @return {Array} a list containing the references of the registered modules.
         */
        registerModules : function($ctx) {
            var that = this,
                    modules = [];

            $ctx = $ctx || this.$ctx;

            $('.mod:not([data-lazyinit=true]):not(.mod[data-lazyinit=true] .mod)', $ctx).each(function() {
                var $this = $(this);

                /*
                 * a module can have 3 types of classes:
                 * 1. .mod -> indicates that it is a base module (default -> no javascript need to be involved)
                 * 2. .mod<moduleName> (ie. .modBasic) -> indicates that it is a module from the type basic (derived from the base module)
                 * 3. .skin<moduleName><skinName> (ie. .skinBasicSubmarine) -> indicates that the module basic has the submarine skin. it will be decorated by the skin js (if existing).
                 *
                 * type 1 must occur exactly once
                 * type 2 can occur at most once
                 * type 3 can occur arbitrarily
                 *
                 * additionaly a module can have 1 type of data attributes:
                 * 1. data-connectors -> a comma separated value containing the connector ids -> schema of a connector id: <connectorName><connectorId><connectorRole>
                 *    (ie. MasterSlave1Master -> name = MasterSlave, id = 1, role = Master)
                 * 	-> indicates that the module should notify the MasterSlave connector (mediator) over all state changes
                 * 	-> the connector id is used to chain the appropriate modules together and to improve the reusability of the connector
                 *
                 * type 1 can contain multiple connector ids (ie. 1,2,MasterSlave1Master)
                 */

                var classes = $this.attr('class').split(' ');

                if (classes.length > 1) {
                    var modName,
                            skins = [],
                            connectors = [];

                    for (var i = 0, len = classes.length; i < len; i++) {
                        var part = $.trim(classes[i]);

                        if (part.indexOf('mod') === 0 && part.length > 3) {
                            modName = part.substr(3);
                        }
                        else if (part.indexOf('skin') === 0) {
                            // remove the mod name part from the skin name
                            skins.push(part.substr(4).replace(modName, ''));
                        }
                    }


                    if ($this.attr('data-connectors')) {
                        connectors = $this.attr('data-connectors').split(',');
                        for (var i = 0, len = connectors.length; i < len; i++) {
                            connectors[i] = $.trim(connectors[i]);
                        }
                    }


                    if (modName && Nx.Module[modName]) {
                        modules.push(that.registerModule($this, modName, skins, connectors));
                    }
                }
            });

            return modules;
        },

        /**
         * Unregisters the modules by the given module instances.
         *
         * @method registerModules
         * @param {Array} modules a list containting the module instances to unregister.
         * @return {void}
         */
        unregisterModules : function(modules) {
            var connectors = this.connectors,
                    wildcardComponents = this.wildcardComponents;

            modules = modules || this.modules;

            if (modules === this.modules) {
                // empy everything if the arrays are equal
                this.wildcardComponents = [];
                this.connectors = [];
                this.modules = [];
            }
            else {
                // unregister the given modules
                for (var i = 0, len = modules.length; i < len; i++) {
                    var module = modules[i];
                    var index;

                    // delete the references in the connectors
                    for (var connId in connectors) {
                        connectors[connId].unregisterComponent(module);
                    }

                    // delete the references in the wildcard components
                    index = $.inArray(module, wildcardComponents);
                    delete wildcardComponents[index];

                    // delete the module instance itself
                    index = $.inArray(module, this.modules);
                    delete this.modules[index];
                }
            }
        },

        /**
         * Starts (intializes) the registered modules.
         *
         * @method start
         * @param {Array} modules a list of the modules to start.
         * @return {void}
         */
        start: function(modules) {
            var wildcardComponents = this.wildcardComponents,
                    connectors = this.connectors;

            modules = modules || this.modules;

            // start the modules
            for (var i = 0, len = modules.length; i < len; i++) {
                modules[i].start();
            }

            /*
             * special treatment for the wildcard connection (conn*) -> it will be notified about
             * all state changes from all connections and is able to propagate its changes to all modules.
             * this must be done on init to make sure that all connectors on the page has been instantiated.
             * only do this for the given modules.
             */
            for (var i = 0, len = wildcardComponents.length; i < len; i++) {
                var component = wildcardComponents[i];
                if ($.inArray(component, modules) > -1) {
                    for (var connectorId in connectors) {
                        // the connector observes the component -> attach it as observer
                        component.attachConnector(connectors[connectorId]);
                        connectors[connectorId].registerComponent(component, '*');
                    }
                }
            }
        },

        /**
         * Stops the registered modules.
         *
         * @method stop
         * @param {Array} modules a list containting the module instances to stop.
         * @return {void}
         */
        stop: function(modules) {
            modules = modules || this.modules;

            // stop the modules
            for (var i = 0, len = modules.length; i < len; i++) {
                modules[i].stop();
            }
        },

        /**
         * Registers a module.
         *
         * @method registerModule
         * @param {jQuery} $node the module node.
         * @param {String} modName the module name. it must match the class name of the module (case sensitive).
         * @param {Array} skins a list of skin names. each entry must match a class name of a skin (case sensitive)).
         * @param {Array} connectors a list of connectors identifiers. schema: <connectorName><connectorId><connectorRole> (ie. MasterSlave1Master).
         * @return {Module} the reference to the registered module.
         */
        registerModule : function($node, modName, skins, connectors) {
            var modules = this.modules;

            modName = modName || null;
            skins = skins || [];
            connectors = connectors || [];

            if (modName && Nx.Module[modName]) {
                // generate a unique id for every module
                var modId = modules.length;
                $node.data('id', modId);

                $.log.debug('instantiate Nx.Module.' + modName);
                modules[modId] = new Nx.Module[modName]($node, this.sandbox, modId);

                for (var i = 0, len = skins.length; i < len; i++) {
                    var skinName = skins[i];

                    if (Nx.Module[modName][skinName]) {
                        $.log.debug('decorate it with the skin Nx.Module.' + modName + '.' + skinName);
                        modules[modId] = modules[modId].getDecoratedModule(modName, skinName);
                    }
                }

                for (var i = 0, len = connectors.length; i < len; i++) {
                    this.registerConnection(connectors[i], modules[modId]);
                }

                return modules[modId];
            }
            else {
                $.log.info('the module Nx.Module.' + modName + ' does not exist');
                return null;
            }
        },

        /**
         * Registers a connection between a module and a connector.
         *
         * @method registerConnection
         * @param {String} connector the full connector name (ie. MasterSlave1Slave).
         * @param {Module} component the module instance.
         * @return {void}
         */
        registerConnection : function(connector, component) {
            var connectorType = connector.replace(/[0-9]+[a-zA-Z]*$/, ''),
                    connectorId = connector.replace(/[a-zA-Z]*$/, '').replace(/^[a-zA-Z]*/, ''),
                    connectorRole = connector.replace(/^[a-zA-Z]*[0-9]*/, '');

            if (connectorId === '*' && connectorRole === '*') {
                // add the component to the wildcard component stack
                this.wildcardComponents.push(component);
            }
            else {
                var connectors = this.connectors;
/*
$.log.info(connectorId);
$.log.info(connectorType);
$.log.info(connectorRole);
*/
                if (!connectors[connectorId]) {
                    // instantiate the appropriate connector if it does not exist yet
                    if (connectorType === '') {
                        connectors[connectorId] = new Nx.Connector(connectorId);
                    }
                    else if (Nx.Connector[connectorType]) {
                        connectors[connectorId] = new Nx.Connector[connectorType](connectorId);
                    }
                }

                if (connectors[connectorId]) {
                    $.log.debug('attach the connector: ' + connectorId);

                    // the connector observes the component -> attach it as observer
                    component.attachConnector(connectors[connectorId]);

                    // the component wants to be informed over state changes -> register it as connector member
                    connectors[connectorId].registerComponent(component, connectorRole);
                }
            }
        }
    });
})(Nx.$);
(function($) {
    /**
     * Base class for the different modules.
     *
     * @author Remo Brunschwiler
     * @namespace Nx
     * @class Module
     */
    Nx.Module = Class.extend({

        /**
         * Initializes the Module.
         *
         * @method init
         * @return {void}
         * @constructor
         * @param {jQuery} $ctx the jquery context
         * @param {Sandbox} sandbox the sandbox to get the resources from
         * @param {String} modId the unique module id
         */
        init: function($ctx, sandbox, modId) {
            /**
             * Contains the module context.
             *
             * @property $ctx
             * @type jQuery
             */
            this.$ctx = $ctx;

            /**
             * Contains the unique module id.
             *
             * @property modId
             * @type String
             */
            this.modId = modId;

            /**
             * Contains the attached connectors.
             *
             * @property connectors
             * @type Array
             */
            this.connectors = [];

            /**
             * Contains the dependency counter for the different phases.
             *
             * @property dependencyCounter
             * @type Object
             */
            this.dependencyCounter = {
                beforeBinding: 0,
                onBinding: 1, // not 0, because of the beforeBinding callback (which is also a dependency)
                afterBinding: 0
            };

            /**
             * The sandbox to get the resources from.
             *
             * @property sandbox
             * @type Sandbox
             */
            this.sandbox = sandbox;
        },

        /**
         * Template method to start (init) the module.
         * This method provides some hook functions which could be overridden from the concrete implementation
         *
         * @method start
         * @return {void}
         */
        start: function() {
            var that = this;

            // call the hook method dependecies from the concrete implementation
            if (this.dependencies) {
                this.dependencyCounter.beforeBinding++;
                this.dependencies();
                this.dependencyCounter.beforeBinding--;
            }

            // start the before binding phase if there are no dependency for this phase
            this.checkDependencies('beforeBinding', function() {
                that.initBeforeBinding();
            });
        },

        /**
         * Template method to stop the module.
         *
         * @method stop
         * @return {void}
         */
        stop: function() {
            var $ctx = this.$ctx;
            
            // remove all bound events and associated jquery data
            $('*', $ctx).unbind().removeData();
            $ctx.unbind().removeData();
        },

        /**
         * Initializes the before binding phase.
         *
         * @method initBeforeBinding
         * @return {void}
         */
        initBeforeBinding: function() {
            var that = this;

            // call the hook method beforeBinding from the concrete implementation
            // because there might be some ajax calls, the bindEvents method must be called from
            // the beforeBinding function after it has been run
            if (this.beforeBinding) {
                this.beforeBinding(function() {
                    that.beforeBindingCallback();
                });
            }
            else {
                this.beforeBindingCallback();
            }
        },

        /**
         * Callback for the before binding phase.
         * 
         * @method beforeBindingCallback
         * @return {void}
         */
        beforeBindingCallback: function() {
            var that = this;

            // decrement the dependency counter for the on binding phase
            this.dependencyCounter.onBinding--;

            // start the on binding phase if there are no dependencies for this phase
            this.checkDependencies('onBinding',function() {
                that.initOnBinding();
            });
        },

        /**
         * Initializes the on binding phase.
         *
         * @method initOnBinding
         * @return {void}
         */
        initOnBinding: function() {
            var that = this;

            // call the hook method bindEvents from the concrete implementation
            if (this.onBinding) {
                this.onBinding();
            }

            // start the after binding phase if there are no dependencies for this phase
            this.checkDependencies('afterBinding', function() {
                that.initAfterBinding();
            });
        },

        /**
         * Initializes the after binding phase.
         *
         * @method initAfterBinding
         * @return {void}
         */
        initAfterBinding: function() {
            var that = this;

            // inform the sandbox that the module is ready for the after binding phase
            this.sandbox.readyForAfterBinding(function() {

                // call the hook method afterBinding from the concrete implementation
                if (that.afterBinding) {
                    that.afterBinding();
                }
            });
        },

        /**
         * Checks the dependency load state of the given phase.
         * Initializes the appropriate phase if all dependencies are loaded.
         *
         * @method checkDependencies
         * @param {String} phase the phase to check / initialize
         * @param {Function} callback the callback to execute if all dependencies were loaded
         * @return {void}
         */
        checkDependencies: function(phase, callback) {
            if (this.dependencyCounter[phase] === 0) {
                // execute the callback
                callback();
            }
        },

        /**
         * Manages the required dependencies.
         *
         * @method require
         * @param {String} dependency the dependency (i.e. swfobject.js)
         * @param {String} type the dependency type (library | plugin | util | url)
         * @param {String} phase the module phase where the dependency is needed (ie. beforeBinding, onBinding)
         * @param {boolean} executeCallback indicates whether the phase callback should be executed or not (useful for dependencies that provide their own callback mechanism)
         * @return {void}
         */
        require: function(dependency, type, phase, executeCallback) {
            
            type = type || 'plugin';
            phase = phase || 'onBinding';
            executeCallback = executeCallback === false ? false : true;

            // increment the dependency counter
            this.dependencyCounter[phase]++;

            // proxy the callback to the outermost decorator
            var callback = $.proxy(function() {
                if (executeCallback) {
                    var that = this;

                    // decrement the dependency counter for the appropriate phase
                    this.dependencyCounter[phase]--;
                    this.checkDependencies(phase, function() {
                        that['init' + Nx.Utils.String.capitalize(phase)]();
                    });
                }
            }, this.sandbox.getModuleById(this.modId));

            this.sandbox.loadDependency(dependency, type, callback, phase);
        },

        /**
         * Notifies all attached connectors about changes.
         *
         * @method fire
         * @param {String} state the new state
         * @param {Object} data the data to provide to your connected modules
         * @param {Function} defaultAction the default action to perform
         * @return {void}
         */
        fire: function(state, data, defaultAction) {
            var that = this,
                connectors = this.connectors;
            
            data = data ||{};
            state = Nx.Utils.String.capitalize(state);

            $.each(connectors, function() {
                var connector = this;

                // callback combining the defaultAction and the afterAction
                var callback = function() {
                    if (typeof defaultAction == 'function') {
                        defaultAction();
                    }
                    connector.notify(that, 'after' + state, data);
                };

                if (connector.notify(that, 'on' + state, data, callback)) {
                    callback();
                }
            });

            if (connectors.length < 1) {
                if (typeof defaultAction == 'function') {
                    defaultAction();
                }
            }
        },

        /**
         * Attaches a connector (observer).
         *
         * @method attachConnector
         * @param {Connector} connector the connector to attach
         * @return {void}
         */
        attachConnector: function(connector) {
            this.connectors.push(connector);
        },

        /**
         * Decorates itself with the given skin.
         *
         * @method getDecoratedModule
         * @param {String} module the name of the module
         * @param {String} skin the name of the skin
         * @return {Module} the decorated module
         */
        getDecoratedModule: function(module, skin) {
            if (Nx.Module[module][skin]) {
                var decorator = Nx.Module[module][skin];

                /*
                 * Sets the prototype object to the module.
                 * So the "non-decorated" functions will be called on the module (without implementing the whole module interface).
                 */
                decorator.prototype = this;
                decorator.prototype.constructor = Nx.Module[module][skin];

                return new decorator(this);
            }
            else {
                $.log.info('the skin ' + skin + ' does not exists for this module');
                return null;
            }
        }
    });
})(Nx.$);

(function($) {
    /**
     * Base class for the different connectors.
     *
     * @author Remo Brunschwiler
     * @namespace Nx
     * @class Connector
     */
    Nx.Connector = Class.extend({

        /**
         * Initializes the Connector.
         *
         * @method init
         * @return {void}
         * @constructor
         * @param {String} connectorId the unique connector id
         * @param {Object} connectorId
         */
        init : function(connectorId) {
            this.connectorId = connectorId;
            this.components = [];
        },

        /**
         * Registers a component.
         *
         * @method registerComponent
         * @param {Module} component the module to register
         * @param {String} role the role of the module (ie. master, slave etc.)
         * @return {void}
         */
        registerComponent: function(component, role) {
            role = role || 'standard';

            this.components.push({
                'component': component,
                'role': role
            });
        },

        /**
         * Unregisters a component.
         *
         * @method unregisterComponent
         * @param {Module} component the module to unregister
         * @return {void}
         */
        unregisterComponent: function(component) {
            var components = this.components;

            for (var id in components) {
                if (components[id].component === component) {
                    delete components[id];
                }
            }
        },

        /**
         * Notifies all registered components about the state change (to be overriden in the specific connectors).
         *
         * @method notify
         * @param {Module} component the module that sends the state change
         * @param {String} state the state
         * @param {Object} data contains the state relevant data (if any)
         * @param {Function} callback the callback function (could be executed after an asynchronous action)
         * @return {boolean} indicates whether the default action should be excuted or not
         */
        notify: function(component, state, data, callback) {
            /* 
             * gives the components the ability to prevent the default- and afteraction from the events
             * (by returning false in the on<Event>-Handler)
             */
            var proceed = true,
                components = this.components;

            for (var id in components) {
                if (components[id].component !== component && components[id].component[state]) {
                    if (components[id].component[state](data, callback) === false) {
                        proceed = false;
                    }
                }
            }

            return proceed;
        }
    });
})(Nx.$);


(function($) {
    /**
     * MasterSlave connector.
     *
     * @author Remo Brunschwiler
     * @namespace Nx.Connector
     * @class MasterSlave
     * @extends Nx.Connector
     */
    Nx.Connector.MasterSlave = Nx.Connector.extend({
		
		/**
		 * Initializes the MasterSlave connector.
		 * 
		 * @method init
		 * @return {void}
	 	 * @constructor
	     * @param {String} connectorId the unique connector id
		 */
		init: function(connectorId) {
	        // call base constructor
	        this._super(connectorId);
	    },
    
        /**
         * Notifies all registered components about the master state change.
         *
         * @method notify
         * @param {Module} component the module that sends the state change
         * @param {String} state the state
         * @param {Object} data contains the state relevant data (if any)
         * @param {Function} callback the callback function (could be executed after an asynchronous action)
         * @return {boolean} indicates whether the default action should be excuted or not
         */
        notify: function(component, state, data, callback) {
            /* 
             * gives the components the ability to prevent the default- and afteraction from the events
             * (by returning false in the on<Event>-Handler)
             */
            var proceed = true, id;
            
            // check whether the component is the master component
            for (id in this.components) {
                if (this.components[id].component.modId === component.modId && this.components[id].role === 'Master') {
                    for (id in this.components) {
                        if (this.components[id].component.modId !== component.modId && this.components[id].component[state]) {
                            if (this.components[id].component[state](data, callback) === false) {
                                proceed = false;
                            }
                        }
                    }
                }
            }
            
            return proceed;
        }
    });
})(Nx.$);
(function($) {
    /**
     * The sandbox is used as a central point to get resources from / grant permissions etc.
     * It is shared between all modules.
     *
     * @author Remo Brunschwiler
     * @namespace Nx
     * @class Sandbox
     */
    Nx.Sandbox = Class.extend({
		
		/**
		 * Initializes the Sandbox.
		 * 
		 * @method init
		 * @return {void}
		 * @constructor
	     * @param {Applicaton} application the application reference
	     * @param {Object} config the configuration
		 */
		init : function(application, config) {
	    
	        /** 
	         * The application
	         *
	         * @property application
	         * @type Application
	         */
	        this.application = application;
	        
	        /** 
	         * The configuration.
	         *
	         * @property config
	         * @type Object
	         */
	        this.config = config;
	        
	        /**
	         * Contains the requested javascript dependencies.
	         *
	         * @property dependencies
	         * @type Array
	         */
	        this.dependencies = [];
	        
	        /**
	         * Contains the afterBinding module callbacks.
	         *
	         * @property afterBindingCallbacks
	         * @type Array
	         */
	        this.afterBindingCallbacks = [];
	    },
    
		/**
		 * Adds (register and start) all modules in the given context scope.
		 * 
		 * @method addModules
		 * @param {jQuery} $ctx the jquery context.
		 * @return {Array} a list containing the references of the registered modules.
		 */
		addModules: function($ctx) {
			var modules = [],
                application = this.application;
			
			if($ctx) {
                // reset lazyinit flags
                $('.mod[data-lazyinit=true]', $ctx).removeAttr('data-lazyinit');

				// register modules
				modules = application.registerModules($ctx);
			
				// start modules
				application.start(modules);
			} 
			
			return modules;
		},
		
		/**
		 * Removes (stop and unregister) the modules by the given module instances.
		 * 
		 * @method removeModules
		 * @param {Array} modules a list containting the module instances to remove.
		 * @return {void}
		 */
		removeModules: function(modules) {
            var application = this.application;
            
			if (modules) {
				// stop modules 
				application.stop(modules);
				
				// unregister modules
				application.unregisterModules(modules);
			}
		},

        /**
         * Gets the appropriate module for the given id.
         *
         * @method getModuleById
         * @param {int} id the module id
         * @return {Module} the appropriate module
         */
        getModuleById: function(id) {
            var application = this.application;
            
            if (application.modules[id] !== undefined) {
                return application.modules[id];
            }
            else {
                throw new Error('the module with the id ' + id + ' does not exist');
            }
        },

        /**
         * Gets the application config.
         *
         * @method getConfig
         * @return {Object} the configuration object
         */
        getConfig: function() {
            return this.config;
        },

        /**
         * Gets an application config param.
         *
         * @method getConfigParam
         * @param {String} name the param name
         * @return {mixed} the appropriate configuration param
         */
        getConfigParam: function(name) {
            var config = this.config;

            if (config.name !== undefined) {
                return config.name;
            }
            else {
                throw new Error('the config param ' + name + ' does not exist');
            }
        },
		
        /**
         * Loads a requested dependency (if not already loaded).
         *
         * @method loadDependency
         * @param {String} dependency the dependency (i.e. swfobject.js)
         * @param {String} type the dependency type (plugin | library | util | url)
         * @param {Function} callback the callback to execute after the dependency has successfully loaded
         * @param {String} phase the module phase where the dependency is needed (ie. beforeBinding, onBinding)
         * @return {void}
         */
        loadDependency: function(dependency, type, callback, phase) {
            var that = this;
            
            phase = phase || 'none'; // none indicates that it is not a dependency for a specific phase
            type = type || 'plugin';

            if (that.dependencies[dependency] && that.dependencies[dependency].state === 'requested') { // requested (but loading not finished)
                $.log.info('dependency ' + dependency + ' already requested');
                
                // the module should be notified, if the dependency has loaded
                that.dependencies[dependency].callbacks.push(function() {
                    callback(phase);
                });
            }
            else if (that.dependencies[dependency] && that.dependencies[dependency].state === 'loaded') { // loading finished
                $.log.info('dependency ' + dependency + ' already loaded');
                callback(phase);
            }
            else {
                $.log.time('load dependency ' + dependency);
                that.dependencies[dependency] = {
                    state: 'requested',
                    callbacks: []
                };
                
                var path;
                
                switch (type) {
                    case 'library':
                    case 'plugin':
                    case 'util':
                        path = this.config.dependencyPath[type];
                        break;
                    case 'url':
                        path = '';
                        break;
                    case 'default':
                        $.log.error('the type ' + type + ' is not known');
                        break;
                }
                
                // load the appropriate dependency
                $.ajax({
                    url: '' + path + dependency,
                    dataType: 'script',
                    cache: true,
                    success: function() {
                        $.log.time('load dependency ' + dependency);
                        that.dependencies[dependency].state = 'loaded';
                        callback(phase);
                        
                        // notify the other modules with this dependency
                        var callbacks = that.dependencies[dependency].callbacks;
                        for (var i = 0; i < callbacks.length; i++) {
                            callbacks[i]();
                        }
                    },
                    error: function() {
                        $.log.error('an error occured during loading the dependency ' + path + dependency);
                    }
                });
            }
        },
        
        /**
         * Collects the module status messages (ready for after binding) and handles the callbacks.
         *
         * @method readyForAfterBinding
         * @param {Function} callback the afterBinding module callback
         * @return {void}
         */
        readyForAfterBinding: function(callback) {
            var afterBindingCallbacks = this.afterBindingCallbacks;
            
            // add the callback to the stack
            afterBindingCallbacks.push(callback);
            
            // check whether all modules are ready for the after binding phase
            if (this.application.modules.length == afterBindingCallbacks.length) {
                for (var i = 0; i < afterBindingCallbacks.length; i++) {
                    afterBindingCallbacks[i]();
                }
            }
        }
    });
})(Nx.$);
/*
 * Contains utility functions for several tasks.
 */
Nx.Utils = {};
/**
 * Contains utility functions for string concerning tasks.
 *
 * @author Remo Brunschwiler
 * @namespace Nx.Utils
 * @class String
 * @static
 */
(function($) {
    Nx.Utils.String = {
        /**
         * Capitalizes the first letter of the given string.
         *
         * @method capitalize
         * @param {String} str the original string
         * @return {String} the capitalized string
         */
        capitalize: function(str) {
            // capitalize the first letter
            return str.substr(0, 1).toUpperCase().concat(str.substr(1));
        }
    };   
})(Nx.$);
/*
 * jQuery UI Autocomplete 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Autocomplete
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.position.js
 */
(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readOnly"))){g=
false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};
this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&
a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");
d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&
b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=
this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();
this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||
b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new d.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;
d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery);
(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.scrollTop(),c=this.element.height();if(b<0)this.element.scrollTop(g+b);else b>=c&&this.element.scrollTop(g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");
this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,
this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[d.fn.prop?"prop":"attr"]("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery);
/*!
 * jQuery UI 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
c.ui.isOverAxis(b,e,i)}})}})(jQuery);
/*
 * jQuery UI Position 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Position
 */
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
/*!
 * jQuery UI Widget 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
(function($) {
    /**
     * ExchangeCalculator module implementation.
     *
     * @author rdudler
     * @namespace Nx.Module
     * @class ExchangeCalculator
     * @extends Nx.Module
     */
    Nx.Module.ExchangeCalculator = Nx.Module.extend({

		/**
		 * Initializes the ExchangeCalculator module.
		 *
		 * @method init
		 * @return {void}
	 	 * @constructor
	     * @param {jQuery} $ctx the jquery context
	     * @param {Sandbox} sandbox the sandbox to get the resources from
	     * @param {String} modId the unique module id
		 */
		init: function($ctx, sandbox, modId) {
	      	// call base constructor
	        this._super($ctx, sandbox, modId);
	    },

        /**
         * Hook function to load the module specific dependencies.
         *
         * @method dependencies
         * @return void
         */
        dependencies: function() {
        },

        /**
         * Hook function to do module specific stuff before binding the events (i.e. fetching some data).
         *
         * @method beforeBinding
         * @param {Function} callback the callback function which must be called at the end
         * @return void
         */
        beforeBinding: function(callback) {
            callback();
        },

        /**
         * Hook function to bind the module specific events.
         *
         * @method onBinding
         * @return void
         */
        onBinding: function() {
            var $ctx = this.$ctx;
            $(".submit", $ctx).click(function() {
                $("form", $ctx).submit();
            });
            $("input[name=fromValue]", $ctx).focus(function() {
                $("input[name=fromValue]", $ctx).val('');
                $("input[name=toValue]", $ctx).val('');
                $(this).addClass('focus');
            });
            $("input[name=toValue]", $ctx).focus(function() {
                $("input[name=fromValue]", $ctx).val('');
                $("input[name=toValue]", $ctx).val('');
                $(this).addClass('focus');
            });
            $("input[name=toValue], input[name=fromValue]", $ctx).blur(function() {
                $(this).removeClass('focus');
            });
            $('.switch').click(function() {
                var source = $('input[name=currencySource]', $ctx).val();
                $('input[name=currencySource]', $ctx).val($('input[name=currencyTarget]', $ctx).val());
                $('input[name=currencyTarget]', $ctx).val(source);
                $("form", $ctx).submit();
            });
        },

        /**
         * Hook function to do module specific stuff after binding the events (i.e. triggering some events).
         *
         * @method afterBinding
         * @return void
         */
        afterBinding: function() {

        }

    });
})(Nx.$);
(function($) {
    /**
     * Footer module implementation.
     *
     * @author rdudler
     * @namespace Nx.Module
     * @class Footer
     * @extends Nx.Module
     */
    Nx.Module.Footer = Nx.Module.extend({
		
		/**
		 * Initializes the Footer module.
		 * 
		 * @method init
		 * @return {void}
	 	 * @constructor
	     * @param {jQuery} $ctx the jquery context
	     * @param {Sandbox} sandbox the sandbox to get the resources from
	     * @param {String} modId the unique module id
		 */
		init: function($ctx, sandbox, modId) {
	      	// call base constructor
	        this._super($ctx, sandbox, modId);
	    },
    
        /**
         * Hook function to load the module specific dependencies.
         *
         * @method dependencies
         * @return void
         */
        dependencies: function() {
        },
        
        /**
         * Hook function to do module specific stuff before binding the events (i.e. fetching some data).
         *
         * @method beforeBinding
         * @param {Function} callback the callback function which must be called at the end
         * @return void
         */
        beforeBinding: function(callback) {
            callback();
        },
        
        /**
         * Hook function to bind the module specific events.
         *
         * @method onBinding
         * @return void
         */
        onBinding: function() {
        
        },
        
        /**
         * Hook function to do module specific stuff after binding the events (i.e. triggering some events).
         *
         * @method afterBinding
         * @return void
         */
        afterBinding: function() {
        
        }
        
    });
})(Nx.$);
(function($) {
    /**
     * Header module implementation.
     *
     * @author rdudler
     * @namespace Nx.Module
     * @class Header
     * @extends Nx.Module
     */
    Nx.Module.Header = Nx.Module.extend({
		
		/**
		 * Initializes the Header module.
		 * 
		 * @method init
		 * @return {void}
	 	 * @constructor
	     * @param {jQuery} $ctx the jquery context
	     * @param {Sandbox} sandbox the sandbox to get the resources from
	     * @param {String} modId the unique module id
		 */
		init: function($ctx, sandbox, modId) {
	      	// call base constructor
	        this._super($ctx, sandbox, modId);
	    },
    
        /**
         * Hook function to load the module specific dependencies.
         *
         * @method dependencies
         * @return void
         */
        dependencies: function() {
        },
        
        /**
         * Hook function to do module specific stuff before binding the events (i.e. fetching some data).
         *
         * @method beforeBinding
         * @param {Function} callback the callback function which must be called at the end
         * @return void
         */
        beforeBinding: function(callback) {
            callback();
        },
        
        /**
         * Hook function to bind the module specific events.
         *
         * @method onBinding
         * @return void
         */
        onBinding: function() {
        
        },
        
        /**
         * Hook function to do module specific stuff after binding the events (i.e. triggering some events).
         *
         * @method afterBinding
         * @return void
         */
        afterBinding: function() {
        
        }
        
    });
})(Nx.$);
(function($) {
    /**
     * NewsList module implementation.
     *
     * @author rdudler
     * @namespace Nx.Module
     * @class NewsList
     * @extends Nx.Module
     */
    Nx.Module.NewsList = Nx.Module.extend({
		
		/**
		 * Initializes the NewsList module.
		 * 
		 * @method init
		 * @return {void}
	 	 * @constructor
	     * @param {jQuery} $ctx the jquery context
	     * @param {Sandbox} sandbox the sandbox to get the resources from
	     * @param {String} modId the unique module id
		 */
		init: function($ctx, sandbox, modId) {
	      	// call base constructor
	        this._super($ctx, sandbox, modId);
	    },
    
        /**
         * Hook function to load the module specific dependencies.
         *
         * @method dependencies
         * @return void
         */
        dependencies: function() {
        },
        
        /**
         * Hook function to do module specific stuff before binding the events (i.e. fetching some data).
         *
         * @method beforeBinding
         * @param {Function} callback the callback function which must be called at the end
         * @return void
         */
        beforeBinding: function(callback) {
            callback();
        },
        
        /**
         * Hook function to bind the module specific events.
         *
         * @method onBinding
         * @return void
         */
        onBinding: function() {
        
        },
        
        /**
         * Hook function to do module specific stuff after binding the events (i.e. triggering some events).
         *
         * @method afterBinding
         * @return void
         */
        afterBinding: function() {
        
        }
        
    });
})(Nx.$);
(function($) {
    /**
     * Search module implementation.
     *
     * @author rdudler
     * @namespace Nx.Module
     * @class Search
     * @extends Nx.Module
     */
    Nx.Module.Search = Nx.Module.extend({

        /**
         * Hook function to bind the module specific events.
         *
         * @method onBinding
         * @return void
         */
        onBinding: function() {
            var $ctx = this.$ctx;
            $.ajax({
                url: $("#search", $ctx).data('url'),
                dataType: 'json',
                success: function(data){
                    var suggestions = new Array();
                    $.each(data.gs, function(index, entry) {
                        var suggestion = {
                            label: entry.label,
                            link: entry.link
                        };
                        suggestions.push(suggestion);
                    });
                    $("#search", $ctx).autocomplete({
                        source: suggestions,
                        autoFocus: true,
                        minLength: 2,
                        position: { offset: "0 -1" },
                        select: function(event, ui) {
                            location.href = ui.item.link;
                            return false;
                        }
                    });
                }
            });


            $("#search", $ctx).focus(function() {
                $('.placeholder', $ctx).hide();
            });
            $("#search", $ctx).blur(function() {
                if ($("#search", $ctx).val() == '') {
                    $('.placeholder', $ctx).show();
                }
            });
            $(".submit", $ctx).click(function() {
                $("form", $ctx).submit();
            });
        },
        
        /**
         * Hook function to do module specific stuff after binding the events (i.e. triggering some events).
         *
         * @method afterBinding
         * @return void
         */
        afterBinding: function() {
        
        }
        
    });
})(Nx.$);
(function($) {
    /**
     * Teaser module implementation.
     *
     * @author rdudler
     * @namespace Nx.Module
     * @class Teaser
     * @extends Nx.Module
     */
    Nx.Module.Teaser = Nx.Module.extend({
		
		/**
		 * Initializes the Teaser module.
		 * 
		 * @method init
		 * @return {void}
	 	 * @constructor
	     * @param {jQuery} $ctx the jquery context
	     * @param {Sandbox} sandbox the sandbox to get the resources from
	     * @param {String} modId the unique module id
		 */
		init: function($ctx, sandbox, modId) {
	      	// call base constructor
	        this._super($ctx, sandbox, modId);
	    },
    
        /**
         * Hook function to load the module specific dependencies.
         *
         * @method dependencies
         * @return void
         */
        dependencies: function() {
        },
        
        /**
         * Hook function to do module specific stuff before binding the events (i.e. fetching some data).
         *
         * @method beforeBinding
         * @param {Function} callback the callback function which must be called at the end
         * @return void
         */
        beforeBinding: function(callback) {
            callback();
        },
        
        /**
         * Hook function to bind the module specific events.
         *
         * @method onBinding
         * @return void
         */
        onBinding: function() {
        
        },
        
        /**
         * Hook function to do module specific stuff after binding the events (i.e. triggering some events).
         *
         * @method afterBinding
         * @return void
         */
        afterBinding: function() {
        
        }
        
    });
})(Nx.$);

