(function() {

  
	function headerShow( obj ){
		//console.log("good");
			if ( obj.width() > 782 && jQuery(this).scrollTop() > 80 ) { 
			jQuery('.header-nav').addClass('header-nav-sticky');
			}
			else{
			jQuery('.header-nav').removeClass('header-nav-sticky');
			}
				
		
		if ( obj.width() > 782 && obj.scrollTop() > 508 ) { 
			
			jQuery('.interior_banner_menu').addClass('interior_banner_menu-sticky');
		   	
		}
		else
		{
			jQuery('.interior_banner_menu').removeClass('interior_banner_menu-sticky');
		}
	}

	jQuery(window).resize( function(){
		if ( jQuery('.header-nav').hasClass('header-nav-sticky') || jQuery('.interior_banner_menu').hasClass('interior_banner_menu-sticky')  ){
			if ( jQuery(this).width() <= 782 ){
				jQuery('.header-nav').removeClass('header-nav-sticky');
				jQuery('.interior_banner_menu').removeClass('interior_banner_menu-sticky');
				headerShow( jQuery(window) );
			}
		}
	});

  	jQuery(window).scroll(function() {
  		headerShow( jQuery(window) );
	})

  
  
  
  
    jQuery(".header-nav .dropdown").hover(            



            function() {



                jQuery('.dropdown-menu', this).stop( true, true ).fadeIn("fast");



                jQuery(this).toggleClass('open');



                jQuery('b', this).toggleClass("caret caret-up");                



            },



            function() {



                jQuery('.dropdown-menu', this).stop( true, true ).fadeOut("fast");



                jQuery(this).toggleClass('open');



                jQuery('b', this).toggleClass("caret caret-up");                



    });



	var container = document.querySelector( 'div#wrapper' ),



		triggerBttn = document.getElementById( 'trigger-menu' ),



		overlay = document.querySelector( 'div.overlay' ),



		closeBttn = overlay.querySelector( 'button.overlay-close' );



		transEndEventNames = {



			'WebkitTransition': 'webkitTransitionEnd',



			'MozTransition': 'transitionend',



			'OTransition': 'oTransitionEnd',



			'msTransition': 'MSTransitionEnd',



			'transition': 'transitionend'



		},



		transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ],



		support = { transitions : Modernizr.csstransitions };







	function toggleOverlay() {



		if( jQuery(overlay).hasClass('open') ) {



			jQuery(overlay).removeClass('open');



			jQuery(container).removeClass('overlay-open' );



			jQuery(overlay).addClass('close' );



			var onEndTransitionFn = function( ev ) {



				if( support.transitions ) {



					if( ev.propertyName !== 'visibility' ) return;



					this.removeEventListener( transEndEventName, onEndTransitionFn );



				}



				jQuery(overlay).removeClass('close');



			};



			if( support.transitions ) {



				overlay.addEventListener( transEndEventName, onEndTransitionFn );



			}



			else {



				onEndTransitionFn();



			}



		}



		else if( !jQuery(overlay).hasClass( 'close' ) ) {



			jQuery(overlay).addClass( 'open' );



			jQuery(container).addClass( 'overlay-open' );







		}



	}







	triggerBttn.addEventListener( 'click', toggleOverlay );



	closeBttn.addEventListener( 'click', toggleOverlay );



})();







function changeHeight(){



	leftHeight = jQuery(".left_interior_painting").height();



	rightHeight = jQuery(".right_interior_painting").height();



	



	if ( leftHeight < rightHeight ){


		if ( jQuery("body.page-id-297713").length == 0 ){
			jQuery("#interior_painting:not(.full-width) .left_interior_painting").css("height",jQuery("#interior_painting").height() + "px");
		}



	}



}







jQuery("document").ready(function(){

	jQuery(".overlay nav ul li.dropdown").on("click", function(){
		jQuery(this).siblings().find(".dropdown-brown").hide();		
		jQuery(this).find(".dropdown-brown").toggle();
		jQuery(this).siblings().find("span").removeClass("caret-up").addClass("caret");  
		jQuery(this).find("span").toggleClass("caret caret-up");   
	})

	jQuery(".panelSlider .thumb_area").on("click",function(){



		window.location = jQuery(this).find("a").attr("href");



	});



	jQuery(".visible_link").on("click",function(){



		window.location = jQuery(this).data("link");



	});



	changeHeight();



	jQuery(window).resize(function(){



		if ( jQuery(this).width() > 767 ){



			changeHeight();



		}else{



			jQuery("#interior_painting:not(.full-width) .left_interior_painting").css("height","auto");



		}



	});



	



	if ( jQuery(".sub-menu").length > 0 ){

		dd = false;

		jQuery(".sub-menu").each(function(){
			if ( !dd ){
				if ( jQuery(this).find("li").length > 2 ){
					dd = true;
				}
			}else{
				jQuery(this).remove();
			}
		});
		//jQuery(".sub-menu").hide();
		//jQuery(".sub-menu").has("li").siblings().remove();

		jQuery(".interior_banner_menu").show();

	}



	jQuery(".events_select").on("change",function(){



	



		if ( jQuery(this).val().length > 15 ){



			  var link = document.createElement('a');



			  link.setAttribute('href', jQuery(this).val() );



			  link.setAttribute('target','_blank');



			  var clickevent = document.createEvent('Event');



			  clickevent.initEvent('click', true, false);



			  link.dispatchEvent(clickevent);



			  return false;



		}			



	



		if ( jQuery(this).val() != 0 ){



			window.location = "https://www.waterfrontplayhouse.org" + "?p=" + jQuery(this).val();



		}



	});



	



	jQuery(".news_entry img").bind("mouseover",function(){



		jQuery(this).parent().parent().parent().find(".news_info h2 a").css("text-decoration","underline");



	});







	jQuery(".news_entry img").bind("mouseout",function(){



		jQuery(this).parent().parent().parent().find(".news_info h2 a").css("text-decoration","none");



	});	



});







jQuery("document").ready(function(){



	jQuery(".membership_sub li a").bind("click",function(e){



		jQuery(".membership_crew").hide();



		jQuery(".membership_sub li.selected").removeClass("selected");



		jQuery(this).parent().addClass("selected");



		p = jQuery(this).html().toLowerCase().replace(" ","_").replace(" ","_").replace("!","");



		window.history.pushState("string", "Title", "?level=" + p );



		jQuery("#" + p).show();



		e.preventDefault();



	});	



	



	/*jQuery(".page-template-template-shows-php .thumb_image").on("click",function(){



		jQuery("#about_play").show();



		jQuery("#about_play").append('<div class="gray_loader"></div>');		



		jQuery(".play_container").hide();



		var data = {



			'action': 'play_info',



			'post_id': jQuery(this).parent().prop("id")      // We pass php values differently!



		};



		// We can also pass the url value separately from ajaxurl for front end AJAX implementations



		jQuery.post(ajaxurl, data, function(response) {



			jQuery(".play_container").remove();



			jQuery("#about_play").append(response);



			jQuery(".play_container").fadeIn(function(){



				jQuery('html, body').animate({



					scrollTop: jQuery("#about_play").offset().top



				}, 500);			



			});



			jQuery(".gray_loader").remove();



			



		});		



	});*/



/*	jQuery(window).scroll(function() {



	if (jQuery(this).scrollTop() > 1){  



	    jQuery('#header').addClass("top-header-sticky");



	  }



	  else{



	    jQuery('#header').removeClass("top-header-sticky");



	  }



	});





*/









});



	



	



