$(document).ready(function() { 

	$.tablesorter.addParser({ 
		id: 'myShortDate', 
		is: function(s) { 
			return false; // return false so this parser is not auto detected
		}, 
		format: function(s) { 
			return Date.parse(s + ", 2010");
		}, 
		type: 'numeric' 
	}); 

	$("#booklist").tablesorter({
		debug: false,
		sortList: [[2,1]],
		textExtraction: "complex",
		headers: { 0: { sorter: 'myShortDate' } }
	});
	




	// COMMENT FORM BEHAVIOURS
	var authorDefault = "Your name...";
	var emailDefault = "Your e-mail address...";
	var captchaDefault = "Please enter the text in the image above...";

	//pre-populate comment form fields
	if ( $('input#name').val() == "" ) {
		$('input#name').val(authorDefault);
	}
	if ( $('input#email').val() == "" ) {
		$('input#email').val(emailDefault);
	}
	if ( $('input#captcha').val() == "" ) {
		$('input#captcha').val(captchaDefault);
	}

	// focus/blur behaviour
	$('input#name')
		.focus(function(event) {
			if ( $(this).val() == authorDefault ) {
				$(this).val("");
			}
		})
		.blur(function(event) {
			if ( $(this).val() == "" ) {
				$(this).val(authorDefault);
			}
		});

	$('input#email')
		.focus(function(event) {
			if ( $(this).val() == emailDefault ) {
				$(this).val("");
			}
		})
		.blur(function(event) {
			if ( $(this).val() == "" ) {
				$(this).val(emailDefault);
			}
		});
		
	$('input#captcha')
		.focus(function(event) {
			if ( $(this).val() == captchaDefault ) {
				$(this).val("");
			}
		})
		.blur(function(event) {
			if ( $(this).val() == "" ) {
				$(this).val(captchaDefault);
			}
		});
	

}); // END READY
