﻿// JScript File
function getElementReference(elementId)
{
    if ( document.getElementById )
        return document.getElementById(elementId);

    if ( document.all )
        return document.all[elementId];

    if ( document.layers )
        return document.layers[elementId];

    return null;
}

// MouseOver of the sort option    
function SortMouseOver(tdID, lblID)
{
    getElementReference(tdID).style.backgroundColor = 'white';
    getElementReference(lblID).style.fontStyle = 'italic';
}
// MouseOver of the sort option 
function SortMouseOut(tdID, lblID, hdfOldlblID)
{
    if (getElementReference(hdfOldlblID).value != lblID)
        getElementReference(lblID).style.fontStyle = 'normal';

    getElementReference(tdID).style.backgroundColor = '#F0F4F5';
}

// OnClick of the sort option
function SortClick(btnID, lblID, hdfOldlblID)
{
    var hdfOldlbl = getElementReference(hdfOldlblID);
    if(hdfOldlbl.value != lblID)
    {            
        // Hide the old sorted column option
        getElementReference(hdfOldlbl.value).style.fontStyle = 'normal';
                    
        // Remember the current column sorted
        hdfOldlbl.value = lblID;
    }
    
    getElementReference(btnID).onclick();
}

// Show the search option
function ShowSearch(pnlSortID, pnlSearchID, txtID)
{
    getElementReference(pnlSortID).style.display = 'none';
    getElementReference(pnlSearchID).style.display = 'block';
    getElementReference(txtID).focus();
}
// Hide the search option
function HideSearch(pnlSortID, pnlSearchID, txtID)
{
    getElementReference(pnlSearchID).style.display = 'none';
    getElementReference(pnlSortID).style.display = 'block';
    getElementReference(txtID).value = "";
}

// Check the length of a password, have to contain a minimum of 5 characters. 
function CheckLength(txtPwdID, lblErrorPwdID, hdkPwdLengthOKID)
{
    var txtPwd = getElementReference(txtPwdID);
    var lblErrorPwd = getElementReference(lblErrorPwdID);
    var hdkPwdLengthOK = getElementReference(hdkPwdLengthOKID);
    
    if (txtPwd.value.length < 5)
    {
        lblErrorPwd.style.display = 'block';
        hdkPwdLengthOK.value = "false";
    }
    else
    {
        lblErrorPwd.style.display = 'none';
        hdkPwdLengthOK.value = "true";
    }
}

// Move to the anchor (intrant)
function Jump(Anchor)
{
    location.href = "#" + Anchor;
}

function RowMouseOver(rowID, chkRowCheckedID) 
{  
    if(!getElementReference(chkRowCheckedID).checked)   // If the module selected is not checked
        getElementReference(rowID).style.backgroundColor = '#C7D0DE';
}

function RowMouseOut(rowID, chkRowCheckedID) 
{  
    if(!getElementReference(chkRowCheckedID).checked)   // If the module selected is not checked
        getElementReference(rowID).style.backgroundColor = 'white';
}



