$(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. */
  $("#search-field").focus(function() {
		var currentValue=$(this).attr("value");
		if (currentValue=="Search"){
		  $(this).attr("value","");
		}else{
		  $(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. */
	$("#search-field").blur(function() {
	  var currentValue=$(this).attr("value");
		if(currentValue=="") {
			$(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 */
	$("a > img").addClass("noborder");
	    $("a > img").parent().addClass("noborder");
	$("a > span > img").addClass("noborder");
	    $("a > span > img").parent().addClass("noborder");
	    $("a > span > img").parent().parent().addClass("noborder");
	/* /remove underline */
    /* ********************************************************************** */
    /* function to add the class 'last-child' to every element within a div   */
    /* careful - uses a lot of resources                                      */
    /* ********************************************************************** */
    /*
    $('div').each(function(){
        $(this).children(':last').addClass('last-child');
    });
    */
    /* more aggresive function to add the class last-child to every last child element */
    /*
    $.fn.addLastChildClass = function() {
        return this.each(function() {
            $(this).children()
                .addLastChildClass()
                .filter(':last').addClass('last-child');
        });
    };
    $('body').addLastChildClass();
    */
});// end document ready function