$(document).ready( function(){

	$( 'form#search input[@name=SearchText]').focus(
		function() {
			$( this ).val( '' );
		}
	);
	$( '.eventDates span' ).parent().find( 'div' ).hide();
	$( '.eventDates span' ).click(
		function() {
			$( 'li.eventDates div' ).hide( );
			$( 'li.eventDates span a' ).show( );
			$( this ).parent().find( 'div' ).show( );
			$( this ).find( 'a' ).hide( );
		}
	);
	$( '.eventEntry .eventDetail' ).hide();
	$( '.eventEntry h2' ).click(
		function() {
			$( '.eventEntry .eventDetail' ).hide( );
			$( '.eventEntry h2 a' ).show( );
			$( this ).parent().find( '.eventDetail' ).show( );
			$( this ).find( 'a' ).hide( );
		}
	);

	$( '.eventDetail' ).show( );

	$( 'select#Filter' ).change(
		function() {
			$( 'select#Filter' ).each(
				function(){
					key = $("select#Filter option:selected").val();
					if( key == '0') {
						$( '.eventEntry' ).hide( );
						$( 'li.eventDates span a' ).show( );
						$( 'li.eventDates div' ).hide( );
						$( '.eventEntry h2 a' ).show( );
						$( '.eventEntry' ).show();
					} else {
						$( '.eventEntry' ).hide( );
						$( 'li.eventDates span a' ).show( );
						$( 'li.eventDates div' ).hide( );
						$( '.eventEntry h2 a' ).show( );
						$( '.'+key ).show();
					}

				}
			);
		}
	);

	$( '#Navi .Sub' ).mouseover(
		function(){
			$( this ).parent().find( 'a span' ).addClass( 'bghigh' );
		}
	);
	$( '#Navi .Sub' ).mouseout(
		function() {
			$( this ).parent().find( 'a span' ).removeClass( 'bghigh' );
		}
	);
	if( $.browser.safari ) {
		$( '#ContainerShadow' ).mousemove(
			function() {
				$( '#Navi .Sub:hidden' ).parent().find( 'a span' ).removeClass( 'bghigh' );
			}
		);
	}


});


function mergeCheckboxes() {
	$( 'input#collect' )[0].value = '';
	$('.CheckboxLong[@checked]').each( function() {
		var tempValue = $( 'input#collect' )[0].value;
		$( 'input#collect' )[0].value = ( tempValue == '' ) ? $( this )[0].name : tempValue + '|||' + $( this )[0].name;
	} );
}
function explodeCheckboxes() {
	$.each( $( 'input#collect' )[0].value.split('|||'), function( i, n ){
		$( '.CheckboxLong[@name='+n+']' ).each( function(){
			this.checked = true;
		} );
	});
}
function noLink(){
	return false;
}



