$(document).ready(function() {//Start
	
	try{
		if(location.href.indexOf('#') != -1){
			var itemToShow = location.href.split('#')[1];
			var folder = itemToShow.split('__')[0];
			var file = itemToShow.split('__')[1];
			if((folder != null) && (file != null))
			$.get(folder + '/' + file, function(data) {
				if(location.href.indexOf('kinder') != -1){
					$('.bigKPackshot').html(data);
					$(".bigKPackshot").fadeIn("slow");
				}
				else{
					$('.bigPackshot').html(data);
					$(".bigPackshot").fadeIn("slow");
				}
				$(".tohide").hide();
				$(".hideem").hide();
			});  
		}
	}
	catch(e){}
	
//Tipps Carousel
	function mycarousel_initCallback(carousel) {
		jQuery('.jcarousel-control a').bind('click', function() {
			carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
			return false;
		});

		jQuery('.jcarousel-scroll select').bind('change', function() {
			carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
			return false;
		});

		jQuery('#mycarousel-next').bind('click', function() {
			carousel.next();
			$(".tohide").hide();
			return false;
		});

		jQuery('#mycarousel-prev').bind('click', function() {
			carousel.prev();
			$(".tohide").hide();
			return false;
		});
	};
    jQuery("#mycarousel").jcarousel({
        scroll: 2,
        initCallback: mycarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });

//MainNav Gebaeck

jQuery(function($) {
  $('#subgebaeck a').click(function() {
	$(".hideem").hide();
	$(".hideemtoo").hide();
    $(this).blur().parents('li').siblings('li:has(.active)').find('a').removeClass('active').end().end().end().addClass('active');
  });
});

//MainNav Kindergebaeck

jQuery(function($) {
  $('#subkgebaeck a').click(function() {
	$(".hideem").hide();
	$(".hideemtoo").hide();
    $(this).blur().parents('li').siblings('li:has(.active)').find('a').removeClass('active').end().end().end().addClass('active');
  });
});

//Tipps

$('.litipp01').click(function() {
	$(".tipp01").slideToggle("350");
	$(".tohide").hide();	
});

$('.litipp02').click(function() {
	$(".tipp02").slideToggle("350");
	$(".tohide").hide();	
});

$('.litipp03').click(function() {
	$(".tipp03").slideToggle("350");
	$(".tohide").hide();
});

$('.litipp04').click(function() {
	$(".tipp04").slideToggle("350");
	$(".tohide").hide();
});

$('.litipp05').click(function() {
	$(".tipp05").slideToggle("350");
	$(".tohide").hide();
});

$('.litipp06').click(function() {
	$(".tipp06").slideToggle("350");
	$(".tohide").hide();
});

$('.litipp07').click(function() {
	$(".tipp07").slideToggle("350");
	$(".tohide").hide();
});

$('.litipp08').click(function() {
	$(".tipp08").slideToggle("350");
	$(".tohide").hide();
});

$('.litipp09').click(function() {
	$(".tipp09").slideToggle("350");
	$(".tohide").hide();
});

$('.litipp10').click(function() {
	$(".tipp10").slideToggle("350");
	$(".tohide").hide();
});


//Sub-Gebäck, Sub-Kindergebäck

$('.close').live('click', function() {
	$(".bigPackshot").fadeOut();
	$(".bigKPackshot").fadeOut();
	$(".hideem").fadeOut();
	$("li a").removeClass("active");
});

//++++++Gebäck++++++

//Avignon

$(".avignon").live('click', function() {
	$.get('avignon/avignon-200g.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();	
});

$('.psavignon').live('click', function() {
	$.get('avignon/avignon-200g.htm', function(data) {
		$('.bigPackshot').html(data);
	}); 
	$(".bigPackshot").fadeIn("slow");
	$("li.avignon a").addClass("active");
	$(".tohide").hide();
});

$('.btnNavignon').live('click', function() {
	$.get('avignon/nw-avignon-200g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Marquisettes

$(".marquisettes").live('click', function() {
	$.get('marquisettes/marquisettes-100g.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();	
});

$('.psmarquisettes').live('click', function() {
	$.get('marquisettes/marquisettes-100g.htm', function(data) {
		$('.bigPackshot').html(data);
	}); 
	$(".bigPackshot").fadeIn("slow");
	$("li.marquisettes a").addClass("active");
	$(".tohide").hide();
});

$('.btnNmarquisettes').live('click', function() {
	$.get('marquisettes/nw-marquisettes-100g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Sprits

$(".sprits").live('click', function() {
	$.get('sprits/sprits-original-250g.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();
});

$('.pssprits').live('click', function() {
	$.get('sprits/sprits-original-250g.htm', function(data) {
		$('.bigPackshot').html(data);
	}); 
	$(".bigPackshot").fadeIn("slow");
	$("li.sprits a").addClass("active");
	$(".tohide").hide();
});

$('.btnNspritsoriginal').live('click', function() {
	$.get('sprits/nw-sprits-original-250g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Sprits Milchschokolade

$(".spritsmilchschokolade").live('click', function() {
	$.get('sprits/sprits-milchschokolade-150g.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();
});

$('.btnNspritsmilchschokolade').live('click', function() {
	$.get('sprits/nw-sprits-milchschokolade-150g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Sprits feinherbe Schokolade

$(".spritsfeinherbeschokolade").live('click', function() {
	$.get('sprits/sprits-feinherbe_schokolade-150g.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();
});

$('.btnNspritsfeinherbeschokolade').live('click', function() {
	$.get('sprits/nw-sprits-feinherbe_schokolade-150g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Cigarettes Russes

$(".cigarettes_russes").live('click', function() {
	$.get('cigarettes_russes/cigarettes_russes-100g.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();
});

$('.pscigarettes_russes').live('click', function() {
	$.get('cigarettes_russes/cigarettes_russes-100g.htm', function(data) {
		$('.bigPackshot').html(data);
	}); 
	$(".bigPackshot").fadeIn("slow");
	$("li.cigarettes_russes a").addClass("active");
	$(".tohide").hide();
});

$('.btnNcigarettes_russes').live('click', function() {
	$.get('cigarettes_russes/nw-cigarettes_russes-100g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Cigarettes Russes (C&C)

$(".cigarettes_russes1kg").live('click', function() {
	$.get('cigarettes_russes/cigarettes_russes-1kg.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();
});

$('.btnNcigarettes_russes1kg').live('click', function() {
	$.get('cigarettes_russes/nw-cigarettes_russes-1kg.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Biarritz

$(".biarritz").live('click', function() {
	$.get('biarritz/biarritz-100g.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();	
});

$('.psbiarritz').live('click', function() {
	$.get('biarritz/biarritz-100g.htm', function(data) {
		$('.bigPackshot').html(data);
	}); 
	$(".bigPackshot").fadeIn("slow");
	$("li.biarritz a").addClass("active");
	$(".tohide").hide();
});

$('.btnNbiarritz').live('click', function() {
	$.get('biarritz/nw-biarritz-100g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Tea Time

$(".teatime").live('click', function() {
	$.get('teatime/teatime-1kg.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();	
});

$('.psteatime').live('click', function() {
	$.get('teatime/teatime-1kg.htm', function(data) {
		$('.bigPackshot').html(data);
	}); 
	$(".bigPackshot").fadeIn("slow");
	$("li.teatime a").addClass("active");
	$(".tohide").hide();
});

$('.btnNteatime').live('click', function() {
	$.get('teatime/nw-teatime-1kg.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Tea Time 500g

$(".psteatime500g").live('click', function() {
	$.get('teatime/teatime-500g.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();
});

$('.btnNteatime500g').live('click', function() {
	$.get('teatime/nw-teatime-500g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Tea Time 200g

$(".psteatime200g").live('click', function() {
	$.get('teatime/teatime-200g.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();
});

$('.btnNteatime200g').live('click', function() {
	$.get('teatime/nw-teatime-200g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Tea Time (C&C)

$(".psteatime2500g").live('click', function() {
	$.get('teatime/teatime-2500g.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();
});

$('.btnNteatime2500g').live('click', function() {
	$.get('teatime/nw-teatime-2500g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Tea Time Tim & Struppi 1kg

$(".psteatimets").live('click', function() {
	$.get('teatime/teatime-ts-1kg.htm', function(data) {
		$('.bigPackshot').html(data);
	});  
	$(".bigPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();
});

$('.btnNteatimets').live('click', function() {
	$.get('teatime/nw-teatime-ts-1kg.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});


//++++++Kindergebäck++++++

// SpongeBob

$(".spongebob").live('click', function() {
	$.get('spongebob/spongebob-168g.htm', function(data) {
		$('.bigKPackshot').html(data);
	});  
	$(".bigKPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();	
});

$('.psspongebob').live('click', function() {
	$.get('spongebob/spongebob-168g.htm', function(data) {
		$('.bigKPackshot').html(data);
	}); 
	$(".bigKPackshot").fadeIn("slow");
	$("li.spongebob a").addClass("active");
	$(".tohide").hide();
});

$('.btnNspongebob').live('click', function() {
	$.get('spongebob/nw-spongebob-168g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

// Dora 

$(".dora").live('click', function() {
	$.get('dora/dora-175g.htm', function(data) {
		$('.bigKPackshot').html(data);
	});  
	$(".bigKPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();	
});

$('.psdora').live('click', function() {
	$.get('dora/dora-175g.htm', function(data) {
		$('.bigKPackshot').html(data);
	}); 
	$(".bigKPackshot").fadeIn("slow");
	$("li.dora a").addClass("active");
	$(".tohide").hide();
});

$('.btnNdora').live('click', function() {
	$.get('dora/nw-dora-175g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Keksbolde

$(".keksbolde").live('click', function() {
	$.get('keksbolde/keksbolde-kakao-300g.htm', function(data) {
		$('.bigKPackshot').html(data);
	});  
	$(".bigKPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();	
});

$('.pskeksbolde').live('click', function() {
	$.get('keksbolde/keksbolde-kakao-300g.htm', function(data) {
		$('.bigKPackshot').html(data);
	}); 
	$(".bigKPackshot").fadeIn("slow");
	$("li.keksbolde a").addClass("active");
	$(".tohide").hide();
});

$('.btnNkeksbolde').live('click', function() {
	$.get('keksbolde/nw-keksbolde-kakao-300g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Kesbolde Milch

$(".keksboldemilch").live('click', function() {
	$.get('keksbolde/keksbolde-milch-300g.htm', function(data) {
		$('.bigKPackshot').html(data);
	});  
	$(".bigKPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();	
});

$('.btnNkeksboldemilch').live('click', function() {
	$.get('keksbolde/nw-keksbolde-milch-300g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Kesbolde Mini

$(".keksboldemini").live('click', function() {
	$.get('keksbolde/keksbolde-mini-168g.htm', function(data) {
		$('.bigKPackshot').html(data);
	});  
	$(".bigKPackshot").fadeIn("slow");
	$(".tohide").hide();
	$(".hideem").hide();	
});

$('.btnNkeksboldemini').live('click', function() {
	$.get('keksbolde/nw-keksbolde-mini-168g.htm', function(data) {
		$('.popNaehrwert').html(data);
	});
	$(".popNaehrwert").fadeIn("slow");
	$(".tohide").hide();
});

//Global

$('.closeN').live('click', function() {
	$(".hideem").fadeOut("slow");
});

//Zeitreise 

$(".zr1870, .zr1872, .zr1873, .zr1879, .zr1880, .zr1891, .zr18911906, .zr19451960, .zr19141945, .zr1906, .zr19611997, .zr1998, .zr2010").live('click', function() {
  $(".hideZR").hide();
});

$(".zr1870").live('click', function() {
	$(".txtzr1870").show();
});

$(".zr1872").live('click', function() {
	$(".txtzr1872").show();
});

$(".zr1873").live('click', function() {
	$(".txtzr1873").show();
});

$(".zr1879").live('click', function() {
	$(".txtzr1879").show();
});

$(".zr1880").live('click', function() {
	$(".txtzr1880").show();
});

$(".zr1891").live('click', function() {
	$(".txtzr1891").show();
});

$(".zr18911906").live('click', function() {
	$(".txtzr18911906").show();
});

$(".zr19451960").live('click', function() {
	$(".txtzr19451960").show();
});

$(".zr19141945").live('click', function() {
	$(".txtzr19141945").show();
});

$(".zr1906").live('click', function() {
	$(".txtzr1906").show();
});

$(".zr19611997").live('click', function() {
	$(".txtzr19611997").show();
});

$(".zr1998").live('click', function() {
	$(".txtzr1998").show();
});

$(".zr2010").live('click', function() {
	$(".txtzr2010").show();
});

$('.closeZR').live('click', function() {
	$(".hideZR").hide();
    $("#boxOutZR").css({"background-position":"0 0"});
    $("#del-logoZR ").css({"background-position":"0 0"});	
});

//Impressum

$(".btnNutz").live('click', function() {
	$.get('impressum/nutzungsb.htm', function(data) {
		$('.nutzungsbedingungen').html(data);
	});  
	$(".nutzungsbedingungen").show();
});

$('.clse').live('click', function() {
	$(".nutzungsbedingungen").hide();
});

//Presse

$(".bilddb1").live('click', function() {
	$.get('presse/bilddb01.htm', function(data) {
		$('.box320.bilddb').html(data);
	});  
});

$(".bilddb2").live('click', function() {
	$.get('presse/bilddb02.htm', function(data) {
		$('.box320.bilddb').html(data);
	});  
});

$(".bilddb3").live('click', function() {
	$.get('presse/bilddb03.htm', function(data) {
		$('.box320.bilddb').html(data);
	});  
});

$(".bilddb4").live('click', function() {
	$.get('presse/bilddb04.htm', function(data) {
		$('.box320.bilddb').html(data);
	});  
});

//

$(".pressem1").live('click', function() {
	$.get('presse/pressem01.htm', function(data) {
		$('.box320.pressem').html(data);
	});  
});

$(".pressem2").live('click', function() {
	$.get('presse/pressem02.htm', function(data) {
		$('.box320.pressem').html(data);
	});  
});

$(".pressem3").live('click', function() {
	$.get('presse/pressem03.htm', function(data) {
		$('.box320.pressem').html(data);
	});  
});

$(".pressem4").live('click', function() {
	$.get('presse/pressem04.htm', function(data) {
		$('.box320.pressem').html(data);
	});  
});

});//End

//Preload Images

(function($) {
  var cache = [];
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)



