$(document).ready(function() {
	/* Top-Link-Icon heruntersetzen, wenn noetig */
	/*
	$('div.top').each(function() {
		var link			=  $(this).find('p a');
		if (link.length > 0) {
			var offsetLINK = link.offset();
			var offsetDIV  = $(this).offset();
			var divPos	= offsetDIV.top + $(this).innerHeight();
			var linkPos = offsetLINK.top + link.innerHeight()
			if ((divPos - linkPos) > 0) {
				var tmp = link.offsetParent();
				link.css('margin-top', (divPos-linkPos)+4+'px');
			}
		}
	});
	*/
	
	/* Produkte mit einer Detailansicht verlinken */
	$('.food:not(.food-big)').click(function() {
		$('.food-big:not(.food-big-top)').hide();
		$('#food-big-'+this.id.split('food-').join('')).show();
		$('#food-big-'+this.id.split('food-').join('')+' a.closeLink').click(function() {
			$('.food-big:not(.food-big-top)').hide();
			return false;
		});
		return false;
	});
	
	/* Alle Links auf ein Produkt sollen in einem Popup oeffnen */
	/*
	$("a[href*='id=49']").each(function() {
		$(this).click(function() {
			var load = window.open($(this).attr('href'),'','scrollbars=no,menubar=no,height=360,width=560,resizable=no,toolbar=no,location=no,status=no');
			return false; 
		});
	});
	*/
});

function changeDetailimage(img) {
	$('#tx_jbrestaurant_pi2_detailimage img').attr('src', $(img).attr('rel'));
	$('#tx_jbrestaurant_pi2_detailimages img.active').removeClass('active');
	$(img).addClass('active');
	
	return false;
}
