Fx.Styles.implement({
    
    move: function(topTo, leftTo){
        this.start({'top': [this.el.getStyle('top', true), topTo], 'left': [this.el.getStyle('left', true), leftTo]});
    }
    
});

function overlayFade(type)
{
	
		var animFadeIn = new Fx.Style($('overlay'), "opacity", {
				duration: 100
			})
			if(type == 'in')
				animFadeIn.start(1, 0);
			else
				animFadeOut.start(0,1);
}
function pageFade(any,element)
{
	
	if(typeof element != 'undefined') {
				var animFade = new Fx.Style($(element), "opacity", {
				duration: 700
				});
				
				if(any == 'out')
				animFade.start(1, 0);
				else {
				animFade.start(0, 1);
				}
				
			}
			else {		
				
				var animFade = new Fx.Style($('pageOverlay'), "opacity", {
				duration: 700
				});
				if(any == 'out')
				animFade.start(0, 1);
				else {
					animFade.start(1, 0);
				}
				
			}
			
}
function homeAnimation() {

	/**

	var myHomeEffects = new Fx.Styles('moving_home_image', {duration: 3000, transition: Fx.Transitions.linear,onComplete: ( 
	function() { 
		 $('moving_home_bg').effect('opacity',{duration:2000}).custom(1,0);
		 var anyDiv = $('moving_home_image_container').setStyles({'width':'379px'}); 
	})});
  	
	**/
	
	(function() {
			 $('moving_home_bg').effect('opacity',{duration:2000}).custom(1,0);
	}).delay(2500+2000);
	
	
	var myHomeEffects = new Fx.Styles('moving_home_image', {duration: 3000, transition: Fx.Transitions.linear,onComplete: ( 
	function() { 
	
		 var anyDiv = $('moving_home_image_container').setStyles({'width':'379px'}); 
	})});
  	
	/**
	(function() { myHomeEffects.start({
    	'left': -450,
    	'top':10,
    	'width':'850px',
    	'height':'597px'
	})}.delay(2500));
	**/
	
	
	
	if (/MSIE (5.5|6.)/.test(navigator.userAgent)) {
		
	
		(function() { 
		// myHomeEffects.move(299,299);
		//myHomeEffects.start({'height': [320, 597], 'width': [456, 850]});
		
		$('moving_home_image').effect('left',{duration: 3000, transition: Fx.Transitions.linear}).custom(160,-450);
		$('moving_home_image').effect('top',{duration: 3000, transition: Fx.Transitions.linear}).custom(0,10);
		$('moving_home_image').effect('width',{duration: 3000, transition: Fx.Transitions.linear}).custom(456,850);
		$('moving_home_image').effect('height',{duration: 3000, transition: Fx.Transitions.linear,onComplete: function() {
			 var anyDiv = $('moving_home_image_container').setStyles({'width':'379px'}); 
		}}).custom(320,597);
		
	/**	myHomeEffects.start({
   		'width':'850px',
    	'height':'597px'
});**/
		
		
		
		}.delay(2500));
	}
	else {
		(function() { myHomeEffects.start({
    	'left': -450,
    	'top':10,
    	'width':'850px',
    	'height':'597px'
	})}.delay(2500));
	}
}
function showMainNavi() {
	var div = $('menu1-level1').setStyles({
		display:'block',
		opacity: 0
		});
	
	$('menu1-level2').effect('opacity').custom(1,0);
	$('menu1-active').effect('opacity').custom(1,0);
	$('menu1-level1').effect('opacity').custom(0,1);
}
function menuFade(any)
{
	$('menu1-level1').effect('opacity').custom(1,0);
		var div = $('menu1-level2').setStyles({
		display:'block',
		opacity: 0
		});
		var div = $('menu1-active').setStyles({
		display:'block',
		opacity: 100
		});
			
	$('menu1-active-label').effect('left').custom(any*60,10).addEvent('onComplete',function() { $('menu1-level2').effect('opacity').custom(0,1) });
	$('backButton').effect('opacity',{duration:500}).custom(0,1);
}
function showcase(param) {
	
	  $('overlay').setStyle('opacity', '0.01');
	
	 // Borders
	$('header').setStyle('border-bottom', '0px');
	$('navi').setStyle('border-top','0px');
	
	var myEffects = new Fx.Styles('header', {duration: 1000, transition: Fx.Transitions.linear});
	var myEffects2 = new Fx.Styles('navi', {duration: 1000, transition: Fx.Transitions.linear});
  
	  $E('body').effect('background-color',{duration:2000}).custom('#000000').addEvent('onComplete',function() { 
  	  myEffects.start({
    	'height': 57,
    	'opacity':0.7
	  });
	});
	
  if(param == 'slideshow')
  {

  	myEffects.addEvent('onStart',function() { myEffects2.start({'height':0}); });
  	myEffects.addEvent('onComplete',function() { 
  		//moveImage();
  	});
  	$('overlay').addEvent("click", function(){ myEffects2.start({'height':37}); });
  }
  else if(param == 'intro')
  {
  	
  	$('overlay').addEvent("click", function(){ 
  		introForward();
  });
  (function(){ introForward(); }).delay(74000);
  
  }
}
function introForward() {
		$E('body').effect('background-color',{duration:2000}).custom('#313131').addEvent('onComplete',function() { window.location.href = "21_Home.html"; });
}
function loadImage(any) {
	$('ext-shop-single-image').setProperties({src: any, alt: any});
}
function moveImage() {
	$('slideshow_img').effect('right',{duration: 3000, transition: Fx.Transitions.linear}).custom(0,50);
}
function showNavi(time) {
	var timeShift = time * 1000;
	(function() { $('navi').effect('height',{duration: 1000, transition: Fx.Transitions.linear}).custom(0,37); }).delay(timeShift);
}
function shopPagingImproved(cmd) {
	var from = 0;
	var to = 0;
	if(semaphor == 1)
		return false;
	
	semaphor = 1;	
	
	
	if(cmd == 'init') {
		from = 0;
		to = 0;
		if(window.location.hash == '')
				pageActual = 1;
		else {
			tmpVar = window.location.hash.replace('#','').toInt();
			
			if(tmpVar <= pages && tmpVar > 0)
				pageActual = tmpVar;
			else
				pageActual = 1;
		}
		
		
		new Fx.Scroll('ext-shop-pages', {
			duration: 0, 
			wait: false, 
			transition: Fx.Transitions.Quad.easeOut,
			onStart:shopNavigator,
			onComplete:function() { semaphor = 0;}

		}).scrollTo((pageActual*860)-860,0);
		
		nextPage = pageActual + 1;
		lastPage = pageActual - 1;
		$('ext-shop-navigator-next').firstChild.href = '#'+nextPage;
		$('ext-shop-navigator-back').firstChild.href = '#'+lastPage;
		
	
		return;
	}
	if(cmd == 'next') {
		// from = 0;
		pageActual = pageActual + 1;
		to = (pageActual*860)-860;
	}
	if(cmd == 'back') {
		// from = (actualPage)*820;
		pageActual = pageActual - 1;
		to = (pageActual*860)-860;
	}
	
	
	var skroll = new Fx.Scroll('ext-shop-pages', {
			duration: 2000, 
			wait: false, 
			transition: Fx.Transitions.Quad.easeOut,
			onStart:shopNavigator,
			onComplete:function() { 
								
				nextPage = pageActual + 1;
				lastPage = pageActual - 1;
				$('ext-shop-navigator-next').firstChild.href = '#'+nextPage;
				$('ext-shop-navigator-back').firstChild.href = '#'+lastPage;
				
				semaphor = 0; 
			}
	});
	skroll.scrollTo(to,0);
}
	
