/**
 * init.js
 * Initialises the javascript state when the DOM is ready
 * and when all scripts are loaded
 * Part of twisterss scripts
 */

if( typeof ui == "undefined" )
	var ui = {};

ui.loader = function( domReady )
{
	//We wait for the scripts to be ready
	if( typeof MooTools == "undefined" || typeof ui.layoutChanger == "undefined" )
	{
		window.setTimeout( "ui.loader()", 100 );
		return;
	}
	//the scripts are ready, we wait for the DOM
	if( typeof domReady == "undefined" || domReady == null || domReady == false )
	{
		window.addEvent( 'domready', function()
		{
			this.loader( true );
		}.bind( ui ) );
		return;
	}
	
	//Everything is ready, let's go!
	
	//we hide init elements if any
	//to hide an element at start, just add this class
	$$( '.jsInitHidden' ).setStyle( 'display', 'none' );
		
		
	//we show the elements to switch the layout
	ui.layoutChanger.init.bind( ui.layoutChanger )();
}

ui.loader();
