$(document).ready(function() {
  /* Setup a global hovers */
  $(".hover-fade").hover(
    function() {
      var target=$(this).children().not(".over");
      var width=target.width();
      var height=target.height();
      $(this).css("float","left")
             .css({width:width,height:height})
             .css("background-image","url("+target.attr("src")+")");
      target.hide();
      
      $(".over",this).fadeIn();
    },
    function () {
      $(this).children().not(".over").show();
      $(".over",this).hide();
    }
  );
  
  $(".hover").hover(
    function() {
      $(this).children().not(".over").hide();
      $(".over",this).show();
    },
    function () {
      $(this).children().not(".over").show();
      $(".over",this).hide();
    }
  );
  
  /* Hide via javascript (as opposed to CSS) */
  $(".hidden-js").hide();
});

function trim(str) {
 return str.replace(/^\s+|\s+$/g,'');
}