/*
Opernfreunde Functions 
*/

/* Dialoge */
	jQuery(function() {
		jQuery( "#eme-rsvp-form" ).dialog({
			autoOpen: false,
			show: "fade",
			hide: "fade",
			width: 550,
			title: "&nbsp;",
			modal: true
		});
		jQuery( "#eme-rsvp-message" ).dialog({
			autoOpen: true,
			show: "fade",
			hide: "fade",
			height: 120,
			width: 450,
			title: "&nbsp;",
			modal: true,
			buttons: {
				Ok: function() {
					jQuery( this ).dialog( "close" );
					return false;
				}
			}
		});
		jQuery( "#book-event" )
			.button()
			.click(function() {
				jQuery( "#eme-rsvp-form" ).dialog( "open" );
				return false;
		});
	});
	jQuery(function() {
		jQuery(".modal").dialog({
			autoOpen: false,
			show: "fade",
			hide: "fade",
			width: 420,
			modal: true
		});
		
		jQuery( ".mitgliedschaft-foerderer" ).dialog({ autoOpen: false, title: 'F&ouml;rderndes Mitglied werden' });
		jQuery( ".modal-mitgliedschaft-foerderer" ).button().click(function() { jQuery( ".mitgliedschaft-foerderer" ).dialog( "open" ); return false; });
		jQuery( ".mitgliedschaft-mitglied" ).dialog({ autoOpen: false, title: 'Unterst&uuml;tzendes Mitglied werden'});
		jQuery( ".modal-mitgliedschaft-mitglied" ).button().click(function() { jQuery( ".mitgliedschaft-mitglied" ).dialog( "open" ); return false; });
		jQuery( ".mitgliedschaft-familie" ).dialog({ autoOpen: false, title: 'Familienmitgliedschaft bestellen' });
		jQuery( ".modal-mitgliedschaft-familie" ).button().click(function() { jQuery( ".mitgliedschaft-familie" ).dialog( "open" ); return false; });
		jQuery( ".mitgliedschaft-maezen" ).dialog({ autoOpen: false, title: 'M&auml;zen der Opernfreunde werden' });
		jQuery( ".modal-mitgliedschaft-maezen" ).button().click(function() { jQuery( ".mitgliedschaft-maezen" ).dialog( "open" ); return false; });
		jQuery( ".mitgliedschaft-sponsor" ).dialog({ autoOpen: false, title: 'SponsorIn der Opernfreunde werden' });
		jQuery( ".modal-mitgliedschaft-sponsor" ).button().click(function() { jQuery( ".mitgliedschaft-sponsor" ).dialog( "open" ); return false; });
		jQuery( ".mitgliedschaft-jugend" ).dialog({ autoOpen: false, title: 'Jugendmitgliedschaft bestellen' });
		jQuery( ".modal-mitgliedschaft-jugend" ).button().click(function() { jQuery( ".mitgliedschaft-jugend" ).dialog( "open" ); return false; });
		jQuery( ".modal-mitgliedschaft-jugend-2" ).click(function() { jQuery( ".mitgliedschaft-jugend" ).dialog( "open" ); return false; });
		jQuery( ".mitgliedschaft-korrespondierend" ).dialog({ autoOpen: false, title: 'Korrespondierendes Mitglied werden' });
		jQuery( ".modal-mitgliedschaft-korrespondierend" ).button().click(function() { jQuery( ".mitgliedschaft-korrespondierend" ).dialog( "open" ); return false; });
		jQuery( ".wpcf7-validation-errors" ).dialog({
			autoOpen: true,
			show: "fade",
			hide: "fade",
			height: 120,
			width: 450,
			modal: true
		});
		jQuery( ".wpcf7-mail-sent-ok" ).dialog({
			autoOpen: true,
			show: "fade",
			hide: "fade",
			height: 120,
			width: 450,
			modal: true
		});
		jQuery( ".jahrbuch" ).dialog({ autoOpen: false, title: 'Jahrbuch bestellen' });
		jQuery( ".modal-jahrbuch" ).click(function() { jQuery( ".jahrbuch" ).dialog( "open" ); return false;});
	});
	
	
//Clears fields on click
		function clearField(form) {
		jQuery(form).find("input.text, textarea").each(function(){	
			this.defaultValue = this.value;
			jQuery(this).click(function(){
				if(this.value == this.defaultValue){
					jQuery(this).val("");
				}
				return false;
			});
			jQuery(this).blur(function(){
				if(this.value == ""){
					jQuery(this).val(this.defaultValue);
				}
			});
		});
		}
	
	
