$(document).ready(function(){
	
	var href;
	var hinweistext;
						   
	$("#formAnruf").click(function(){
			if($("#formAnruf").is(':checked')){
				//alert("Checkbox #anruf gecheckt");
				
				$("input#formTelefon").addClass('required');
				$("label[for=formTelefon]").append('<abbr title="Eingabe erforderlich">*</abbr>');
				
				//var el = "$('label[for=telefon]')";
				//el.html(el.html().replace(/word/ig, ""));
				
				/*
					$("label").attr("for","telefon").each(
						function(){
							var neu=this.text();
							neu.replace("Telefon", "bar");
							this.text(neu);
						}
					);
				*/
				
				// Telefon -> required
			}
			else {
				//alert("Checkbox ist #anruf nicht markiert");
				var regexp = /<(".")*>/;  
				$("label[for=formTelefon]").each(function(){
					//var Text1 = $(this).text().replace(regexp,"");
					//$(this).text(Text1);
					//alert('sads');
					
					$("label[for=formTelefon] abbr").replaceWith("");
					$("input#formTelefon").removeClass('required');
					$("input#formTelefon").removeClass('error');
				});
			}
	});
	
	$("#formInformationen").click(function(){
			if($("#formInformationen").is(':checked')){
				//alert("Checkbox #formInformationen gecheckt");
				
				$("label[for=formWohnort]").append('<abbr title="Eingabe erforderlich">*</abbr>');
				$("input#formWohnort").addClass('required');
				
				$("label[for=formStrasse]").append('<abbr title="Eingabe erforderlich">*</abbr>');
				$("input#formStrasse").addClass('required');
				
				// Wohnort, Straße-> required
			}
			else {
				//alert("Checkbox ist #formInformationen nicht markiert");
				
				$("label[for=formWohnort] abbr").replaceWith("");
				$("input#formWohnort").removeClass('required');
				$("input#formWohnort").removeClass('error');
				
				$("label[for=formStrasse] abbr").replaceWith("");
				$("input#formStrasse").removeClass('required');
				$("input#formStrasse").removeClass('error');
			}
	});
		
	
	$("#kontaktformular").validate({
		//onkeyup: false;
		rules: {
			email: {
       			required: true,
       			email: true
     		}
		}	
	});
	
	
	
/* jquery zum Ein- uns Ausblenden von Inhalten a la Ziamonika */
	//$(".unsichtbar").css('display','');
	
	$("ul.aufklappliste li h2 a").toggle(function()
	{
		$("ul.aufklappliste li > h2 > a").attr('class','openNextDiv');
		$("div.contentMain ul.aufklappliste li div").attr('class','gfg');
		
		$(this).addClass("aktiv");
		$(this).parent("h2").siblings("div").addClass('sichtbar');
		//css('display','block');
		return false;
	},
	function()
	{
		$(this).attr('class','openNextDiv');
		$(this).parent("h2").siblings("div").attr('class','');
		return false;
	});
	
	
	$(function() {
		$('#gallery a').lightBox({
			fixedNavigation:true,
			overlayBgColor: '#000',
			overlayOpacity: 0.6,
			containerResizeSpeed: 350,
			txtImage: 'Bild',
			txtOf: 'von'
		 });
	});
	
	
	$(function() {
		$('ul.bildergalerie a').lightBox({
			fixedNavigation:true,
			overlayBgColor: '#000',
			overlayOpacity: 0.6,
			containerResizeSpeed: 350,
			txtImage: 'Bild',
			txtOf: 'von'
		 });
	});
	
	
	$(function() {
		$('div.ausklappText a').lightBox({
			fixedNavigation:true,
			overlayBgColor: '#000',
			overlayOpacity: 0.6,
			containerResizeSpeed: 350,
			txtImage: 'Bild',
			txtOf: 'von'
		 });
	});
	
	
});
