$(document).ready(function() {
	$(document).pngFix();	
});

$(document).ready(function() {
    $('#slideshow').cycle({
		fx: 'fade',
		speed:  4500 
	});
});

$(document).ready(function() {
	$('#tabs').tabs();
});

$(document).ready(function() {
	$('#fischerstuberl').hover(function (){
			$('#fischerstuberl ul#fischerstuberl-list').fadeIn('fast');
		},
		function (){
			$('#fischerstuberl ul#fischerstuberl-list').fadeOut('fast');
		}
	);
	$('#gastezimmer').hover(function (){
			$('#gastezimmer ul#gastezimmer-list').fadeIn('fast');
		},
		function (){
			$('#gastezimmer ul#gastezimmer-list').fadeOut('fast');
		}
	);
	$('#kuche').hover(function (){
			$('#kuche ul#kuche-list').fadeIn('fast');
		},
		function (){
			$('#kuche ul#kuche-list').fadeOut('fast');
		}
	);
	$('#angebote').hover(function (){
			$('#angebote ul#angebote-list').fadeIn('fast');
		},
		function (){
			$('#angebote ul#angebote-list').fadeOut('fast');
		}
	);
	$('#partyservice').hover(function (){
			$('#partyservice ul#partyservice-list').fadeIn('fast');
		},
		function (){
			$('#partyservice ul#partyservice-list').fadeOut('fast');
		}
	);
});

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") &&
		anchor.getAttribute("rel") == "blank")
		anchor.target = "_blank";
		}
	}
window.onload = externalLinks;

$(document).ready(function(){

	$('#thumbs ul li a').hover(
		function() {
			var currentBigImage = $('#bigpic img').attr('src');
			var newBigImage = $(this).attr('href');
			var currentThumbSrc = $(this).attr('rel');
			switchImage(newBigImage, currentBigImage, currentThumbSrc);
		},
		function() {}
	);

	
	
	function switchImage(imageHref, currentBigImage, currentThumbSrc) {
		 
		var theBigImage = $('#bigpic img');
		
		if (imageHref != currentBigImage) {
		
			theBigImage.fadeOut(250, function(){
				theBigImage.attr('src', imageHref).fadeIn(250);
				
				var newImageDesc = $("#thumbs ul li a img[src='"+currentThumbSrc+"']").attr('alt');
				$('p#desc').empty().html(newImageDesc);
			});
			
			
		}
		
	}
	
	
		
	$('a#add-to-cart').click(function() {
	  var theMsg = 'Oh noes!\n\nItem would be added to your cart, just about now ....\n\n';
	  alert(theMsg);
	});


});
