(function() {
	location.parameters = location.search.toQueryParams();
})();





// Initializers

Igglo.addInitializer(function() {
	Igglo.XBrowserSupport.initialize();
}, Igglo.PRIORITY_HIGH);
	
Igglo.addInitializer(function() {
	if ($('main-navigation')) {
		Igglo.MainNavigation.initialize({
			sectionElements: $$('div#main-navigation ul.sections li.section'),
			tabsElements: $$('div#main-navigation ul.tabs')
		});
	}
}, Igglo.PRIORITY_HIGH);

Igglo.addInitializer(function() {
	if ($('user-navigation')) {
		Igglo.UserNavigation.initialize({
			element: $('user-navigation')
		});
	}
}, Igglo.PRIORITY_LOW);

Igglo.addInitializer(function() {
	Igglo.Buttonizer.initialize($$('div#content button.button', 'div#content a.button'));
}, Igglo.PRIORITY_HIGH);
	
Igglo.addInitializer(function() {
	Igglo.ClassCycler.initialize('div#content table.cycler', 'tr', ['c1', 'c2']);
}, Igglo.PRIORITY_HIGH);
	
Igglo.addInitializer(function() {
	Igglo.Popupper.initialize();
}, Igglo.PRIORITY_LOW);
	
Igglo.addInitializer(function() {
	if ($('container')) {
		Igglo.Box.setLimitingElement($('container'));
	}
}, Igglo.PRIORITY_LOW);

Igglo.addInitializer(function() {
	Igglo.Authenticator.initialize($$('div#content .authentication-required'));
}, Igglo.PRIORITY_LOW);



var time;

// Synthetic event, fired from just before </body>
Event.observe(document, 'igglo:load', function() {
	time = (new Date()).getTime();
	Igglo.initialize();
});

// Fallback, double initialization doesn't matter because Igglo can be initialized only once
Event.observe(window, 'load', function() {
	if (time != undefined) {
		Igglo.log('Igglo:load was ' + ((new Date()).getTime() - time) + ' ms faster than window.onload!');	
	}
	Igglo.initialize();
});
