//$(document).ready(function() {
//});

jQuery(document).ready(function($) {

	/*===== SEARCH BOXES =====*/ 
	var searchBoxes = $('.search-text');  
	var searchBoxDefault = 'Search the site...';  
   
    searchBoxes.focus(function() {
        if ($(this).attr('value') == searchBoxDefault) {
            $(this).attr('value', '');
        }
    });
    searchBoxes.blur(function() {
        if ($(this).attr('value') == '') {
            $(this).attr('value', searchBoxDefault);
        }
    });
	
	/*===== DROP MENUS =====*/
    //$('#nav li').sfHover();
    //$('#nav li a').sfFocus();
    //$('#nav li a').sfActive();
    //$('#nav li a').sfTarget();

	$('ul.sf-menu').superfish({ 
		delay:       250,                            	// one second delay on mouseout 
		animation:   {height:'show'},  	// fade-in and slide-down animation 
		speed:       'normal',                          	// faster animation speed 
		dropShadows: false                            	// disable drop shadows 
	}); 
		
});

/*===== JQUERY SON OF SUCKERFISH =====*/
/*	From Perciformes (http://plugins.jquery.com/project/perciformes) */
jQuery.fn.sfHover = function() {
  jQuery(this).hover(
    function() { jQuery(this).addClass("sfHover"); },
    function() { jQuery(this).removeClass("sfHover"); }
  )
  return this
}

jQuery.fn.sfFocus = function() {
  jQuery(this).each(function(i) {
    jQuery(this).bind("focus", function() { jQuery(this).addClass('sfFocus');});
    jQuery(this).bind("blur", function() { jQuery(this).removeClass('sfFocus'); });
  });
  return this;
}

jQuery.fn.sfActive = function() {
    jQuery(this).each(function(i) {
      jQuery(this).mousedown (
        function() { jQuery(this).addClass('sfActive');}
      )
      jQuery(this).mouseup (
        function() { $(this).removeClass('sfActive');  }
      )
    });
    return this;
}

jQuery.fn.sfTarget = function() {
    jQuery(this).each(function(i) {
      jQuery(this).click(
        function() {
          jQuery(".sfTarget").removeClass('sfTarget');
          elem = jQuery(this).attr("href");
          if(elem) {
            jQuery(elem).addClass('sfTarget');
          }
          return this
        }
      )
    });
    return this;
}