﻿function show_help_window(hid) {
    //Show new window
    //not providing a name as a second parameter will create a new window
    var oWindow = window.radopen ('HelpWind.aspx?HID=' + hid, null);

    //Using the reference to the window its clientside methods can be called
    oWindow.SetSize (460, 450);
    oWindow.SetTitle ('Aviation Skills Matrix Help');
}

function show_more_info_window(title, orgID, isCUO) {
    //Show new window
    //not providing a name as a second parameter will create a new window
    var oWindow = window.radopen ("IPR_OrgMoreInfo.aspx?OID=" + orgID + "&IsUO=" + isCUO, null);

    //Using the reference to the window its clientside methods can be called
    oWindow.SetSize (460, 450);
    oWindow.SetTitle (title);
}

function show_window(title, url) {
    var oWindow = window.radopen(url, null);
    
    oWindow.SetSize(460, 450);
    oWindow.SetTitle(title);
}

function show_window_size(title, url, height, width) {
    var oWindow = window.radopen(url, null);
    
    oWindow.SetSize(height, width);
    oWindow.SetTitle(title);
    oWindow.center()
 }   


function show_chart(chart_criteria_id) {
    var oWindow = window.radopen("CHT_chart_builder_result.aspx?chart_criteria_id=" + chart_criteria_id, null);
    
    oWindow.SetSize(800, 600);
    oWindow.SetTitle("Chart Builder Results");
}

function confirmSubmit(p)
{
    var agree=confirm(p);
    if (agree)
        return true ;
    else
        return false; 
}

function openWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function UpdateAllChildren(nodes, checked) {
    var i;
    for (i = 0; i < nodes.length; i++) {
        if (checked)
            nodes[i].Check();
        else
            nodes[i].UnCheck();
        UpdateAllChildren(nodes[i].Nodes, nodes[i].Checked);
    }
}

function UpdateAllParents(node) {
    if (node != null) {
        var siblingCollection = node.Nodes;
        var allChecked = true;
        var i
        
        for (i = 0; i < siblingCollection.length; i++) {
            if (!siblingCollection[i].Checked) {
                allChecked = false;
                break;
            }
        }
        
        if (allChecked) {
            nodeCheck();
        } else {
            node.UnCheck();
        }
        
        UpdateAllParents(node.Parent)
    }
}

function AfterCheck(node) {
    UpdateAllChildren(node.Nodes, node.Checked);
    UpdateAllParents(node.Parent);
}