
	function showStores(mapId,mapPosX,mapPosY,iCount) {
		var pos = $("#" + mapId).offset();  
		var width = $("#" + mapId).width();
		var sShopId = this.id;
		iCount = "c" + iCount;
       
		var sShopHighlightingId = "s" + mapId + iCount;
		var sShopHighlightingHtml = "<div class=\"box-shop-highlighting\" id=\"" + sShopHighlightingId + "\"><img src=\"images/store-highlighted2.gif\" width=\"20\" height=\"20\" alt=\"\" /></div>";
		
		
	    $("body").append(sShopHighlightingHtml);
		$("#" + sShopHighlightingId).css( { 
			"z-index": "10", 
			"left": pos.left + mapPosX + "px", 
			"top": pos.top + mapPosY + "px" 
		} ); 
	}
	function getMaxZIndex() {
		// Maximalen Z-Index der enthaltenen Elemente finden
		var maxZ = Math.max.apply(null,$.map($('body > *'), function(e,n){
			if($(e).css('position')=='absolute')
				return parseInt($(e).css('z-index'))||1 ;
			})
		);
		return maxZ;
	}
	
	
	function showStoresEn(mapId,mapPosX,mapPosY,iCount) {
		var pos = $("#" + mapId).offset();  
		var width = $("#" + mapId).width();
		var sShopId = this.id;
		iCount = "c" + iCount;

		var sShopHighlightingId = "s" + mapId + iCount;
		var sShopHighlightingHtml = "<div class=\"box-shop-highlighting\" id=\"" + sShopHighlightingId + "\"><img src=\"../images/store-highlighted2.gif\" width=\"20\" height=\"20\" alt=\"\" /></div>";

		$("body").append(sShopHighlightingHtml);
		$("#" + sShopHighlightingId).css( { 
			"z-index": "10", 
			"left": pos.left + mapPosX + "px", 
			"top": pos.top + mapPosY + "px" 
		} );
	}
	function getMaxZIndex() {
		// Maximalen Z-Index der enthaltenen Elemente finden
		var maxZ = Math.max.apply(null,$.map($('body > *'), function(e,n){
			if($(e).css('position')=='absolute')
				return parseInt($(e).css('z-index'))||1 ;
			})
		);
		return maxZ;
	}
			
