﻿// JScript File

// Check IE Checking
IsIE=false;
if(navigator.appName == "Microsoft Internet Explorer")
    IsIE=true;
ToggleData=false;

TimeOutHandle=null;
DoColumnFlipping =true;

// used to start the togling process of hiding and showing the columns in the table.
function SwapColumns(TableName)
{
    // stop any currenlty running timers
    clearTimeout(TimeOutHandle);
    if (DoColumnFlipping==false)
        return;
    
    SwapColumnsByNumber(TableName, 1);
    SwapColumnsByNumber(TableName, 4);
    // now reverse the state of the other columns
    ToggleData = !ToggleData;
    SwapColumnsByNumber(TableName, 2);
    SwapColumnsByNumber(TableName, 3);

    TimeOutHandle = setTimeout("SwapColumns('"+TableName+"')", 4000);
}

// TableName is the name (id) of the table you want the play with
// FlipCol is a zero based index of the column to change state of
function SwapColumnsByNumber(TableName, FlipCol)
{
    LBData = document.getElementById(TableName);
    for (i=0; i<LBData.rows.length; i++)
    {
        if(IsIE)
            LBData.rows[i].cells[FlipCol].style.display =(ToggleData?"block":"none") ;
        else
            LBData.rows[i].cells[FlipCol].style.display =(ToggleData?"table-cell":"none") ;
    }
}

// Client side dumping of the data from the table. 
// Faster than asking the server to do it. 
function EmptyDateTable(TableName)
{
    // stop any currently running timers fliping the columns. 
    clearTimeout(TimeOutHandle);

    LBData = document.getElementById(TableName);
        
    for (i=1; i<LBData.rows.length; i++)
    {
        //if (LBData.rows[i].children[1].innerHTML == "&nbsp;")
            //return;
            
        for (j=0;j<LBData.rows[i].children.length;j++)
        {
            LBData.rows[i].children[j].innerHTML ="&nbsp;"
        }
    }

    
}

LastLinkClicked = null;
function ClickLink(elm)
{
    if (LastLinkClicked != null)
    {
        LastLinkClicked.className="TT_H2";
    }
    elm.className="TT_H2_CLICK";
    LastLinkClicked = elm;
    
    ShowPager(true);
    // start the column swaping
    SwapColumns("LBDataView");


}
function ShowPager(ShowPager)
{
    NoPager = document.getElementById("CellNoPager");
    YesPager = document.getElementById("TablePager");
   

    if(IsIE)
    {
        NoPager.style.display =(ShowPager?"none":"block") ;
        YesPager.style.display =(ShowPager?"block":"none") ;
    }
    else
    {
        NoPager.style.display =(ShowPager?"none":"table-cell") ;
        YesPager.style.display =(ShowPager?"table-cell":"none") ;
    }
}