$( function() {
	// Handle mouse events for any button
	$( "input[type=image][src$=-button.gif]" ).each( function() {
		var src = $( this ).attr( "src" );
		var dot = src.lastIndexOf( "." );
		var button_over = new Image();
		var before_dot = src.substr( 0, dot );
		var after_dot = src.substr( dot );
		button_over.src = before_dot + "-over" + after_dot;
		var button_down = new Image();
		button_down.src = before_dot + "-down" + after_dot;
		$( this )
		.mouseover( function() { this.src = button_over.src; } )
		.mousedown( function() { this.src = button_down.src; } )
		.mouseup( function() { this.src = button_over.src; } )
		.mouseout( function() { this.src = src; } );
		$( "form" )
		.submit( function() { $( "input[type=image][src$=-button.gif]", this ).mousedown(); } );
	} );
	
	// Display message if defined
	$( "#message" ).toggle( "slide", { easing: "easeOutQuint", direction: "down" }, 1000 );
	setTimeout( function() { $( "#message" ).toggle( "slide", { easing: "easeOutQuint", direction: "down" }, 1000 ); }, 6000 );
} );