jQuery(document).ready(function() {
		var $loading = jQuery('<div>Loading...</div>');
 
		jQuery('.links-modal-div a.links-modal').each(function() {
			var $dialog = jQuery('<div></div>')
				.append($loading.clone());
			var $link = jQuery(this).one('click', function() {
				$dialog
					.load($link.attr('href') + ' #content')
					.dialog({
						title: $link.attr('title'),
						width: 860,
						show: "fade",
						hide: "fade",
						modal: true
					});
 
				$link.click(function() {
					$dialog.dialog('open');
 
					return false;
				});
 
				return false;
			});
		});
	});
	
/*Design Elemente*/
	jQuery(document).ready(function() {
		clearField("#search-input");
		jQuery("#jq-search").css("opacity","0.5");
		jQuery(".jq-logo").css("opacity","0.6");
		jQuery(".sign").css("opacity","0.2");
		jQuery(".jugend-sign").css("opacity","0.5");
		jQuery(".jq-footer").css("opacity","0.7");
		jQuery(".front-more-info").css({'bottom': -10, 'opacity': 0.2, 'filter':'alpha(opacity=20)' });
		jQuery(".jq-button").css("opacity","0.5");
		//jQuery('.sf-menu li').css({'opacity': 0.5});
		//jQuery('.sf-menu li li').css({'opacity': 1});
		//jQuery(".sf-menu li").css({"opacity": "0.5", "filter":"alpha(opacity=50)" });
		//jQuery(".sf-menu li li").css({"opacity": "1", "filter":"alpha(opacity=100)" });
		jQuery(".page-item-99").css("opacity","1");
		//jQuery("ul.sf-menu").css("opacity","0.8");
		jQuery('ul.sf-menu').superfish({
			animation:   {opacity:'show',height:'show'},
			speed: "normal",
			delay: 600,
			autoArrows: false
		});
		jQuery("#accordion").accordion({
			autoHeight: false,
			active: false
			});
	});
	
jQuery(function() {
	jQuery("#jugend-sidemenu").hover(
		function () { jQuery(".jugend-sign").stop().animate({ opacity: 1.0 }, "slow");},
		function () { jQuery(".jugend-sign").stop().animate({ opacity: 0.5 }, "slow"); });
	jQuery(".jugend-sign").hover(
		function () { jQuery(this).stop().animate({ opacity: 1.0 }, "slow");},
		function () { jQuery(this).stop().animate({ opacity: 0.5 }, "slow"); });
	jQuery("#jq-search").hover(
		function () { jQuery("#jq-search").stop().animate({ opacity: 1.0 }, "slow");},
		function () { jQuery("#jq-search").stop().animate({ opacity: 0.5 }, "slow"); });
	jQuery("#search-input").hover(
		function () { jQuery("#jq-search").stop().animate({ opacity: 1.0 }, "slow");},
		function () { jQuery("#jq-search").stop().animate({ opacity: 0.5 }, "slow"); });
	jQuery(".jq-logo").hover(
		function () { jQuery(this).stop().animate({ opacity: 1.0 }, "slow");},
		function () { jQuery(this).stop().animate({ opacity: 0.6 }, "slow"); });
	jQuery(".jq-footer").hover(
		function () { jQuery(this).stop().animate({ opacity: 1.0 }, "slow");},
		function () { jQuery(this).stop().animate({ opacity: 0.7 }, "slow"); });
	jQuery(".page-item-99").hover(
		function () { jQuery(this).stop().animate({ opacity: 1.0 }, "slow");},
		function () { jQuery(this).stop().animate({ opacity: 1.0 }, "slow"); });
	jQuery(".jq-button").hover(
		function () { jQuery(this).stop().animate({ opacity: 1.0 }, "slow");},
		function () { jQuery(this).stop().animate({ opacity: 0.5 }, "slow"); });
	//jQuery(".jq-header").hover(
	//	function () { jQuery(".sign").stop().animate({ opacity: 1.0 }, "slow");},
	//	function () { jQuery(".sign").stop().animate({ opacity: 0.2 }, "slow"); });
	jQuery(".sign").hover(
		function () { jQuery(this).stop().animate({ opacity: 1.0 }, "slow");},
		function () { jQuery(this).stop().animate({ opacity: 0.2 }, "slow"); });
	jQuery("#event-wrapper-table tr").hover(
		function () { jQuery(this).stop().animate({ "background-color": "#e2eafb;" }, "slow"); },
		function () { jQuery(this).stop().animate({ "background-color": "#fff;" }, "slow");
		});
	jQuery("#pageofposts-table tr").hover(
		function () { jQuery(this).stop().animate({ "background-color": "#e2eafb;" }, "slow"); },
		function () { jQuery(this).stop().animate({ "background-color": "#fff;" }, "slow");
		});
	jQuery(".post-class-109 td").hover(
		function () { jQuery(this).stop().animate({ "background-color": "#e2eafb;" }, "slow"); },
		function () { jQuery(this).stop().animate({ "background-color": "#fff;" }, "slow");
		});
	});


