$(document).ready(function(){
//search
$("label.overlabel").overlabel();
	
// Event Register Hint
//	$('.event-register .comments').append('<br /><span class="note"><strong>Note:</strong> Please include your year of birth</span>');

//accordion
	//Set default open/close settings
	$('.accordion h2').siblings().hide(); //Hide/close all content
	$('.accordion h4').siblings().hide(); //Hide/close all content

	//On Click
	$(".accordion h2").click(function(){
		$(this).toggleClass("active").siblings().slideToggle("slow");
	});
	$(".accordion h4").click(function(){
		$(this).toggleClass("active").siblings().slideToggle("slow");
	});
//accordion2
	$(".accordion2 div").hide();
	$(".accordion2 h3").click(function(){
	  $(this).next("div").slideToggle("slow")
	  .siblings("div").slideUp("slow");
	  $(this).toggleClass("active");
	  $(this).siblings("h3").removeClass("active");
	});
//staff bubbles
	$(".infoBubble").hide().append("<img src='/assets/gfx/bg-arrow.gif' />"); //Hide all bubbles & add buble arrow
	
	//On Hover
	$("#staff a").hover(function() {
		var thisemployee = $(this).parent();
		$(thisemployee).css("z-index","1");
		$(".infoBubble",thisemployee).fadeIn("fast");
	},
	function() {
		var thisemployee = $(this).parent();
		$(thisemployee).mouseleave(function(){
			$(".infoBubble",this).hide();
			$(thisemployee).css("z-index","0");
		});
	});
	//Safe Sleeping Tips
	if('.rollover'){
		var rollover = $('.rollover');
		rollover.bind('mouseover mouseout',function(){
			$(this).next().toggle();
		})
	}

});

// Search site - positions labels inside text fields
( function( $ ) {
 
    // plugin definition
    $.fn.overlabel = function( options ) {
 
        // build main options before element iteration
        var opts = $.extend( {}, $.fn.overlabel.defaults, options );
 
        var selection = this.filter( 'label[for]' ).map( function() {
 
            var label = $( this );
            var id = label.attr( 'for' );
            var field = document.getElementById( id );
 
            if ( !field ) return;
 
            // build element specific options
            var o = $.meta ? $.extend( {}, opts, label.data() ) : opts;
 
            label.addClass( o.label_class );
 
            var hide_label = function() { label.css( o.hide_css ) };
            var show_label = function() { this.value || label.css( o.show_css ) };
 
            $( field )
                 .parent().addClass( o.wrapper_class ).end()
                 .focus( hide_label ).blur( show_label ).each( hide_label ).each( show_label );
 
            return this;
 
        } );
 
        return opts.filter ? selection : selection.end();
    };
 
    // publicly accessible defaults
    $.fn.overlabel.defaults = {
 
        label_class:   'overlabel-apply',
        wrapper_class: 'compact_form',
        hide_css:      { 'text-indent': '-10000px' },
        show_css:      { 'text-indent': '0px', 'cursor': 'text' },
        filter:        false
 
    };
 
} )( jQuery );
