var Brave = function(){
	return {
		init: function(){
			Skinbox.init( { storage_ns: 'brave' } );
		},
		
		shides: function(){				
			Skinbox.shide( {
				ns: 'welcome',
				element: '.welcome > *:not(.hideit, .clear)',
				trigger: '.welcome .hideit',
				callback: function($, opts, visible){
					if( visible )
					{
						$('.welcome').switchClass('sb-shide-element-off', 'sb-shide-element-on', 500);
					}
					else
					{
						$('.welcome').switchClass('sb-shide-element-on', 'sb-shide-element-off', 500);
					}
				}
			} );
		},
		
		backgroundPicker: function(){
			Skinbox.balloon( {
				name: 'background-picker',
				element: '#background-picker',
				trigger: '#background-picker-trigger > img'
			} );
			
			Skinbox.backgroundSwitcher( {
				triggers: '#background-switcher',
				ns: 'main',
				element: '#branding_left',
				switcher: function($, opts){
					var $animation = $(opts.element);
					
					$animation.animate( { opacity: 0 }, { duration: 500, queue: true } );
					
					$animation.queue( function(next){
						opts.defaultSwitcher();
						next();
					} );
					
					$animation.animate( { opacity: 1 }, { duration: 500, queue: true } );
				}
			} );
		},
	
		dropdowns: function(){
			Skinbox.dropdown( {
				element: '#dropdown_1'
			} );
		}
	};
}();

Skinbox.ready( [
	Brave.init,
	Skinbox.topLink,
	Skinbox.loginBox,
	Skinbox.creditsBox,
	Brave.shides,
	Brave.backgroundPicker,
	Brave.dropdowns
] );
