var pslide=false;
var myGallery = false;

window.addEvent('domready',function(){

		var subnavi = $$('#navlist a');
		subnavi.each(function(element) {
 			
 			var subfx = new Fx.Morph(element, {duration:400, wait:false});
 			
 			if (element.hasClass('sel')) {
	 			subfx.set({
					'opacity': 1
				});
			} else {
	 			subfx.set({
					'opacity': 0.01
				});			

				element.addEvent('mouseenter', function(){
					subfx.start({
						'opacity': 1
					});
				});
 	
				element.addEvent('mouseleave', function(){
					subfx.start({
						'opacity': 0.01
					});
				});
			}
 		});
 		
		if (document.getElementById('slidebox')) {
			if ($$('#slidebox .contbox').length > 1) {

				pslide = new noobSlide({
					box: $('slidebox'),
					size: 337,
					items: $$('#slidebox .contbox'),
					addButtons: {
						previous: $('prev'),
						next: $('next')
					},
					handles: $$('#handles span'),
					button_event: 'click',
					fxOptions: {
						duration: 1000,
						transition: Fx.Transitions.Quart.easeInOut,
						wait: false
					},
					onWalk: function(currentItem,currentHandle){

						this.handles.removeClass('active');
						currentHandle.addClass('active');

						if (document.getElementById('spruchbox')) {
							var spruch = $('spruch_' + (this.currentIndex + 1)).get('html');
							var subfade = new Fx.Morph('spruchbox', {duration:400, wait:false});
							if (spruch != "") {

							
								subfade.start({ 'opacity': [1, 0.01] }).chain(function() {
									$('spruchbox').set('html', spruch);
									subfade.start({ 'opacity': [0, 1]});
								});
							}
						}
					}
				});
			} else {
				$('prev').setStyle('display', 'none');
				$('next').setStyle('display', 'none');
				$('handles').setStyle('display', 'none');
				if (document.getElementById('spruchbox') && document.getElementById('spruch_1')) {
					var spruch = $('spruch_1').get('html');
					var subfade = new Fx.Morph('spruchbox', {duration:400, wait:false});
					if (spruch != "") {
						subfade.start({ 'opacity': [1, 0.01] }).chain(function() {
							$('spruchbox').set('html', spruch);
							subfade.start({ 'opacity': [0, 1]});
						});
					}
				}
			}

		}
});

