$(document).ready(function() { 
	
	
	
	// create Accordion
 
 	$(".test3").hrzAccordion({containerClass     : "container3",
			listItemClass      : "listItem3",					
			openOnLoad         :1,
			contentWrapper     : "contentWrapper3",
			contentInnerWrapper: "contentInnerWrapper3",
			handleClass        : "handle3",
			handleClassOver    : "handleOver3",
			autoHeight: false, 
			handleClassSelected: "handleSelected3"
							  });
							  
					  
							  
			  
 	
        
	$("ul.navlistLeft").superfish({ 
	    autoArrows:  false, 
	    dropShadows: true, 
	    animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
	    speed:       'slow',                          // faster animation speed     
	    delay:     1500               // 1.2 second delay on mouseout 
	});

	
	/*
	$('.newsContent').jScrollPane();
	$('#partnerContent').jScrollPane();
	$('.eventContent').jScrollPane();
	*/
	
	
	$("a[rel='group1']").colorbox();		
	$("a[rel='karte']").colorbox();
	
		
	$('#image_rotate').innerfade({ 
		speed: 'slow', 
		timeout: 8000, 
		type: 'sequence', 
		containerheight: '89px'
	});

	
	function hideContenFromUnternehmen(){
		
		$("#content01").css("display","none");
		$("#zahlen_faktenContentUnternehmen").css("display","none");
		$("#philosophieContent").css("display","none");
		$("#referenzenContent").css("display","none");
		$("#partnerContent").css("display","none");
		$("#jobsContent").css("display","none");
		$("#kontaktContent").css("display","none");
		
		$("#impressumContent").css("display","none");
		$("#disclaimerContent").css("display","none");
		
		
		$("#bg").html('<img src="images/bg_unternehmen.jpg" width="100%" height="100%" alt="">'); 
		
	};
	
	hideContenFromUnternehmen();
		
	$("#content01").css("display","block");
		
	
	
	$('a#unternehmen').click(
		function () {
			hideContenFromUnternehmen();
			$('#content01').fadeIn('slow');
			$("#content01").css("display","inline");
			
			$('#test3Handle0').click();	
			return false;
	});
				
				
	
	$('a#home').click(
		function () {
			hideContenFromUnternehmen();
			$('#content01').fadeIn('slow');
			$("#content01").css("display","inline");
			
			$('#test3Handle0').click();	
			return false;
	});
			
		
	$('a#zahlen_fakten_unternehmen').click(
		function () {
			hideContenFromUnternehmen();
			$('#zahlen_faktenContentUnternehmen').fadeIn('slow');
			$("#zahlen_faktenContentUnternehmen").css("display","inline");
			$('#test3Handle0').click();				
			return false;
	});
	
		
	$('a#philosophie').click(
		function () {
			hideContenFromUnternehmen();
			$('#philosophieContent').fadeIn('slow');
			$("#philosophieContent").css("display","inline");
			$('#test3Handle0').click();				
			return false;

	});
	
	$('a#referenzen').click(
		function () {
			hideContenFromUnternehmen();
			$('#referenzenContent').fadeIn('slow');
			$("#referenzenContent").css("display","inline");
			$('#test3Handle0').click();				
			return false;
	});
	
	$('a#partner').click(
		function () {
			hideContenFromUnternehmen();
			$('#partnerContent').fadeIn('slow');
			$("#partnerContent").css("display","inline");
			$('#test3Handle0').click();					
			return false;
	});
	
	$('a#jobs').click(
		function () {
			hideContenFromUnternehmen();
			$('#jobsContent').fadeIn('slow');
			$("#jobsContent").css("display","inline");
			$('#test3Handle0').click();				
			return false;
	});
	
	
	$('a#kontakt').click(
		function () {
			hideContenFromUnternehmen();
			$('#kontaktContent').fadeIn('slow');
			$("#kontaktContent").css("display","inline");
			$('#test3Handle0').click();				
			return false;
	});
	
	$('a#kontaktBottom').click(
		function () {
			hideContenFromUnternehmen();
			$('#kontaktContent').fadeIn('slow');
			$("#kontaktContent").css("display","inline");
			$('#test3Handle0').click();				
			return false;
	});



	$('a#disclaimer').click(
		function () {
			hideContenFromUnternehmen();
			$('#disclaimerContent').fadeIn('slow');
			$("#disclaimerContent").css("display","inline");
			$('#test3Handle0').click();				
			return false;
	});
	
	$('a#impressum').click(
		function () {
			hideContenFromUnternehmen();
			$('#impressumContent').fadeIn('slow');
			$("#impressumContent").css("display","inline");
			$('#test3Handle0').click();				
			return false;
	});

	/* -------------------------------------------------------------*/
	
	function hideContenFromProgram(){
			$("#content02").css("display","none");
			$("#monat01Content").css("display","none");
			$("#monat02Content").css("display","none");
			$("#monat03Content").css("display","none");
			$("#vorschauContent").css("display","none");
			
			$("#bg").html('<img src="images/bg_programm.jpg" width="100%" height="100%" alt="">'); 
	};
	hideContenFromProgram();

	$('a#program').click(
		function () {
			hideContenFromProgram();
			$('#content02').fadeIn('slow');
			$("#content02").css("display","inline");
			$('#test3Handle1').click();
			return false;
	});
	
	$('a#monat01').click(
		function () {
			hideContenFromProgram();
			$('#monat01Content').fadeIn('slow');
			$("#monat01Content").css("display","inline");
			$('#test3Handle1').click();
			return false;
	});


	$('a#monat02').click(
			function () {
			hideContenFromProgram();
			$('#monat02Content').fadeIn('slow');
			$("#monat02Content").css("display","inline");
			$('#test3Handle1').click();
			return false;
	});
	
	$('a#monat03').click(
			function () {
			hideContenFromProgram();
			$('#monat03Content').fadeIn('slow');
			$("#monat03Content").css("display","inline");
			$('#test3Handle1').click();
			return false;
	});

	
	$('a#monat01Link').click(
			function () {
			hideContenFromProgram();
			$('#monat01Content').fadeIn('slow');
			$("#monat01Content").css("display","inline");
			$('#test3Handle1').click();
			return false;
	});

	$('a#monat02Link').click(
			function () {
			hideContenFromProgram();
			$('#monat02Content').fadeIn('slow');
			$("#monat02Content").css("display","inline");
			$('#test3Handle1').click();
			return false;
	});

	$('a#monat03Link').click(
			function () {
			hideContenFromProgram();
			$('#monat03Content').fadeIn('slow');
			$("#monat03Content").css("display","inline");
			$('#test3Handle1').click();
			return false;
	});	
	
	$('a#vorschau').click(
			function () {
			hideContenFromProgram();
			$('#vorschauContent').fadeIn('slow');
			$("#vorschauContent").css("display","inline");
			$('#test3Handle1').click();
			return false;
	});	
	
	
	$('a#vorschauLink').click(
			function () {
			hideContenFromProgram();
			$('#vorschauContent').fadeIn('slow');
			$("#vorschauContent").css("display","inline");
			$('#test3Handle1').click();
			return false;
	});	
	
	
	
	/*
	function openProgramContent(){
			hideContenFromProgram();
			$('#content02').fadeIn('slow');
			$('#test3Handle1').click();
			return false;
	}
	*/
	
	
	
	/* -------------------------------------------------------------*/
	
	function hideContenFromStadthalle(){
		$("#content03").css("display","none");
		$("#zahlen_faktenContentStadthalle").css("display","none");
		$("#impressionenContent").css("display","none");
		$("#technikContent").css("display","none");
		$("#raeume_plaeneContent").css("display","none");
		$("#bit_erlebnisweltContent").css("display","none");
		
		$("#bg").html('<img src="images/bg_stadthalle.jpg" width="100%" height="100%" alt="">'); 
					
	};
	hideContenFromStadthalle();
	
	$('a#stadthalle').click(
		function () {
			hideContenFromStadthalle();
			$('#content03').fadeIn('slow');
			$("#content03").css("display","inline");
			$('#test3Handle2').click();
			return false;
	});	
	
	$('a#zahlen_fakten_stadthalle').click(
		function () {
			hideContenFromStadthalle();
			$('#zahlen_faktenContentStadthalle').fadeIn('slow');
			$("#zahlen_faktenContentStadthalle").css("display","inline");
			$('#test3Handle2').click();				
			return false;
	});

	$('a#impressionen').click(
		function () {
			hideContenFromStadthalle();
			$('#impressionenContent').fadeIn('slow');
			$("#impressionenContent").css("display","inline");
			$('#test3Handle2').click();				
			return false;
	});

	$('a#technik').click(
		function () {
			hideContenFromStadthalle();
			$('#technikContent').fadeIn('slow');
			$("#technikContent").css("display","inline");
			$('#test3Handle2').click();				
			return false;
	});
	
	$('a#raeume_plaene').click(
		function () {
			hideContenFromStadthalle();
			$('#raeume_plaeneContent').fadeIn('slow');
			$("#raeume_plaeneContent").css("display","inline");
			$('#test3Handle2').click();				
			return false;
	});
	
	$('a#bit_erlebniswelt').click(
		function () {
			hideContenFromStadthalle();
			$('#bit_erlebnisweltContent').fadeIn('slow');
			$("#bit_erlebnisweltContent").css("display","inline");
			$('#test3Handle2').click();				
			return false;
	});
	
	
	/* -------------------------------------------------------------*/
	
	function hideContenFromLeistungen(){
		$("#content04").css("display","none");
		$("#cateringContent").css("display","none");
		$("#dekorationContent").css("display","none");
		$("#personalContent").css("display","none");
		$("#eventberatungContent").css("display","none");
		$("#besucherserviceContent").css("display","none");
		
		$("#bg").html('<img src="images/bg_leistungen.jpg" width="100%" height="100%" alt="">'); 
				
	};

	hideContenFromLeistungen();
	
	$('a#leistung').click(
		function () {
			hideContenFromLeistungen();
			$('#content04').fadeIn('slow');
			$("#content04").css("display","inline");
			$('#test3Handle3').click();
			return false;
	});
	
	$('a#catering').click(
		function () {
			hideContenFromLeistungen();
			$('#cateringContent').fadeIn('slow');
			$("#cateringContent").css("display","inline");
			$('#test3Handle3').click();
			return false;
	});	
	
	$('a#dekoration').click(
		function () {
			hideContenFromLeistungen();
			$('#dekorationContent').fadeIn('slow');
			$("#dekorationContent").css("display","inline");
			$('#test3Handle3').click();
			return false;
	});	
	
	
	$('a#personal').click(
		function () {
			hideContenFromLeistungen();
			$('#personalContent').fadeIn('slow');
			$("#personalContent").css("display","inline");
			$('#test3Handle3').click();
			return false;
	});	
	
	$('a#eventberatung').click(
		function () {
			hideContenFromLeistungen();
			$('#eventberatungContent').fadeIn('slow');
			$("#eventberatungContent").css("display","inline");
			$('#test3Handle3').click();
			return false;
	});	
	
	$('a#besucherservice').click(
		function () {
			hideContenFromLeistungen();
			$('#besucherserviceContent').fadeIn('slow');
			$("#besucherserviceContent").css("display","inline");
			$('#test3Handle3').click();
			return false;
	});	

	/* -------------------------------------------------------------*/
	
	function hideContenFromAnfahrtLage(){
		$("#content05").css("display","none");
		$("#pkw_parkenContent").css("display","none");
		$("#bus_bahnContent").css("display","none");
		$("#hotelsContent").css("display","none");
		$("#gastronomieContent").css("display","none");
		
		$("#bg").html('<img src="images/bg_anfahrt.jpg" width="100%" height="100%" alt="">'); 
	};
	
	hideContenFromAnfahrtLage();
	
	$('a#anfahrt_lage').click(
		function () {
			hideContenFromAnfahrtLage();
			$('#content05').fadeIn('slow');
			$("#content05").css("display","inline");
			$('#test3Handle4').click();
			return false;
	});

	$('a#pkw_parken').click(
		function () {
			hideContenFromAnfahrtLage();
			$('#pkw_parkenContent').fadeIn('slow');
			$("#pkw_parkenContent").css("display","inline");
			$('#test3Handle4').click();
			return false;
	});
	
	$('a#bus_bahn').click(
		function () {
			hideContenFromAnfahrtLage();
			$('#bus_bahnContent').fadeIn('slow');
			$("#bus_bahnContent").css("display","inline");
			$('#test3Handle4').click();
			return false;
	});
	
	$('a#hotels').click(
		function () {
			hideContenFromAnfahrtLage();
			$('#hotelsContent').fadeIn('slow');
			$("#hotelsContent").css("display","inline");
			$('#test3Handle4').click();
			return false;
	});
	
	$('a#gastronomie').click(
		function () {
			hideContenFromAnfahrtLage();
			$('#gastronomieContent').fadeIn('slow');
			$("#gastronomieContent").css("display","inline");
			$('#test3Handle4').click();
			return false;
	});
	
	
	
	/* -------------------------------------------------------------*/
	
	function hideContenFromPresseNews(){
		$("#content06").css("display","none");
		$("#aktuellContent").css("display","none");
		$("#archivContent").css("display","none");
		$("#bg").html('<img src="images/bg_presse.jpg" width="100%" height="100%" alt="">'); 
	
	};
	
	hideContenFromPresseNews();

	$('a#presse_news').click(
		function () {
			hideContenFromPresseNews();
			$('#content06').fadeIn('slow');
			$("#content06").css("display","inline");
			$('#test3Handle5').click();
			return false;
	});

	$('a#aktuell').click(
		function () {
			hideContenFromPresseNews();
			$('#aktuellContent').fadeIn('slow');
			$("#aktuellContent").css("display","inline");
			$('#test3Handle5').click();
			return false;
	});
	
	$('a#archiv').click(
		function () {
			hideContenFromPresseNews();
			$('#archivContent').fadeIn('slow');
			$("#archivContent").css("display","inline");
			$('#test3Handle5').click();
			return false;
	});
	
	
	$('a#aktuellLink').click(
		function () {
			hideContenFromPresseNews();
			$('#aktuellContent').fadeIn('slow');
			$("#aktuellContent").css("display","inline");
			$('#test3Handle5').click();
			return false;
	});

	$('a#archiveLink').click(
		function () {
			hideContenFromPresseNews();
			$('#archivContent').fadeIn('slow');
			$("#archivContent").css("display","inline");
			$('#test3Handle5').click();
			return false;
	});
	
	
	
	/* -------------------------------------------------------------*/	
	// Dialog			
	$('#dialog').dialog({
		autoOpen: false,
		width: 360,
		bgiframe: false,
		height: 415,
		modal: false


		,buttons: {
			/*"Absenden": function() { 
				$(this).dialog("close"); 
			}, 
			"Abbrechen": function() { 
				$(this).dialog("close"); 
			} */
		}
	});
	
	
	function isValidEmailAddress(emailAddress) {

		var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);

		return pattern.test(emailAddress);

	}
	
	$('a#kontaktFormSend').click(
		function () {
			var error = false;
			var errorMsg = "";
			
			var mailVal = $("input#email").val();
			if(mailVal ==""){
				error = true;
				errorMsg = errorMsg + "Email ist ein Pflichtfeld\n";
			}else{
				if(!isValidEmailAddress(mailVal)){
					error = true;
					errorMsg = errorMsg + "Email Format ist falsh\n";
				}
			}
			
			var nameVal = $("input#name").val();
			if(nameVal ==""){
				error = true;
				errorMsg = errorMsg + "Name ist ein Pflichtfeld\n";
			}
			
			if(error){
				errorMsg = errorMsg + "\nBitte ausfühlen!\n";
				alert(errorMsg);
			}else{
				
				$("form:myForm").submit();
			}
						
			return false;
	});

	
	
	// Dialog Link
	$('#create_kontaktformular').click(function(){
		$('#dialog').dialog('open');
		return false;
	});

	$("#bg").html('<img src="images/bg_unternehmen.jpg" width="100%" height="100%" alt="">'); 
	
});




