jQuery(document).ready(function() {
  /* ********************************************************************** */
  /* search field                                                           */
  /* ********************************************************************** */
  /* When end user puts their cursor in to the search field the default 
   * suggested value disappers. However, if the value had previously
   * been modified (i.e., end user started to type something in to the 
   * field) then it is left unchanged. */
   jQuery("#search-field").focus(function(){
        var currentValue=jQuery(this).attr("value");
        if (currentValue=="Search"){
          jQuery(this).attr("value","");
        }else{
          jQuery(this).attr("value",currentValue);
        }
    });// end search-field focus test
    /* If the end user 'clicks out' of the search field and hasn't typed
     * any new content then the orginal default suggested value is added
     * back in, otherwise the new value is left alone. */
    jQuery("#search-field").blur(function(){
      var currentValue=jQuery(this).attr("value");
        if(currentValue=="") {
            jQuery(this).val("Search");
        }
    });// end search-field blur test
    /* ********************************************************************** */
    /* Remove annoying anchor underline from images                           */
    /* ********************************************************************** */
    /* remove underline from images within anchors or within spans within anchors */
    jQuery("a > img").addClass("noborder");
        jQuery("a > img").parent().addClass("noborder");
    jQuery("a > span > img").addClass("noborder");
        jQuery("a > span > img").parent().addClass("noborder");
        jQuery("a > span > img").parent().parent().addClass("noborder");
    /* /remove underline */
    /* ********************************************************************** */
    /* function to add the class 'last-child' to every element within a div   */
    /* careful - it uses a lot of resources                                   */
    /* ********************************************************************** */
    /*
    jQuery('div').each(function(){
        jQuery(this).children(':last').addClass('last-child');
    });
    */
    /* more aggresive function to add the class last-child to every last child element */
    /*
    jQuery.fn.addLastChildClass = function() {
        return this.each(function() {
            jQuery(this).children()
                .addLastChildClass()
                .filter(':last').addClass('last-child');
        });
    };
    jQuery('body').addLastChildClass();
    */
});// end document ready function
