$(document).ready(function() {
	$("a.lageplan").fancybox({
		titlePosition: 'inside',
		transitionIn: 'fade',
		transitionOut: 'fade' });
			
	$("a.slideshow").click(function() {
		$.fancybox({
			'padding'		: 20,
			'margin'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'width'			: 600,
			'height'		: 600,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'title'			: this.title,
			'titleShow'		: 'true',
			'titlePosition'	: 'inside',
			'overlayOpacity': 0.7,
			'overlayColor'	: '#fff',
			'swf'			: {
				'allowfullscreen'	: 'true',
				'wmode'	:	'transparent'
			}
		});
		return false;
	});
	
	$("a[rel=lightbox]").fancybox({
		'titleShow'		: false,
		'overlayOpacity': 0.8
	});
	$("a[rel=fancytitle]").fancybox({
		titlePosition: 'inside',
		transitionIn: 'fade',
		transitionOut: 'fade' });
		
	$("#home").hover(function() {
		$("#home_button").attr('src','../indexpage/images/index_button_a.png');
	}, function() {
		$("#home_button").attr('src','../indexpage/images/index_button_p.png');
	});
	
	// change menu-image to hover-image and back
	$(".button").hover(function() {
		img = $(this).attr("src"); // image name via name attribute
		var l = img.length;
		var f = img.lastIndexOf("/"); // get position of last folder-marker /
		p = img.slice(0,f);
		i = img.slice(f+1,l-4); // pure image name
		ext = img.slice(img.length-4); // get image extension
		
		//alert(p);
		
		$(this).attr("src", p + "/" + i + "_invert" + ext );
		
	}, function(){
		$(this).attr("src", p + "/" + i + ext);
	});
});

