$(document).ready(function() {  												 
													 
  /*on focus for input boxes*/
	$.fn.search = function() {
		return this.focus(function() {if( this.value == this.defaultValue ) {this.value = "";}})
		.blur(function() {if( !this.value.length ) {this.value = this.defaultValue;}});};

		//on the click of the search input, clear string
		if($("input.searchkey").val() == "enter keywords...")
		{
			$("input.searchkey").search();
		}


	/* on the search form submit */
	$("form#SearchProduct").submit(function(){
		//if the user submits search our products, clear string
		if($("input.searchkey").val() == "enter keywords...")
		{
			$("input.searchkey").val("");
		}

		//get the length of the string
		var searchLength = $("input.searchkey").val().length;

		//if the search string is less than 3 characters alert the user
		if(searchLength >= 0 && searchLength < 3)
		{
			alert("You must place at least three characters");
			$("input.searchkey").focus();
			return false;
		}
	});
});


