﻿$(function() {
    var m = $("#main");
    var s = $("#sidebar");
    if (m.outerHeight(true) < s.outerHeight(true)) {
        m.height(s.outerHeight(true));
    }
    else {
        s.height(m.outerHeight(true));
    }
    search(".navcontainer > ul > li > a[href]", "#hd");
    $("a.sc-link[href^='http']").click(function() {
        window.open($(this).attr("href"));
        return false;
    });
});

function search(pattern, context) {
    $(pattern, context).each(function() {
        if (new RegExp($(this).attr("href")).test(location.pathname)) {
            search(pattern, $(this).parent().addClass("current"));
            return false;
        }
    });
}
