﻿
$(document).ready(function() {
    // Watermarking my search box
    var $wm = "Search . . .";
    $(".SearchText").focus(function() {
        if ($(this).val() == $wm) {
            $(this).val("");
            $(this).removeClass("watermark")
        };
    }).blur(function() {
        if ($(this).val() == "") {
            $(this).val($wm);
            $(this).addClass("watermark");
        };
    });

    $(".SearchText").blur();

    $(".SearchButton").click(function() {
        if ($(".SearchText").val()==$wm)
            $(".SearchText").val("");
    });

    // Remove link references to itself AND change appearance as the selected menu item.
    $("*").find("a[href='" + GetThisPage() + "']").each(function() {
        $(this).wrapInner("<span class='current' />");
        $("a span.current").addClass($(this).attr("class"));
        $("a span.current").unwrap();
    })


});


function GetThisPage() {
    var $path = window.location.pathname;
    if ($path[0] == '/')
        $path = $path.substring(1);
        
    return $path;
};

