function loadPath() {
	document.location.href="/";
}

/* Slide subMenu */
var subMenu = {
   timeout : null,
     slideDown : function(el) {
	// Hide other:	
	$$('div#header_menubar div.firstlevel ul').each(function (e) {
	   if(e.getStyle('display') != 'none' && e != el) {
	      new Effect.BlindUp(e, {
		 afterFinish: function() { e.setStyle({'display':'none'}); },
		 duration:.0, fps:40
	      })
	   }
	});
	clearTimeout(this.timeout);
	if(el.getStyle('display') == 'none') {
	   this.timeout = setTimeout(function() {
					new Effect.BlindDown(el, {
					   afterSetup: function() { el.setStyle({'display':'block'}); },
					   duration:.0, fps:40
					})
				     },300);
	}
     },
     slideUp : function(el) {
	if(el.getStyle('display') == 'none') { clearTimeout(this.timeout) }
	else {
	   this.timeout = setTimeout(function() {
					new Effect.BlindUp(el, {
					   afterFinish: function() { el.setStyle({'display':'none'}); },
					   duration:.0, fps:40
					})
				     },200);
	}
     }
};


/* Wechselfunktion für die Galerie im Produktdetail */

Event.observe(window, 'load', function() { 
    anzahlBilder = $$('div.product ul li img');
    anzahlBilder.length.floor();
    marginBottom = 70*Math.ceil(anzahlBilder.length/4);
    marginBottom = marginBottom+"px";
	
    $$('div.product').each(function (e) {
			e.setStyle({
				margin : '0 0 '+marginBottom+ ' 0'
			});
		});
    	
		$$('div.product ul li img').each(function (e) {
			
				Event.observe(e, 'mouseover', function() {
					$$('div.product div').each(function (e) {
						e.setStyle({
  						display: 'none'
						});
					});
					
					tempKlasse = e.className;
					tempArray = tempKlasse.split('_');
					bigImageClass = 'large_' +tempArray[1];		
					//console.log(bigImageClass);
					$$('div.product div.'+bigImageClass).each(function (e) {
						e.setStyle({
  						display: 'block'
						});
					});
					
				});
				
			});
			
	/* Bind subMenu actions: */
	$$('div#header_menubar div.firstlevel').each(function (e) {
		Event.observe(e, 'mouseover', function() {
			if(e.down(1)) { subMenu.slideDown(e.down(1)); }
		});
		Event.observe(e, 'mouseout', function() {
			if(e.down(1)) { subMenu.slideUp(e.down(1)); }
		});
	});
	
	/**/
	if($('imgSet_' + $('articleChoose').options[0].value)) {
		var displayHeight = $('imgSet_' + $('articleChoose').options[0].value).getHeight();
		var divProduct = $$('div.product-wrap');
		divProduct = divProduct[0];
		divProduct.setStyle({padding : '0 0 ' + displayHeight + 'px 0'});
		
		$('articleChoose').options[0].selected = true;
		$('articleChoose').observe('change', function() {
			var imgSets = $$('ul.imgSet');
			var displayHeight = $('imgSet_' + this.value).getHeight();
			var divProduct = $$('div.product-wrap');
			
			if(imgSets.length > 0) {
				imgSets.each(function(ele, index) {
					ele.setStyle({
						display: 'none'
					});
				});
			}
			
			$('imgSet_' + this.value).setStyle({
				display: 'block'
			});
			
			$('hidden-fastadd').writeAttribute({'name' : 'tx_wmdbshop_option[' + this.value + ']'});
			$$('div.product div').each(function (e) {
				e.setStyle({
					display: 'none'
				});
			});
			divProduct = divProduct[0];
			divProduct.setStyle({padding : '0 0 ' + displayHeight + 'px 0'});
			//console.log(bigImageClass);
			var firstImage = $$('ul#imgSet_' + this.value + ' li img');
			firstImage = firstImage[0].className.split('_');
			firstImage = $$('div.large_' + firstImage[1]);
			firstImage[0].show();
		}); 
	} else {
		var displayHeight = 0;
		var divProduct = $$('div.product-wrap');
		divProduct = divProduct[0];
		divProduct.setStyle({padding : '0 0 ' + displayHeight + 'px 0'});
	}
			
 });

/* HOVER LOGOS */

