window.addEvent('domready',function(){				
	if ($$('.content').length > 1) {	
		step = 0;
		
		var mySlider = function(schritt) {
			step = schritt;
			$$('.content').each(function(content, id){
				if (id != step) {
					content.fade('out');
					$$('#preview li').setStyle('background', '#999999');
				}
				else 
				{
					content.fade('in');			
				}	
			});

			
			return step;
		}
	

		var preview = new Element('ul', {
			'id': 'preview'
		});
		$('main').grab(preview);
		
		for ( i=$$('.content').length ; i>0 ; i--) {
			var pageSymbol = new Element('li', {
				'html': i,
				'styles': {
						'cursor': 'pointer'
					},
				'events': {
			        'click': function(event){
						event.stop();
						mySlider(this.get('text').toInt()-1);
						this.setStyles({'background': '#f5f5f5'});
					},	
					'mouseover': function(event){
						this.setStyle('background', '#f5f5f5');						
					},
					'mouseout': function(event){
						if (this.get('text').toInt()-1 != step)
							this.setStyle('background', '#999999');						
					}
				}
			});
			preview.grab(pageSymbol);
		}
		
		$$('.content').each(function(content, id){
			if (id != step) {
				content.fade('hide');
			}
			else 
			{
				content.fade('show');
				$$('#preview li')[$$('.content').length-1-step].setStyles({'background': '#f5f5f5'});
			}	
		});

	}

	
	$$('#mainmenu li ul.submenu li a span').addEvent('mouseenter', function(e){
		$$('#mainmenu li ul.submenu li a span').each(function(li, id){
			li.set('morph', {duration: '200', transition: 'quad:out'});
			li.morph({'padding-right': '40'});
		});
		this.set('morph', {duration: '200', transition: 'quad:out'});
		this.morph({'padding-right': '45'});
	});
	
	$$('#mainmenu li ul.submenu li a span').addEvent('mouseleave', function(e){
		this.set('morph', {duration: '200', transition: 'quad:out'});
		this.morph({'padding-right': '40'})
	});
	
	$$('.logos li img').fade('hide');
	if( $$('.logos li img').length > 0 )
		$$('.logos li img')[0].fade('show');
	$$('.logos li').each(function(listpoint, id) {
		listpoint.addEvent('mouseenter', function(e){
			listpoint.getElement('img').fade('in');
			$$('.logos li img').each(function(listpointother, ido) {
				if( id != ido )
					listpointother.fade('out');				
			});				
		});
	});

	
});

