jQuery(function($){
  //#__________________________________________________________________________\
  //# AUTOCOMPLETE SEARCH
  //#__________________________________________________________________________\
  // Safely inject CSS3 and give the search results a shadow
  var cssObj = {  'box-shadow' : '#888 1px 1px 8px', // Added when CSS3 is standard
                  '-webkit-box-shadow' : '#888 1px 1px 8px', // Safari
                  '-moz-box-shadow' : '#888 1px 1px 8px'}; // Firefox 3.5+
  $("#ac_suggestions").css(cssObj);

  // Fade out the suggestions box when not active
  $("#ac_search").blur(function(){
    $('#ac_suggestions').fadeOut();
  });


  //#__________________________________________________________________________\  
});
function ac_lookup(inputString) {
  if(inputString.length == 0) 
  {
    jQuery('#ac_suggestions').fadeOut(); // Hide the suggestions box
  } 
  else if(inputString.length >= 3)
  {
    jQuery('#ac_search_loader').css('display', 'block');
    jQuery.ajax({
      type:     "POST",
      url:      "/main/searchSuggestions",
      data:     {q: inputString}, 
      dataType: "html",
      success:  function(msg) { // Do an AJAX call
        jQuery('#ac_suggestions').fadeIn(); // Show the suggestions box
        jQuery('#ac_suggestions').html(msg); // Fill the suggestions box
        jQuery('#ac_search_loader').css('display', 'none');
      }
    });
  }
}