﻿// JScript File for login js elements


function getHelp(strElementID)
    {
        var strPage = window.location.pathname
        
        if (strPage.length == 1)
        {
            strPage = 'default.aspx'
        }
        else
        {
            strPage = strPage.substring(1)
        }
        
        window.open('/viewHelp.aspx?Page=' + strPage + '&ElementID=' + strElementID,'HelpWindow','height=500,width=475,menubar=no,resizable=yes,status=no,toolbar=no,location=no,scrollbars=yes')
    }
    
    function getHelpTOC()
    {
        
        window.open('/viewHelpTOC.aspx','HelpWindow','height=500,width=475,menubar=no,resizable=yes,status=no,toolbar=no,location=no,scrollbars=yes')
    }

var confirmClose = false;
var refreshParent = false;

function confirm_on()
{
    confirmClose = true;
}

function confirm_off()
{
    confirmClose = false;
}

function gridEX1_SelectionStart(gridex)
{    
 return true; 
}

var checkfocus = false;

function check_focus()
{  
     if (checkfocus)
        {
             window.focus();            
        }
              
}

function CheckCombo(myCombo)
{
    var boolFound = false;
    var l = 0;
    
    while ((l < myCombo.options.length) && (!boolFound))
    {
        if (myCombo.value == myCombo.options[l].value)
        {
            boolFound = true;
        }
        l++;
    }
    
    if (boolFound == false)
    {
        myCombo.selectedIndex = 0;
    }

}

function gridEX1_DeletingRecords(column)
    {   
    
    if (typeof(ctl00_ContentPlaceHolder1_GridEX1) != "undefined")
        {
            var gridex = getGridEXFromID("ctl00_ContentPlaceHolder1_GridEX1"); 
            var row = gridex.getGridEXRow(); 
            if(row.getRowType() != "NewRecord")
            { 
                var cancel = confirm("Are you sure you want to delete this record?"); 
                if(cancel)
                {
                    gridex.DoCustomCallBack("Delete"); 
                }
                
                return false; 
                window.event.returnValue = false;
                window.event.cancelBubble = true; 
            }
            else
            {
                gridex.DoCustomCallBack("Add");
                return false;
                window.event.returnValue = false;
                window.event.cancelBubble = true; 
            }
         }
    }

function confirm_close()
{  
    try{
    if (typeof(ctl00_ContentPlaceHolder1_GridEX1) != "undefined")
        {   
            var gridex = getGridEXFromID("ctl00_ContentPlaceHolder1_GridEX1");  
           
           var row = gridex.getGridEXRow();
           var thistable = gridex.getRootTable()
                    
                    if ((thistable.getAllowEdit()) && (row != null))
                    {           
                    
                        if (row.getDataChanged())
                        {
                            gridex.DoPostBack(null, "ResumeEditing",true);
                        }  
                    }
        }}
        catch(e){
        }
   
   if (confirmClose)
        {
            event.returnValue = "This form has been edited, but not saved.";

        }  
              
}

function GridEX1_Load(gridex)
{
var div = gridex.getRootTable().getHtmlItemsTable().offsetParent; 
div.style.overflowX = "visible";
div.style.overflowY = "visible";
}

function refresh_parent()
{  
     if (refreshParent)
        {
         
            try{
            
                window.opener.GridEX1_refresh();
            }
            catch(e){
            }
            
        }
              
}