﻿// JScript File
// Expand or collapse an element based on style attribute
function OpenSingleTable(table, img)
{
// Debug variable (set to 1 to debug)
var debug = 0;

if (debug)
    alert("table id: " + table);

if (debug)
    alert("img.id: "+ img.id);    
    
    var object = document.getElementById(table);

if (debug)
    if (object == null)
        alert("Cannot find table");    

    if (object.style.display=="")
    {
        object.style.display = "none";
        img.src = "/ATIS/App_Themes/ATIS/images/plus.gif";
    }
    else
    {
        object.style.display = "";
        img.src = "/ATIS/App_Themes/ATIS/images/minus.gif";
    }
    
    object = null;
}

// Expand an element and collapse another element based on style attribute
// Input (table1): Siginifies the details table to show or hide. If the table style is not visible, then display it and toggle the image to collapse image.
// Input (table2): Siginifies the cameras table to show or hide. If the table style is not visible, then display it and toggle the image to collapse image.
// Input (table3): Siginifies the summary table to show or hide. If the table style is not visible, then display it and toggle the image to collapse image.
// Input (img): Image object in which the image used will be toggled.
function OpenTable(table1, table2, table3, img)
{
// Debug variable (set to 1 to debug)
var debug = 0;

    // Details table
    var object = document.getElementById(table1);
    
    if (object.style.display=="")
    {
        object.style.display = "none";
        img.src = "/ATIS/App_Themes/ATIS/images/plus.gif";
    }
    else
    {
        object.style.display = "";
        img.src = "/ATIS/App_Themes/ATIS/images/minus.gif";
    }
    
    // Cameras table
    var object2 = document.getElementById(table2);

if (debug)
    alert("Cameras["+table2+"] sytle display: " + object2.style.display);
    
    if (object2.style.display=="")
    {
        object2.style.display = "none";   
    }
    else
    {
        object2.style.display = "";
    }
if (debug)
    alert("Cameras["+table2+"] sytle display: " + object2.style.display);

    // Summary table
    var object3 = document.getElementById(table3);
    
    if (object3.style.display=="")
    {
        object3.style.display = "none";
    }
    else
    {
        object3.style.display = "";
    }
    
    object = null;
    object2 = null;
    object3 = null;
}

// Expand an element and collapse another element based on style attribute
// Input (table1): Siginifies the details table to show or hide. If the table style is not visible, then display it and toggle the image to collapse image.
// Input (table2): Siginifies the cameras table to show or hide. If the table style is not visible, then display it and toggle the image to collapse image.
// Input (table3): Siginifies the summary table to show or hide. If the table style is not visible, then display it and toggle the image to collapse image.
// Input (img): Name of the Image object in which the image used will be toggled.
function OpenTable1(table1, table2, table3, imgName)
{
    var img1 = document.getElementById(imgName);
    
    OpenTable(table1, table2, table3, img1);
    img1 = null;
}



// JScript File
// Show the element if previously hidden, and vice versa.
function ShowElementId(elementId)
{    
    var object = document.getElementById(elementId);

    if (object == null)
        alert("Cannot find element to change display");    

    if (object.style.display=="")
    {
        object.style.display = "none";
    }
    else
    {
        object.style.display = "";
    }
    object = null;
}