﻿// JScript File

function orderheader_LoadAgents(item)
{    
    orderheader_AgentsCombo.SetText("Loading...");
    orderheader_AgentsCombo.RequestItems(item.Value, false);                    
}

function orderheader_LoadLines(item)
{    
    orderheader_LinesCombo.SetText("Loading...");
    orderheader_LinesCombo.RequestItems(item.Value, false);                    
}

function headerinfo_LoadAgents(item)
{    
    headerinfo_AgentsCombo.SetText("Loading...");
    headerinfo_AgentsCombo.RequestItems(item.Value, false);                    
}

function ItemsLoaded(combo)
{
    if (combo.Items.length > 0)
    {
        combo.SetText(combo.Items[0].Text);
    }
}

function handleSetFocus(comboBox)
{
    var condition = document.getElementById("ctl00_ContentPlaceHolder1_HandleCloseCondition");
    
    if(condition != null)
    {
        condition.value = comboBox.InputID;
    }
}
function handleLostFocus(comboBox)
{
    var condition = document.getElementById("ctl00_ContentPlaceHolder1_HandleCloseCondition");
    
    if(condition != null)
    {
        if(condition.value == comboBox.InputID)
        {
            condition.value = "";
        }
    }
}
function handleClose(comboBox) 
{
    var condition = document.getElementById("ctl00_ContentPlaceHolder1_HandleCloseCondition");

    if(condition != null)
    {
        if(condition.value == comboBox.InputID)
        {
            var input = document.getElementById(comboBox.InputID); 

            try {
                input.focus(); 
            } catch(exc) {}
        }
        else if(condition.value != "")
        {
           var input = document.getElementById(condition.value); 

            try {
                input.focus(); 
            } catch(exc) {}
        }
    }
}
function handleRadError(combobBox) {
    document.location = getSiteVirtualRoot() + "/Login.aspx?ErrorAction=RAD";
    return false;   //to hide the error message
}