// site search functions - search form in page header
// outputs results in centre_content div

$(document).ready(function() {
	
	//clear the contents of the search box when a user clicks in the field
	$("#searchbox").focus(function() {
		$("#searchbox").val('');
	});
	
	
	//events when user clicks away from the search form
	$("#searchbox").blur(function() {
		st = $("#searchbox").val();
		//if no text was entered in the search form
		if(st == '')
		{
			$("#searchbox").val('shop search');
		}
	});
	
	
	//users clicks the arrow icon to the right of the search text box
	$("#goSearch").click(function() {
		searchText  = $("#searchbox").val();
		contentType = $("#content_type").val();
		
		window.location.replace("http://dev.codestorm.co.uk/ourfc2010/?page=search&content_type="+escape(contentType)+"&val="+searchText);
		//console.log(searchText);
		//console.log(contentType);
	})
});
