// JavaScript Document
var morphClose = function(){

	this.start({
		'top': -270
	});
	if($('browseBoxWrap')) $('browseBoxWrap').setStyle('display','none');
	if($('content-section')) $('content-section').setStyle('display','none');	
	$('closeBtn').setStyle('display','none');
	$('openBtn').setStyle('display','block');

	
	//$('content-section').setStyle('display','none');
}

var morphOpen = function(){
	this.start({
		'top': 0
	});
	if($('browseBoxWrap')) $('browseBoxWrap').setStyle('display','block');
	if($('content-section')) $('content-section').setStyle('display','block');	
	$('closeBtn').setStyle('display','block');
	$('openBtn').setStyle('display','none');
	//$('content-section').setStyle('display','block');
}
function morphingIntro(){
		
		var introPic = $('introPic');
		document.getElementById('introPic').style.position = 'absolute';
		document.getElementById('introPic').style.top = '-10000';
		document.getElementById('introPic').style.display = 'none';
		$('box1').setStyle('display','block');
		if($('content-container')){
			$('content-container').setStyle('top',-262);
		}
		contentMorph.delay(100);
}

function contentMorph(){
	var morphCon = $('content-container');
 
	var morphContent = new Fx.Morph(morphCon, {

		duration: 2000,
		transition: 'quad:in:out',
		onComplete: function(){

		}	
	});

	morphContent.set({
		'top': -262
	});
	 
	morphContent.start({
		'top': 0
	});
}
window.addEvent('domready',function(){
	
	if($('introPic') ){
	document.getElementById('introPic').style.display = 'none';
		
		if( showVisual(id) == true ){	
		document.getElementById('introPic').style.display = '';
			//if(typeof(swfobject)!="undefined")
			//{
				swfobject.embedSWF("fileadmin/flash/wige_intro.swf", "introPic", "893", "381", "9.0.0", "expressInstall.swf", flashvars, params, attributes, function(e){if(!e.success){var st = setTimeout('morphingIntro()',2000);}});
			//}else
			//{
				//morphingIntro.delay(5000);
			//}
			
			$('box1').setStyle('display','none');
			$('content-container').setStyle('top',-262);
	 		
	 	}else{
	 		morphingIntro();
	 	}
	}
	
	if($('content-container')){
		var morphCon = $('content-container');
	} else if($('content-container-spezial')){
		var morphCon = $('content-container-spezial');
	}
	if(morphCon){
		var morphContent = new Fx.Morph(morphCon, {
			duration: 2000,
			transition: 'quad:in:out',
			onComplete: function(){
			}	
		});
		
		if($('introPic')){	
			morphContent.set({
				'top': -262
			});
		} else {
			morphContent.set({
				'top': -262
			});
			
			morphContent.start({
				'top': 0
			});
		}
		if($('closeBtn')){
			$('closeBtn').setStyle('opacity','0.6');
			$('closeBtn').addEvents({
				'mouseover': function(){
					this.setStyle('opacity','1');
					this.setStyle('text-decoration','none');
				},
				'mouseout': function(){
					this.setStyle('opacity','0.6');
					this.setStyle('text-decoration','none');
				}
			});
			$('closeBtn').addEvent('click', morphClose.bind(morphContent));
		}
		if($('openBtn')){
			$('openBtn').setStyle('opacity','0.6');
			$('openBtn').addEvents({
				'mouseover': function(){
					this.setStyle('opacity','1');
					this.setStyle('text-decoration','none');
				},
				'mouseout': function(){
					this.setStyle('opacity','0.6');
					this.setStyle('text-decoration','none');
				}
			});
			$('openBtn').addEvent('click', morphOpen.bind(morphContent));
		}
		
		if($('nextBtn')){
			$('nextBtn').setStyle('opacity','0.6');
			$('nextBtn').addEvents({
				'mouseover': function(){
					this.setStyle('opacity','1');
					this.setStyle('text-decoration','none');
				},
				'mouseout': function(){
					this.setStyle('opacity','0.6');
					this.setStyle('text-decoration','none');
				}
			});
		}
		if($('prevBtn')){
			$('prevBtn').setStyle('opacity','0.6');
			$('prevBtn').addEvents({
				'mouseover': function(){
					this.setStyle('opacity','1');
					this.setStyle('text-decoration','none');
				},
				'mouseout': function(){
					this.setStyle('opacity','0.6');
					this.setStyle('text-decoration','none');
				}
			});
		}
	}
});
