
$(document).ready(function() {

	//fix PNG-BUG IE<=6
	$("img").ifixpng();
	$("#main").ifixpng();
	$("#header").ifixpng();
	$("#meta_a img").ifixpng();
	$("#meta_b img").ifixpng();


	$("#meta_a img").hover(

		//mouseover
		function () {

			$(this).attr("src", $(this).parent("a").attr("rel_up"));

			$(this).ifixpng();

		},

		//mouseout
		function () {

			$(this).attr("src", $(this).parent("a").attr("rel_do"));

			$(this).ifixpng();

		}

	);

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

	$("#meta_b img").hover(

		//mouseover
		function () {

			$(this).attr("src", $(this).parent("a").attr("rel_up"));

			$(this).ifixpng();

		},

		//mouseout
		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
		});
	});

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

		rules: {
			email: {
				email:true
			}
		}
	});

	// Onlinebestellung auswahl

	$("#auswahl").change(function() {

		var auswahl = $(this).val();

		// Je nach value in Select Box => Anzeige ändern
		if(auswahl == 1) {
			$(".best_show_not").hide();
			// Pflichtfelder entfernen
			$(".best_anlagen input").removeClass("required");
			// Klasse error entfernen
			$(".best_anlagen input").removeClass("error");
			$(".best_heim_garten").show();
		} else if(auswahl == 2) {
			$(".best_show_not").hide();
			// Pflichtfelder
			$(".best_anlagen input").addClass("required");
			$(".best_anlagen").show();
		} else if(auswahl == 3){
			$(".best_show_not").hide();
			// Pflichtfelder entfernen
			$(".best_anlagen input").removeClass("required");
			// Klasse error entfernen
			$(".best_anlagen input").removeClass("error");
			$(".best_grabstaetten").show();
		}
	});

});