$(document).ready(function() {

	
	//Social Bookmarklist
	jQuery("#soc_net a").hover(function(){
		SocDienst = this.title;
		jQuery("#soc span").html(SocDienst);
	});
	
	// Menu
	$('.sf-menu').superfish({
		hoverClass:    'sfHover',          // the class applied to hovered list items
		pathClass:     'overideThisToUse', // the class you have applied to list items that lead to the current page
		pathLevels:    1,                  // the number of levels of submenus that remain open or are restored using pathClass
		delay:         500,                // the delay in milliseconds that the mouse can remain outside a submenu without it closing
		animation:     {opacity:'show'},   // an object equivalent to first parameter of jQuery&#8217;s .animate() method
		speed:         'slow',           // speed of the animation. Equivalent to second parameter of jQuery&#8217;s .animate() method
		autoArrows:    true,               // if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance
		dropShadows:   true,               // completely disable drop shadows by setting this to false
		disableHI:     false,              // set to true to disable hoverIntent detection
		onInit:        function(){},       // callback function fires once Superfish is initialised &#8211; 'this' is the containing ul
		onBeforeShow:  function(){},       // callback function fires just before reveal animation begins &#8211; 'this' is the ul about to open
		onShow:        function(){  $(".sf-menu li.sfHover ul").css("z-index","99"); },       // callback function fires once reveal animation completed &#8211; 'this' is the opened ul
		onHide:        function(){}        // callback function fires after a sub-menu has closed &#8211; 'this' is the ul that just closed

	}); 

	// Equal Heights
	$(".sameheight").equalHeights();
	$(".sameheight1").equalHeights();
	$(".sameheight2").equalHeights();
	$(".sameheight3").equalHeights();
	$(".sameheight4").equalHeights();
	$(".sameheight5").equalHeights();
	$(".sameheight6").equalHeights();
	$(".sameheight7").equalHeights();
	
	// SlideShow
	// $('#box-slideshow').cycle('fade');
	
	// Scroll Brands
	$('#brands-and-stores').cycle({ 
		fx:     'fade', 
		speed:   800, 
		timeout: 2000, 
		next:   '#brands-and-stores', 
		pause:   1 
	});
	if ($("#brandsAndStores")){
		$('#brandsAndStores').cycle({ 
		fx:     'fade', 
		speed:   800, 
		timeout: 2000, 
		next:   '#brands-and-stores', 
		pause:   1 
	});
	}
	/*
	// ShopSelector
	$(".jqzoom").jqzoom({
		zoomWidth: 430,
		zoomHeight: ($("#centerplan-left").height() - 30),
		imageOpacity: 0.5,
		xOffset: 50,
		yOffset: -35,
		title: false,
		showEffect: "fadein",
		fadeinSpeed: "medium",
		hideEffect: "fadeout",
		fadeoutSpeed: "medium",
		preloadText: "Vergr&ouml;&szlig;erte Ansicht wird geladen",
		position: "right" //and MORE OPTIONS
	});
	*/
	


	// Z-Index-Problem fixen!
	$("#menu").hover(
		function () {
			$(".box-shop-highlighting").css( { 
				"display": "none" 
			});
		},
		function () {
			$(".box-shop-highlighting").css( { 
				"display": "block" 
			});
		}
	);

	function resetShops() {
	   $(".box-shop-highlighting").remove();
	};

	var resizeTimer = null;
	$(window).bind('resize', function() {
		if (resizeTimer) clearTimeout(resizeTimer);
		if($(".box-shop-highlighting").lenght > 0) resizeTimer = setTimeout('resetShops()', 100);
	});

	$("li.shop").click(function () {
		$(this).css(
			 "color","#f00"
		); 
		var pos = $("#centerplan-small").offset();  
		var width = $("#centerplan-small").width();
		var sShopId = this.id;
		var iArrayKey = parseInt(sShopId.substr(1));
		
		$(".box-shop-highlighting").remove();
		
		for (var i = 0; i < aShops[iArrayKey].length; i++) {
			var sShopHighlightingId = "s" + iArrayKey + "-" + i + "img";
			var sShopHighlightingHtml = "<div class=\"box-shop-highlighting\" id=\"" + sShopHighlightingId + "\"><img src=\"images/store-highlighted2.gif\" width=\"20\" height=\"20\" alt=\"\" /></div>";
			
			//aShops[iArrayKey][i]["x"] = aShops[iArrayKey][i]["x"]-35;
			//aShops[iArrayKey][i]["y"] = aShops[iArrayKey][i]["y"]-5;
			$("body").append(sShopHighlightingHtml);
			$("#" + sShopHighlightingId).css( { 
				"z-index": "10", 
				"left": pos.left + aShops[iArrayKey][i]["x"] + "px", 
				"top": pos.top + aShops[iArrayKey][i]["y"] + "px" 
			} );
			//aShops[iArrayKey][i]["x"] = aShops[iArrayKey][i]["x"]+35;
			//aShops[iArrayKey][i]["y"] = aShops[iArrayKey][i]["y"]+5;
		}
	});
	$("li.shop_en").click(function () {
		$(this).css(
			 "color","#f00"
		); 
		var pos = $("#centerplan-small").offset();  
		var width = $("#centerplan-small").width();
		var sShopId = this.id;
		var iArrayKey = parseInt(sShopId.substr(1));
		
		$(".box-shop-highlighting").remove();
		
		for (var i = 0; i < aShops[iArrayKey].length; i++) {
			var sShopHighlightingId = "s" + iArrayKey + "-" + i + "img";
			var sShopHighlightingHtml = "<div class=\"box-shop-highlighting\" id=\"" + sShopHighlightingId + "\"><img src=\"../images/store-highlighted2.gif\" width=\"20\" height=\"20\" alt=\"\" /></div>";
	
			$("body").append(sShopHighlightingHtml);
			$("#" + sShopHighlightingId).css( { 
				"z-index": "10", 
				"left": pos.left + aShops[iArrayKey][i]["x"] + "px", 
				"top": pos.top + aShops[iArrayKey][i]["y"] + "px" 
			} );
		}
	});
	
	
	
});

