﻿
$(document).ready(function() {
    if (_tab != null) {
        if (_highlight_tab = $("a.Tab_Link.tabs-" + _tab)) {
            $(_highlight_tab).parent("li").addClass("ui-tabs-selected").addClass("ui-state-active");
            // $(_highlight_tab).addClass("ui-tabs-selected").addClass("ui-state-active");
        }
        $(".SideBar_Link").hide();
        $(".tab-" + _tab).show();
    }
    // $("div#Tabs_Div").tabs();


    $(".tree a.leaf").each(function() {
        var unit_id = $(this).text().replace(/[a-z]/gi, '');
        if (unit_id == $(this).text()) {
            $(this).simpletip({ content: "Please wait... <hr/> Click on the tree to view and edit amber and red times.", onShow: function() {
                pos = this.getParent().offset();
                this.setPos(pos.left, pos.top - this.getParent().scrollTop() + 15);
            }, onBeforeShow: function() {
                this.load("UnitInfo.aspx?UnitSerial=" + unit_id);
            }, showEffect: 'none', hideEffect: 'none'
            }).simpletip().load("UnitInfo.aspx?UnitSerial=" + unit_id);
        }
    });

    $(".tree").live('DOMNodeInserted', function() {
        $(".tree a.leaf").each(function() {
            var unit_id = $(this).text().replace(/[a-z]/gi, '');
            if (unit_id == $(this).text()) {
                $(this).simpletip({ content: "Please wait... <hr/> Click on the tree to view and edit amber and red times.", onShow: function() {
                    pos = this.getParent().offset();
                    this.setPos(pos.left, pos.top - this.getParent().scrollTop() + 15);
                }, onBeforeShow: function() {
                    this.load("UnitInfo.aspx?UnitSerial=" + unit_id);
                }, showEffect: 'none', hideEffect: 'none'
                });
            }
        });
    });
});
