Shadowbox.loadSkin('shadowbox', '../style/');
window.onload = Shadowbox.init;


$(document).ready(function() {

    $('.slideshow').cycle({
		fx: 'shuffle',
		shuffle: {
			top:100,
			left:0
		},
		speed:1500
	});

	// .png - Fix IE6
	// apply to all png images
	//$('img[@src$=.png]').ifixpng();
	$('.pngfix').ifixpng();

	$('img.preview').click(function() {
		$('#vorschau').css('background-image','url(' + $(this).attr('src') + ')');
	});

	//Metanavigation
	$("li.metalink").hover(

		function () {

			//alle anderen ausblenden falls noch welche aktiv sind -> bugfix
			$(".metalink").children("ul").hide();

			var bu_up =	$(this).children("a").attr("rel");

			var pos = $(this).position();

			$(this).children("a").attr("rel", $(this).children("a").children("img").attr("src"));
			$(this).children("a").children("img").attr("src", bu_up);

			$(this).children("ul").css("left", pos.left);
			$(this).children("ul").css("top", pos.top + 50);

			$(this).children("ul").show();
		},

		function () {

			var bu_do =	$(this).children("a").attr("rel");

			$(this).children("a").attr("rel", $(this).children("a").children("img").attr("src"));
			$(this).children("a").children("img").attr("src", bu_do);

			$(this).children("ul").hide();

		}

	);

	$('a#mondtage').hover(
		function(){
			var bu_up =	$(this).attr("rel");
			$(this).attr("rel", $(this).children("img").attr("src"));
			$(this).children("img").attr("src", bu_up);
		},
		function(){
			var bu_do =	$(this).attr("rel");
			$(this).attr("rel", $(this).children("img").attr("src"));
			$(this).children("img").attr("src", bu_do);
		}
	);

	//Validierung
	$("#validate_form").validate();

	// Captcha
	$("#captcha").click(function(){

		var random = Math.floor(Math.random()*25600);

		$("#captcha img").attr({
			src: "../captcha/image.php?new_captcha=true&" + random
		});
	});


});

function addBookmark(title, url) {
	if (window.sidebar) { // firefox
		window.sidebar.addPanel(title, url,"");
	} else if( document.all ) { //MSIE
		window.external.AddFavorite( url, title);
	} else {
		alert('Nicht unterstützt');
	}
}


