$(window).ready(function() {
	$('#submit_button_link').click(function() {
		$('#message_voting').hide();
		$('a.anchor_link').html('');
		$('#rating').hide();
/*
		$('#txt').html('<textarea id="your_message" onfocus="focus_message()" onblur="blur_message()">Your message</textarea>');
		$('#submit_name').html('<input type="text" id="your_name" value="Anonymous" onfocus="focus_name()" onblur="blur_name()" />');
*/

		$('#txt').html('we have come to the end of a long journey; submissions are closed.');
/* 		$('#submit_name').html('<input type="text" id="your_name" value="Anonymous" onfocus="focus_name()" onblur="blur_name()" />'); */

/* 		$('#send_button_link').show(); */
		$('#submit_name').html('Nerduo');

		$('#submit_button_link').hide();
		$('#send_button_link').hide();
		return false;
	});
		
	$('.hover_button').hover(function() { 
		$(this).find('img').get(0).src = $(this).find('img').get(0).src.replace(/.gif/g, '_o.gif');		
	;}, function() {
		$(this).find('img').get(0).src = $(this).find('img').get(0).src.replace(/_o.gif/g, '.gif');		
	})
		
	$('#send_button_link').click(function() {	
		$.post("/submit.php", { name: $('#your_name').val(), txt: $('#your_message').val() }, function() {
			var h = $('#txt').height();

/*
			$('#txt').html('We are having difficulties, please resubmit in an hour or so.<br/>');

*/			
			$('#txt').html('you submitted<br/>your message.<br/>')
			

			$('#credit').html('Your country thanks you.');
			$('#send_button_link').hide();		
			$('#thank_you_button_link').show();		
		} );
		return false;
	})

});

function focus_message() {
	if ($('#your_message').val() == 'Your message') {
		$('#your_message').val('');
	}
}

function blur_message() {
	if ($('#your_message').val() == '') {
		$('#your_message').val('Your message');
	}
}

function focus_name() {
	if ($('#your_name').val() == 'Anonymous') {
		$('#your_name').val('');
	}
}

function blur_name() {
	if ($('#your_name').val() == '') {
		$('#your_name').val('Anonymous');
	}
}