// keyword JavaScript Document

jQuery(function() {
		   
  function findValue(li) {
  	//if( li == null ) return alert("No match!");

  	// if coming from an AJAX call, let's use the CityId as the value
  	if( !!li.extra ) var sValue = li.extra[0];

  	// otherwise, let's just display the value in the text box
  	else var sValue = li.selectValue;

  	//alert("The value you selected was: " + sValue);
  }

  function selectItem(li) {
    	findValue(li);
  }

  function formatItem(row) {
    	return row[0]/* + " . " + row[1] + " . "*/;
  }

  function lookupAjax(){
  	var oSuggest = jQuery("#keyword")[0].autocompleter;
    oSuggest.findValue();
  	return false;
  }

  function lookupLocal(){
    	var oSuggest = jQuery("#keyword")[0].autocompleter;

    	oSuggest.findValue();

    	return false;
  }
  
  
    jQuery("#keyword").autocomplete(
      "/export/autocomplete.php",
      {
  			width: 345,
			/*scrollHeight: 445,*/
			delay:100,
  			minChars:2,
  			matchSubset:true,
  			matchContains:1,
  			cacheLength:10,
  			onItemSelect:selectItem,
  			onFindValue:findValue,
  			formatItem: formatItem,
			/*function(data, i, n, value){
             return "<img src='" + value + "' height='15' /> " + value.split(".")[0];
            },
			formatResult: function(data, value) {
             return value.split(".")[0];
			},*/
  			autoFill:false,
			selectFirst:false
  		}
    );
    
	 var JJ = jQuery("h1 .logo");
	 //JJ.fadeTo(0,0.8);
	 JJ.mouseover(function(){
	  jQuery(this).fadeTo(200,1).animate({
	   'paddingLeft':'20px',
	   'color':'#B7291A',
	   'textShadow':'1px 1px 1px #333333'
	  },800).animate({
	   'paddingLeft':'0px',
	   'color':'#333333',
	   'textShadow':'0px 0px 0px',
	  },400);
	 });

});
