﻿/// <reference path="jquery-1.3.2.js"

function ReadyPageNav() {
    // Close all navigation subnav items (left open if javascript is not active)
    // $('#navigation li ul').hide();

    // If navIsHome hidden input is present, stop
    // if ($('#navigation input').size() > 0) return;

    var page;
    
    // If the hidden input jsNavOpen is present, open the specified subnav
    var value = $('#jsNavOpen').val();
    if (value != null && value != "") {
        page = value;
    }
    else {
        page = document.URL.split("/").reverse()[0]; // If unspecified, use the current page

        // Strip out any query strings
        page = page.split("?")[0];

        // Strip out any anchor tags
        page = page.split("#")[0];
    }
    
    // Is the current page part of the main nav?
    $("#patient_navigation > ul > li.pat_subnav > a[href='" + page + "']")
        .siblings('ul').show();
    
    // Is the current page part of a subnav list?
    $("li.pat_subnav > ul > li > a[href='" + page + "']")
        .parent().parent().show();
        
}