$(document).ready(function()
{
	defeatSpam3000();
	$('li').each(function(){
		var obj = $(this);
		obj.html('&raquo;&nbsp;'+obj.html());
	});
	
	$('#menu ul>li').not(':first-child').hide();
	
	$('#menu ul>li:first-child').click(function(){
		if($(this).siblings('li.active').length == 0){
			$($(this).siblings('li')[0]).children('a').click();
			var href = $($(this).siblings('li')[0]).children('a').attr('href');
			window.location = href;
		}
		
		$('.uu_menuactive').html('&raquo;&nbsp;'+$('.uu_menuactive').html());
		
		$(this).html($(this).html().replace(/»&nbsp;/,''));
		
		$('#menu ul>li').not(':first-child').hide();
		
		$('#menu ul>li').parents('ul').removeClass('uu_ulactive');
		
		$('#menu ul>li:first-child').removeClass('uu_menuactive');
		
		$(this).siblings('li').toggle();
		$(this).addClass('uu_menuactive');
		$(this).parents('ul').addClass('uu_ulactive');
		var ul = $(this).parents('ul').remove();
		$('#menu .container').prepend(ul);
		
		if($(this).text().match(/KOLLEKTIONEN/)){
			var prodInfo = $('#uu_prodinfo');
			prodInfo.remove();
			prodInfo.insertAfter($(this).parents('ul'));
			prodInfo.show();
		}else{
			var prodInfo = $('#uu_prodinfo');
			prodInfo.hide();
		}
		
		
	});
	
	var activeUl = $('#menu ul>li.active').parents('ul');
	activeUl.children(':first-child').click();
	
});

function showProduktInfo(){
	
}

function defeatSpam3000(){
	var emailText = $('.nospam').text();
	var emailAddress = emailText.replace(/ \at\ /,'@');
	var mailLink = $('<a></a>').attr('class','uu_email').attr('href','mailto:'+emailAddress).text(emailAddress);
	mailLink.insertBefore('.nospam');
	$('.nospam').remove();
} 
