$(function(){
    $imgS = $("ul.adapt-thumbs li img");
    $($imgS).load(function(){
        var $this = $(this);
        $this.closest("li").width($this.width());
    });
});

var loadedMenus = function(){
    var loc = location.pathname + location.search;
    $("#main-menu, #collections-menu, #navigation").find("a").each(function(){
        var $this = $(this);
        if ($this.attr("href") == loc){
            $this.addClass("active");
        }
    });

    var $inputSearchTerms = $("input#searchterms");
    if (!("placeholder" in $inputSearchTerms[0]) || navigator.userAgent.match(/MSIE/)){
        var placeholder = $inputSearchTerms.attr("placeholder");
        $inputSearchTerms.val(placeholder);
        $inputSearchTerms.focusout(function(){
            if ($inputSearchTerms.val() == "")
                $inputSearchTerms.val(placeholder);
        });
        $inputSearchTerms.focusin(function(){
            if ($inputSearchTerms.val() == "" || $inputSearchTerms.val() == placeholder)
                $inputSearchTerms.val("");
        });
    }
}
