window.addEvent('domready',function(){																						
	var actual_switch = 0;	
	var header_navigation = $$('.header_number');
	var fx_content = new Fx.Styles($('header_scroller'), {duration:500, wait:false});									
	$('header_scroller').innerHTML = $('module_'+actual_switch+'_box').innerHTML;											
	(function(){							
		actual_switch+=1;
		if (actual_switch>=banner_headers) actual_switch = 0;					
			header_navigation.each(function(remove_class){
				var banner_id = remove_class.getProperty('id');
				banner_id = banner_id.split('_');
				if(actual_switch==parseInt(banner_id[1])){
					remove_class.addClass('active_header');	
				}
				else{
					remove_class.removeClass('active_header');		
				}													  
			});							
		fx_content.start({
			'opacity': '0'
		}).chain(function(){
			$('header_scroller').innerHTML = $('module_'+actual_switch+'_box').innerHTML;
			fx_content.start({
				'opacity': '1'
			});							
		});								
	}).periodical(4000);									
	header_navigation.each(function(element){
		element.addEvent('mousedown', function() {	
			header_navigation.each(function(remove_class){
				remove_class.removeClass('active_header');										  
			});
			element.addClass('active_header');
			var banner_id = element.getProperty('id');
			banner_id = banner_id.split('_');
			actual_switch = parseInt(banner_id[1]);											
			fx_content.start({
				'opacity': '0'
			}).chain(function(){
				$('header_scroller').innerHTML = $('module_'+actual_switch+'_box').innerHTML;
				fx_content.start({
					'opacity': '1'
				});								
			});							
		});	
	});												
});