function shopNavigator() {
	var el = $('ext-shop-navigator-next');
	var el2 = $('ext-shop-navigator-back');
	if(pageActual < pages)
	{
		// next erscheinen lassen
		if(el.getStyle("visibility") == "hidden")
			el.effect('opacity',{duration: 500}).custom(0,1);
	}
	else
	{
		// next verschwinden lassen
		if(el.getStyle("visibility") == "visible")
			el.effect('opacity',{duration: 500}).start(1,0);
	}
	
	if(pageActual > 1)
	{
		// back erscheinen lassen
		if(el2.getStyle("visibility") == "hidden")
			el2.effect('opacity',{duration: 500}).custom(0,1);
	}
	else
	{
		// back verschwinden lassen
		if(el2.getStyle("visibility") == "visible")
			el2.effect('opacity',{duration: 500}).custom(1,0);
	}
	
}

window.onload = function() {
	
 		$$("img.mouseover-image").forEach(function(element){
                element.addEvents({
                	'mouseenter': function() {element.src = element.src.replace(/_off/g,'_on')},
                	'mouseleave': function() {element.src = element.src.replace(/_on/g,'_off')}
                });
        })
        
        /**
        Ausfaden Funktionsaufruf
        $$("#navi a").forEach(function(element){
        	    element.addEvents({
                	'click': function(evt) { (new Event(evt)).stop();  if(element.href == '' || element.href.contains('#')) return true; $('pageOverlay').effect('opacity',{duration:300}).custom(0,1).addEvent("onComplete",function() { location.href = element.href })}
                });
        })**/
};
function openPopup(url,winName,winParams)	{	//
		var theWindow = window.open(url,winName,winParams);
		if (theWindow)	{theWindow.focus();}
		return false;
	}
function makeLink( name, domain, desc, pre, post ) {
   	string = 'mailto:' + name + '@' + domain;
    location.href = string;
 }