$(document).ready(function() {
  var searchBox = $("input.s1");
  var searchBoxDefault = "Search the Victoria Symphony";

  searchBox.focus(function(){
          if($(this).attr("value") == searchBoxDefault) $(this).attr("value", "");
  });
  searchBox.blur(function(){
          if($(this).attr("value") == "") $(this).attr("value", searchBoxDefault);
  });
  
 
});

$(document).ready(function(){		
	
	$("div#top_nav ul li ul").hide();
	$("div#top_nav li").mouseenter(function(){
	    $(this).children("ul").fadeIn('slow');
	});

	$("div#top_nav li").mouseleave(function(){
	    $(this).children("ul").hide();
		$(this).find('li.openable').removeClass('active').find('div.accordion').hide();
	});
	
	$(".mega_menu").hide();
	$("li.has_mega_menu").mouseenter(function(){
		$(this).children('.mega_menu').fadeIn();
	});
	
	$("li.has_mega_menu").mouseleave(function(){
	    $(this).children(".mega_menu").hide();
	});	
	
	$(".drop_box").hide();
	$("div#top_nav li").mouseenter(function(){
		$(this).children('.drop_box').fadeIn();
	});
	
	$("div#top_nav li").mouseleave(function(){
	    $(this).children(".drop_box").hide();
	});
	
	// Accordion 
	
	$('div#top_nav li .accordion').parent().addClass('openable');
	//Set default open/close settings
	$('div#top_nav li .accordion').hide(); //Hide/close all containers
	
	//On Click
	$('div#top_nav li.openable').click(function(){
		
		if( $(this).children('div.accordion').is(':hidden') ) {
			 //If immediate next container is closed...	
			$(this).siblings().removeClass('active').children('div.accordion').slideUp(); //Remove all "active" state and slide up the immediate next container
			$(this).toggleClass('active').children('div.accordion').slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
		}
		else {
			$(this).removeClass('active').children('div.accordion').slideUp();
		}
		
		if( $(this).parent().parent().is('#side_nav')){
			openTheSidenav();				
		}

		return false; //Prevent the browser jump to the link anchor
	});
	
	
	$('ul.slide_left').siblings('span').addClass('left');
	$('.accordion > a').click(function(){
		var url = $(this).attr('href');
			window.location = url;
	});
	
	
	$(".rounded_event_lthumb").corner("10px");
	$(".rounded_event_shthumb, .rounded_event_sthumb").corner("6px");
        $(".rounded_thumb").corner("6px");
        $(".rounded_post_image").corner("12px");
        $(".rounded_sm_post_image").corner("8px");
        $("a.cbme").colorbox({maxWidth:"95%"});
        $("a.cbyme").colorbox({innerWidth:"565px", innerHeight:"354px", inline:true, href:"#splash_youtube"});
        $("a.cbmme").colorbox({innerWidth:"570px", innerHeight:"500px", inline:true, href:"#splash_fullinfo"});
        $("a.cbcme").colorbox({innerWidth:"570px", innerHeight:"500px", inline:true, href:"#splash_contact"});
        $("a.cbfme").colorbox({innerWidth:"645px", innerHeight:"600px", inline:true, href:"#splash_facebook"});
        
        var newsBox = $("input#input_1_1");
	var newsBoxDefault = "Please enter your E-mail address";	
	newsBox.focus(function(){
		if($(this).attr("value") == newsBoxDefault) $(this).attr("value", "");
	});
	newsBox.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", newsBoxDefault);
	});
});  		
