$(document).ready(function() {

	//fix PNG-BUG IE<=6
	$("img").ifixpng();
	$("div#meta_a img").ifixpng();
	$("#meta_b img").ifixpng();
	$("div#bilderrahmen").ifixpng();
	$("div#header_full").ifixpng();
	$("div#content_kante_unten").ifixpng();
	$("div#content_kante_oben").ifixpng();
	$("div#werbung").ifixpng();
	$("div#header_full").ifixpng();
	$("div#content_head").ifixpng();
	$("div#content").ifixpng();

	$("div#footer span").ifixpng();

	$("div#systemstatus span").ifixpng();


	//Mouse Over and Out
	$("#meta_a img").hover(
		function () {
			$(this).attr("src", $(this).parent("a").attr("rel_up"));
			$(this).ifixpng();
		},
		function () {
			$(this).attr("src", $(this).parent("a").attr("rel_do"));
			$(this).ifixpng();
		}
	);
	//Mouse Over and Out
	$("#meta_b img").hover(
		function () {
			$(this).attr("src", $(this).parent("a").attr("rel_up"));
			$(this).ifixpng();
		},
		function () {
			$(this).attr("src", $(this).parent("a").attr("rel_do"));
			$(this).ifixpng();
		}
	);

////////////////////////////////////////////////////////////////////////////

    //drucken
    $("#drucken").click(function () {
    	window.print();
    });

    //bookmark
    $("#bookmark").click(function () {

		var url = $(this).attr("rel_url");
		var title = $(this).attr("rel_title");

		if (window.sidebar) { // Mozilla Firefox
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite(url, title);
		} else if(window.opera) { // Opera 7+
			var elem = document.createElement('a');
		    elem.setAttribute('href',url);
		    elem.setAttribute('title',title);
		    elem.setAttribute('rel','sidebar');
		    elem.click();
		} else {
			alert('Ihr Browser unterstützt diese Aktion leider nicht. Bitte fügen Sie diese Seite manuell zu Ihren Favoriten hinzu.');
		}

    });


	// Captcha
	$("#captcha").click(function(){
		var random = Math.floor(Math.random()*25600);

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

	});


	$('#photos').galleryView({
		panel_width: 578,
		panel_height: 233,
		frame_width: 106,
		frame_height: 101,
		nav_theme: 'dark'
	});


	//Prüfung ob alle Pflichtfelder ausgefüllt sind.
	$(".validate").validate();
});
