$(document).ready(function() {
  var dropdown = $('#committee-dropdown');
	dropdown.hide();
	
	$( '.event-title' ).hover( function() {
		$( this ).css('color', '#2caae2');
		$( this ).css('cursor', 'pointer');
	}).bind( "mouseleave", function() {		
		$( this ).css('color', '#30393d');
		$( this ).css('cursor', 'arrow');
	} );
	
	$( '.event-header' ).click( function() {
	  $( this ).siblings('dl.event-info').slideToggle('medium');
	} );

/*	$( '.category' ).click( function() {
		$( this ).toggleClass( 'active' )
		$( this ).siblings( '.dropdown' ).toggle();
		$( this ).find( '.indicator' ).toggleClass( 'indicator-active' );
		return false;
	} );*/
	
	$( '#dock > li' ).hover( function() {
		$( '.latest' ).fadeOut( 'fast' );
		$( this ).addClass( 'dock-active' );
		$( this ).children( 'span' ).fadeIn( 200 );
	}).bind( "mouseleave", function() {		
		$( this ).removeClass( 'dock-active' );	
		$( this ).children( 'span' ).fadeOut( 200 );
	} );
			
	$( 'li.page-item-26 a' ).hover( function() {
		//if (!(dropdown.hasClass('dropdown-active'))) {
		  dropdown.fadeIn( 500 );
		  dropdown.addClass('dropdown-active');
		//}
		
	}).bind( "mouseleave", function() {		

		dropdown.fadeOut( 200 );
	} );
	
	$( '#committee-dropdown span' ).bind( "mouseleave", function() {
		dropdown.hide();
		dropdown.removeClass('dropdown-active');
	} );
	
	$( 'li.page-item-2 a'  ).hover( function() {
		dropdown.hide();
		dropdown.removeClass('dropdown-active');
	} );
	
		
	$( 'li.page-item-5 a'  ).hover( function() {
		dropdown.hide();
		dropdown.removeClass('dropdown-active');
	} );
	
	$( '#header'  ).hover( function() {
		dropdown.hide();
		dropdown.removeClass('dropdown-active');
	} );
	
			
	$( '#dock' ).bind( "mouseleave", function() {
		$( '.latest' ).fadeIn( 1000 );
	} );
	
	$('input.subscribe').click(function()
	{
	  
		var message = $('p#message');
		var name = $('#name').val();
		var pennkey = $('#pennkey').val();
		
		var artgallery = false;
		var concerts = false;
		var connaissance = false;
		var film = false;
		var jazz = false;
		var specialevents = false;
		var springfling = false;
		var spectrum = false;
		var sound= false;
		
		if($('#artgallery').attr('checked')) {
		  artgallery = true;
		}
	 if($('#concerts').attr('checked')) {
		  concerts = true;
		}
		if($('#connaissance').attr('checked')) {
		  connaissance = true;
		}
		if($('#filmsociety').attr('checked')) {
		  film = true;
		}
		if($('#jazzandgrooves').attr('checked')) {
		  jazz = true;
		}
		if($('#specialevents').attr('checked')) {
		  specialevents = true;
		}
		if($('#springfling').attr('checked')) {
		  springfling = true;
		}
		if($('#spectrum').attr('checked')) {
		  spectrum = true;
		}
		if($('#sound').attr('checked')) {
		  sound = true;
		}



		if (name =='' || pennkey =='') {
			message.text('One or more of the fields was left blank - please try again.');
			return false;
		}
		$.post("http://specevents.net/includes/mailer.php", { name: name, 
															  pennkey: pennkey,
															  artgallery: artgallery,
															  concerts: concerts,
															  connaissance: connaissance,
															  film: film,
															  jazz: jazz,
															  specialevents: specialevents,
															  springfling: springfling,
															  spectrum: spectrum,
															  sound: sound
															  } );
		$('#name').val('');
		$('#pennkey').val('');

		message.text('Thanks!  You have been successfully subscribed.');
		return false;

	});

	
	
	
} );