jQuery(document).ready(function($) {
	
	$('#qsearch').focus(function() {
		if ('Type and hit enter...' == $(this).val()) {
			$(this).val('');
		}
	});
	
	$('#qsearch').blur(function() {
		if ('' == $(this).val()) {
			$(this).val('Type and hit enter...');
		}
	});
	
	$('#quick-search').submit(function() {
		if ('Type and hit enter...' == $('#qsearch').val()) {
			$('#qsearch').val('').focus();
			return false;
		}
	});
	
	var validator = $('#quick-search').validate({
		rules: {
			qsearch: 'required'
		},
		messages: {
			qsearch: 'Please enter a search query'
		},
		errorLabelContainer: '#quick-search-error',
		errorElement: 'p',
		submitHandler: function(form) {
			window.location.href = $(form).attr('action') + '?s=' + $('#qsearch').val();
		}
	});
	
});