function showBrands() {
	if($('more_logos').innerHTML == 'mehr') {
		new Effect.Morph('logos',{style: 'height:492px;background:#fff;', duration: 0.35});
		$('more_logos').innerHTML = 'weniger';
		$('more_logos').className = 'weniger_logos';
	} else {
		new Effect.Morph('logos',{style: 'height:12px;background:#fff;', duration: 0.35});
		$('more_logos').innerHTML = 'mehr';
		$('more_logos').className = 'mehr_logos';
	}
}


/* MAXHEIGHT OF IMAGES */

Event.observe(window, 'load', function() {
	var allProductImages = $$('div.product div a img');
	var maxHeight = 0;
	var productWrapElement = $$('div.product-wrap');
	productWrapElement = productWrapElement[0];
	if(allProductImages.length > 0) {
		allProductImages.each(function(ele,index) {
			var elementHeight = ele.readAttribute('height');
			if(maxHeight < elementHeight) {
				maxHeight = elementHeight;
			}
		});
		productWrapElement.setStyle({height : maxHeight + 'px'});
	}
	
});

/* HOVER WARENKORB */

function fadeoutWarenkorb() {
	if ($('warenkorb_fadeout') != null) {
		if ($('warenkorbarrow').className == 'fade_out') {
			$('warenkorb_fadeout').show();
			$('warenkorbarrow').className = 'fade_in';
		}
		else if ($('warenkorbarrow').className == 'fade_in') {
			$('warenkorb_fadeout').hide();
			$('warenkorbarrow').className = 'fade_out';
		}
	}
}

/* MENU HOVER */
/*
function menuHover() {

	$$('#currentseason').each(function (e) {
		Event.observe(e, 'mouseover', function() {
			$('currentseason').className = 'menu_hover1';
		});
		Event.observe(e, 'mouseout', function() {
			$('currentseason').className = '';
		}); 
	});
	$$('#currentseason_act').each(function (e) {
		Event.observe(e, 'mouseover', function() {
			$('currentseason_act').className = 'menu_hover1';
		});
		Event.observe(e, 'mouseout', function() {
			$('currentseason_act').className = '';
		}); 
	});
	

	$$('#girls').each(function (e) {
		Event.observe(e, 'mouseover', function() {
			$('girls').className = 'menu_hover2';
		});
		Event.observe(e, 'mouseout', function() {
			$('girls').className = '';
		}); 
	});
	$$('#girls_act').each(function (e) {
		Event.observe(e, 'mouseover', function() {
			$('girls_act').className = 'menu_hover2';
		});
		Event.observe(e, 'mouseout', function() {
			$('girls_act').className = '';
		}); 
	});
	
	
	$$('#kids').each(function (e) {
		Event.observe(e, 'mouseover', function() {
			$('kids').className = 'menu_hover3';
		});
		Event.observe(e, 'mouseout', function() {
			$('kids').className = '';
		}); 
	});
	$$('#kids_act').each(function (e) {
		Event.observe(e, 'mouseover', function() {
			$('kids_act').className = 'menu_hover3';
		});
		Event.observe(e, 'mouseout', function() {
			$('kids_act').className = '';
		}); 
	});
	
	$$('#outlet').each(function (e) {
		Event.observe(e, 'mouseover', function() {
			$('outlet').className = 'menu_hover4';
		});
		Event.observe(e, 'mouseout', function() {
			$('outlet').className = '';
		}); 
	});
	$$('#outlet_act').each(function (e) {
		Event.observe(e, 'mouseover', function() {
			$('outlet_act').className = 'menu_hover4';
		});
		Event.observe(e, 'mouseout', function() {
			$('outlet_act').className = '';
		}); 
	});
	$$('#samples').each(function (e) {
		Event.observe(e, 'mouseover', function() {
			$('samples').className = 'menu_hover5';
		});
		Event.observe(e, 'mouseout', function() {
			$('samples').className = '';
		}); 
	});
	$$('#samples_act').each(function (e) {
		Event.observe(e, 'mouseover', function() {
			$('samples_act').className = 'menu_hover5';
		});
		Event.observe(e, 'mouseout', function() {
			$('samples_act').className = '';
		}); 
	});
}

FastInit.addOnLoad(menuHover);
*/


tx_wmdbshop_pi1_init = function(){
	$('warenkorb_outer').innerHTML = '<p style="text-align: center">Lade Daten ...</p>';
	var url = '/index.php?eID=wmdb_shop';
	new Ajax.Updater('warenkorb_outer', url, {
		parameters: { 
		language: 0,
  		conf:'test'
	}
	});
}
FastInit.addOnLoad(tx_wmdbshop_pi1_init);
