$(function() {

	// Autocomplete
	$("input#search").autocomplete("/index.php/autocomplete/_autocompleter/", {
		cacheLength: 0,
		minChars: 1,
		formatItem: function(row) {
			return row[0]
		},
		formatResult: function(row) {
			$("input#search").css({
				background: ""
			})
			return row[1]
		}
	}).result(function(event, item) {
		//redirect to the URL in the string
		
		window.location.href = item.attr("href");
	});

	
	$("input#search").keyup(function(){
		
		if($(this).val().length > 0){
			$(this).css({
				background: "URL(/images/layout_images/indicator.gif) right 1px no-repeat"
			})
		}
		else{
			$(this).css({
				background: ""
			})
		}

	})
	
	$('#np_found').click(function(){
		$("input#search").val("").focus()
		
		return false;
		
	})
	
	$(".search_box").click(function(){
		if($(this).val() == "Enter Keyword(s)"){
			$(this).val("")
		}
	});
	$(".search_box").blur(function(){
		if($(this).val() == ""){
			$(this).val("Enter Keyword(s)")
		}
	});
	


})
