function bind_hover() {
	$('.shop').unbind('mouseenter mouseleave');
	$('.shop:not(.shop_current)').hover(function() {
		$(this).hoverFlow('mouseenter', {opacity: 1}, 'fast');
	}, function() {
		$(this).hoverFlow('mouseleave', {opacity: 0.8}, 'fast');
	});
};

$(document).ready(function(){
	$('#menu a').click(function(event) {
		event.preventDefault();
		if($(this).attr('href') == 'shops.html') {
			var link = $(this).attr('href')+' .shop';
		} else {
			var link = $(this).attr('href')+' .content p';
		}
		$('.content').empty();
		$('.content').load(link, function() {
			shops();
			bind_hover();
		});
		$(this).attr('id', 'current');
		$(this).siblings().removeAttr('id');
		if(($(this).attr('href')) == 'shops.html') {
			$('.content').attr('id', 'content_shops');
		} else if (($(this).attr('href')) == 'kontakt.html') {
			$('.content').attr('id', 'content_kontakt');
		} else if (($(this).attr('href')) == 'index.html') {
			$('.content').attr('id', 'content_home');
		}
	});
	$('#header a').click(function(event) {
		event.preventDefault();
		var link = 'index.html'+' .content p';
		$('.content').empty();
		$('.content').load(link);
		$('#menu a').removeAttr('id');
		$('#menu a:first').attr('id', 'current');
		$('.content').attr('id', 'content_home');
	}); 
});

function shops() {
	$('.shop a').click(function(event) {
		event.preventDefault();
		var shop = $(this).attr('href')+' #map_container iframe, #map_container p, #map_container a';
		$('#map_container').remove();
		$('.content').prepend('<div id="map_container"></div>');
		$('#map_container').load(shop);
		$(this).parent().addClass('shop_current');
		$(this).parent().siblings().removeClass('shop_current');
		$(this).parent().siblings('.shop').fadeTo('fast', 0.8);
		bind_hover();
	});
};
