function OnSelect(idSender, iIndex, strValue)
{
    var oParentElm = GEBI("tdMasterListParams");

    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paReloadMasterlistParams&SelectedItem=" + encodeURIComponent ( strValue ), "RELOAD_MASTERLIST_PARAMS", oParentElm);
}
//-----------------------------------------------------------------
function SwitchPurchasedStatus(idParentElm, iCurrentStatus)
{
    var oParentElm = GEBI(idParentElm);

    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paSwitchPurchasedStatus&CurrentStatus=" + encodeURIComponent ( iCurrentStatus ) + "&TargetDOMElm=" + encodeURIComponent ( idParentElm ), "SWITCH_PURCHASED_STATUS", oParentElm);
}
//-----------------------------------------------------------------
function AddToOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    iAddToShoppingListID = iItemID;
    db_out();
}
//-----------------------------------------------------------------
function RenameEntityOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    switch ( iItemID )
    {
        // Rename Category   
        case "0":
            {
                SubmitForm('fMasterList', 'bnRenameCategoryDialog');
            }
            break;

        // Rename Brand 
        case "1":
            {
                SubmitForm('fMasterList', 'bnRenameBrandDialog');
            }
            break;
    }
}
//-----------------------------------------------------------------
function OnStoreSelect(oSender, iTDId, iItemIndex, strName, iItemID)
{
    var oStoresArray = GetFormFieldByPartName("fModalAddingForm", "faStoresList");
    
    try
    {
        var iStoresCount = 0;

        if ( oStoresArray )
        {
            var oParent = GEBI("TD_STORES_LIST");
            
            if ( oParent )
            {
                var oCheckBoxes = oParent.getElementsByTagName("INPUT");
                
                for ( i = 0; i < oCheckBoxes.length; i++ )
                {
                    var oElm = oCheckBoxes[i];
                    
                    if ( oElm )
                    {
                        if ( oElm.type.indexOf ( "checkbox" ) != -1 )
                        {
                            if ( oElm.checked )
                            {
                                iStoresCount++;
                            }
                        }
                    }  
                }
            }

            oStoresArray.value = "Item in " + iStoresCount + " store(s)";
        }
    }
    catch ( e )
    {
    }
}
//-----------------------------------------------------------------
function JumpToOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    if (iItemID < 0)
    {
        switch ( iItemID )
        {
            // create lists   
            case "-1":
                {
                    SubmitForm('fCurrentList', 'bnCreateShoppingListsDialog');
                }
                break;

            // manage lists   
            case "-2":
            {
                SubmitForm('fCurrentList', 'bnManageShoppingListsDialog');
            }
            break;
        }
    }
    else
    { 
        ReloadCurrentList(iItemID);
    }
}
//-----------------------------------------------------------------
function JumpToRecipeOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    ReloadRecipe(iItemID);
}
//-----------------------------------------------------------------
function ApplyMasterListOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    iAlterMasterListID = iItemID;
}
//-----------------------------------------------------------------
function ImportDelimiterOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    if (strName != "Other")
    {
        strImportListDelimiter = strName.substring(strName.indexOf("{") + 1, strName.indexOf("}"));
    }
}
//-----------------------------------------------------------------
function ApplyPrintOption(iTDId, iItemIndex, strName, iItemID)
{
    iPrintOption = iItemID;
    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paApplyPrintOptions&PrintOption=" + encodeURIComponent ( iPrintOption ), "APPLY_PRINT_OPTIONS", window);
}
//-----------------------------------------------------------------
function ExportOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    iExportList = iItemID;
}
//-----------------------------------------------------------------
function ImportOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    iImportToList = iItemID;

    var oTD = GEBI("tdImportListNewItem");

    if (oTD)
    {
        var oInputsCol = oTD.getElementsByTagName("INPUT");

        if (oInputsCol)
        {
            var oInput = oInputsCol[0];

            if (oInput)
            {
                if (oInput.id.indexOf("faImportToLists") != -1)
                {
                    oInput.className = "Watermark";
                    oInput.value = "Enter list name";
                }
            }
        }
    }

}
//-----------------------------------------------------------------
function ImportNewListOnKeyDown( oSender )
{
    var oTD = GEBI("tdImportList");

    if (oTD)
    {
        var oInputsCol = oTD.getElementsByTagName("INPUT");

        if (oInputsCol)
        {
            var oInput = oInputsCol[0];

            if (oInput)
            {
                if (oInput.id.indexOf("faImportLists") != -1)
                {
                    oInput.className = "forminputCurrentListsWatermarkImport";
                    oInput.value = "Select shopping list";
                }
            }
        }
    }

    iImportToList = -1;
}
//-----------------------------------------------------------------
function ImportDataTypeOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    iImportDataType = iItemID;

    switch (iItemID)
    {
        // csv 
        case "0":
            {
                var oTD = GEBI("tdImportedTypeParams");

                if (oTD)
                {
                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paLoadImportParams&ImportedDataType=CSV", "LOAD_PARAMS", oTD);
                }

                var otrImportListNewItem = GEBI("trImportListNewItem");

                if (otrImportListNewItem)
                {
                    otrImportListNewItem.className = "trDisplayBlock";
                }

                var otrImportList = GEBI("trImportList");

                if (otrImportList)
                {
                    otrImportList.className = "trDisplayBlock";
                }

                var otrSourceFile = GEBI("trSourceFile");

                if (otrSourceFile)
                {
                    otrSourceFile.className = "trDisplayBlock";
                }

                var otrImportSourceFile = GEBI("trImportSourceFile");

                if (otrImportSourceFile)
                {
                    otrImportSourceFile.className = "trDisplayBlock";
                }

                var obnStartImport = GEBI("bnImportToList");

                if (obnStartImport)
                {
                    obnStartImport.style.display = "block";
                }
            }
            break;

        // groceryiq 
        case "2":
            {
                var oTD = GEBI("tdImportedTypeParams");

                if (oTD)
                {
                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paLoadImportParams&ImportedDataType=GroceryIQ", "LOAD_PARAMS", oTD);

                }

                var otrImportListNewItem = GEBI("trImportListNewItem");

                if (otrImportListNewItem)
                {
                    otrImportListNewItem.className = "trDisplayNone";
                }

                var otrImportList = GEBI("trImportList");

                if (otrImportList)
                {
                    otrImportList.className = "trDisplayNone";
                }

                var otrSourceFile = GEBI("trSourceFile");

                if (otrSourceFile)
                {
                    otrSourceFile.className = "trDisplayNone";
                }

                var otrImportSourceFile = GEBI("trImportSourceFile");

                if (otrImportSourceFile)
                {
                    otrImportSourceFile.className = "trDisplayNone";
                }

                var obnStartImport = GEBI("bnImportToList");

                if (obnStartImport)
                {
                    obnStartImport.style.display = "none";
                }

            }
            break;

        // Groceries   
        case "3":
            {
                var oTD = GEBI("tdImportedTypeParams");

                if (oTD)
                {
                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paLoadImportParams&ImportedDataType=Groceries", "LOAD_PARAMS", oTD);

                }

                var otrImportListNewItem = GEBI("trImportListNewItem");

                if (otrImportListNewItem)
                {
                    otrImportListNewItem.className = "trDisplayNone";
                }

                var otrImportList = GEBI("trImportList");

                if (otrImportList)
                {
                    otrImportList.className = "trDisplayNone";
                }

                var otrSourceFile = GEBI("trSourceFile");

                if (otrSourceFile)
                {
                    otrSourceFile.className = "trDisplayNone";
                }

                var otrImportSourceFile = GEBI("trImportSourceFile");

                if (otrImportSourceFile)
                {
                    otrImportSourceFile.className = "trDisplayNone";
                }

                var obnStartImport = GEBI("bnImportToList");

                if (obnStartImport)
                {
                    obnStartImport.style.display = "none";
                }

            }
            break;

        // Shopper    
        case "4":
            {
                var oTD = GEBI("tdImportedTypeParams");

                if (oTD)
                {
                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paLoadImportParams&ImportedDataType=Shopper", "LOAD_PARAMS", oTD);

                }

                var otrImportListNewItem = GEBI("trImportListNewItem");

                if (otrImportListNewItem)
                {
                    otrImportListNewItem.className = "trDisplayNone";
                }

                var otrImportList = GEBI("trImportList");

                if (otrImportList)
                {
                    otrImportList.className = "trDisplayNone";
                }

                var otrSourceFile = GEBI("trSourceFile");

                if (otrSourceFile)
                {
                    otrSourceFile.className = "trDisplayNone";
                }

                var otrImportSourceFile = GEBI("trImportSourceFile");

                if (otrImportSourceFile)
                {
                    otrImportSourceFile.className = "trDisplayNone";
                }

                var obnStartImport = GEBI("bnImportToList");

                if (obnStartImport)
                {
                    obnStartImport.style.display = "none";
                }

            }
            break;

        default:
            {
                var oTD = GEBI("tdImportedTypeParams");

                if (oTD)
                {
                    oTD.innerHTML = "";
                }

                var otrImportListNewItem = GEBI("trImportListNewItem");

                if (otrImportListNewItem)
                {
                    otrImportListNewItem.className = "trDisplayBlock";
                }

                var otrImportList = GEBI("trImportList");

                if (otrImportList)
                {
                    otrImportList.className = "trDisplayBlock";
                }

                var otrSourceFile = GEBI("trSourceFile");

                if (otrSourceFile)
                {
                    otrSourceFile.className = "trDisplayBlock";
                }

                var otrImportSourceFile = GEBI("trImportSourceFile");

                if (otrImportSourceFile)
                {
                    otrImportSourceFile.className = "trDisplayBlock";
                }

                var obnStartImport = GEBI("bnImportToList");

                if (obnStartImport)
                {
                    obnStartImport.style.display = "block";
                }

                strImportListDelimiter = "";
            }
            break;
    }
}
//-----------------------------------------------------------------
function ImportRecipesDataTypeOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    iImportDataType = iItemID;

    switch (iItemID)
    {
        // handycookbook  
        case "0":
            {
                var oTD = GEBI("tdImportedTypeParams");

                if (oTD)
                {
                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paLoadImportParams&ImportedDataType=HandyCookBook", "LOAD_PARAMS", oTD);
                }

                var obnStartImport = GEBI("bnImportRecipe");

                if (obnStartImport)
                {
                    obnStartImport.style.display = "none";
                }
            }
            break;

    }
}
//-----------------------------------------------------------------

function OnKeyDown(idDiv, idTextBox, idOpenCloseButton, event)
{
    if (!event) event = window.event;

    var oDiv = GEBI(idDiv);
    var oTextBox = GEBI(idTextBox);
    var oButton = GEBI(idOpenCloseButton);
    var oParentElm = GEBI("tdMasterListParams");

    switch (event.keyCode)
    {
        // Enter Key  
        case 13:
            {
                if (oDiv.style.display == "block")
                {
                    oDiv.style.display = "none";
                    oTextBox.focus();
                    event.returnValue = false;
                }
            }
            break;

        // Esc Key   
        case 27:
            {
                if (oDiv.style.display == "block")
                {
                    oDiv.style.display = "none";
                    oTextBox.focus();
                    event.returnValue = false;
                }
            }
            break;

        // Up Arrow    
        case 38:
            {

                var oTDCol = oDiv.getElementsByTagName("TD");
                var bListEmpty = false;

                if (oTDCol)
                {
                    if (oTDCol.length == 0)
                    {
                        bListEmpty = true;
                    }
                }

                if (!bListEmpty && HasAnyValidItem(oTDCol))
                {
                    SelectListRow(oDiv, idTextBox, "KEY_UP");

                    if (oDiv.style.display == "none")
                    {
                        oDiv.style.display = "block";
                    }

                    oTextBox.focus();

                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paReloadMasterlistParams&SelectedItem=" + encodeURIComponent ( oTextBox.value ), "RELOAD_MASTERLIST_PARAMS", oParentElm);

                    var oTDStores = GEBI("TD_STORES_LIST");
                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paRefreshParams&List=StoresList&Condition=" + encodeURIComponent ( oTextBox.value ), "REFRESH_PARAMS", oTDStores);
                }

            }
            break;

        //  Down Arrow   
        case 40:
            {
                var oTDCol = oDiv.getElementsByTagName("TD");
                var bListEmpty = false;

                if (oTDCol)
                {
                    if (oTDCol.length == 0)
                    {
                        bListEmpty = true;
                    }
                }

                if (!bListEmpty && HasAnyValidItem(oTDCol))
                {
                    SelectListRow(oDiv, idTextBox, "KEY_DOWN");

                    if (oDiv.style.display == "none")
                    {
                        oDiv.style.display = "block";
                    }

                    oTextBox.focus();

                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paReloadMasterlistParams&SelectedItem=" + encodeURIComponent ( oTextBox.value ), "RELOAD_MASTERLIST_PARAMS", oParentElm);

                    var oTDStores = GEBI("TD_STORES_LIST");
                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paRefreshParams&List=StoresList&Condition=" + encodeURIComponent ( oTextBox.value ), "REFRESH_PARAMS", oTDStores);
                }
            }
            break;

        // page up     
        case 33:
            {

                var oTDCol = oDiv.getElementsByTagName("TD");
                var bListEmpty = false;

                if (oTDCol)
                {
                    if (oTDCol.length == 0)
                    {
                        bListEmpty = true;
                    }
                }

                if (!bListEmpty && HasAnyValidItem(oTDCol))
                {
                    SelectListRow(oDiv, idTextBox, "KEY_PAGEUP");

                    if (oDiv.style.display == "none")
                    {
                        oDiv.style.display = "block";
                    }

                    oTextBox.focus();

                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paReloadMasterlistParams&SelectedItem=" + encodeURIComponent ( oTextBox.value ), "RELOAD_MASTERLIST_PARAMS", oParentElm);
                    
                    var oTDStores = GEBI("TD_STORES_LIST");
                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paRefreshParams&List=StoresList&Condition=" + encodeURIComponent ( oTextBox.value ), "REFRESH_PARAMS", oTDStores);
                }

            }
            break;

        // page down    
        case 34:
            {
                var oTDCol = oDiv.getElementsByTagName("TD");
                var bListEmpty = false;

                if (oTDCol)
                {
                    if (oTDCol.length == 0)
                    {
                        bListEmpty = true;
                    }
                }

                if (!bListEmpty && HasAnyValidItem(oTDCol))
                {
                    SelectListRow(oDiv, idTextBox, "KEY_PAGEDOWN");

                    if (oDiv.style.display == "none")
                    {
                        oDiv.style.display = "block";
                    }

                    oTextBox.focus();

                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paReloadMasterlistParams&SelectedItem=" + encodeURIComponent ( oTextBox.value ), "RELOAD_MASTERLIST_PARAMS", oParentElm);
                    
                    var oTDStores = GEBI("TD_STORES_LIST");
                    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paRefreshParams&List=StoresList&Condition=" + encodeURIComponent ( oTextBox.value ), "REFRESH_PARAMS", oTDStores);
                }
            }
            break;

        default:
            {
                ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paRefreshParams&List=MasterList&Condition=" + encodeURIComponent ( oTextBox.value ), "REFRESH_PARAMS", oDiv);
            }
            break;
    }
}
//-----------------------------------------------------------------
function OnKeyDownOnlyCloseByEsc(idDiv, idTextBox, idOpenCloseButton, event)
{
    if (!event) event = window.event;

    var oDiv = GEBI(idDiv);
    var oTextBox = GEBI(idTextBox);
    var oButton = GEBI(idOpenCloseButton);

    switch (event.keyCode)
    {
        case 27:
        case 13:

            {
                if (oDiv.style.display == "block")
                {
                    oDiv.style.display = "none";
                    oTextBox.focus();
                    event.returnValue = false;
                }
            }
            break;
        // Up Arrow    
        case 38:
            {
                SelectListRow(oDiv, idTextBox, "KEY_UP");

                if (oDiv.style.display == "none")
                {
                    oDiv.style.display = "block";
                }


                oTextBox.focus();
            }
            break;

        //  Down Arrow    
        case 40:
            {
                SelectListRow(oDiv, idTextBox, "KEY_DOWN");

                if (oDiv.style.display == "none")
                {
                    oDiv.style.display = "block";
                }


                oTextBox.focus();
            }
            break;

        // page up      
        case 33:
            {
                SelectListRow(oDiv, idTextBox, "KEY_PAGEUP");

                if (oDiv.style.display == "none")
                {
                    oDiv.style.display = "block";
                }


                oTextBox.focus();
            }
            break;

        //  page down      
        case 34:
            {
                SelectListRow(oDiv, idTextBox, "KEY_PAGEDOWN");

                if (oDiv.style.display == "none")
                {
                    oDiv.style.display = "block";
                }


                oTextBox.focus();
            }
            break;
    }
}
//-----------------------------------------------------------------
function OnCategoriesWithIntellisenceKeyDown(idDiv, idTextBox, idOpenCloseButton, event)
{
    if (!event) event = window.event;

    var oDiv = GEBI(idDiv);
    var oTextBox = GEBI(idTextBox);
    var oButton = GEBI(idOpenCloseButton);

    switch (event.keyCode)
    {
        // tab Key    
        case 9:
            {
            }
            return;

        // Enter Key    
        case 13:
            {
                if (oDiv.style.display == "block")
                {
                    oDiv.style.display = "none";
                    oTextBox.focus();
                    event.returnValue = false;
                }
            }
            break;

        // Esc Key    
        case 27:
            {
                if (oDiv.style.display == "block")
                {
                    oDiv.style.display = "none";
                    oTextBox.focus();
                    event.returnValue = false;
                }
            }
            break;

        // Up Arrow     
        case 38:
            {

                var oTDCol = oDiv.getElementsByTagName("TD");
                var bListEmpty = false;

                if (oTDCol)
                {
                    if (oTDCol.length == 0)
                    {
                        bListEmpty = true;
                    }
                }

                if (!bListEmpty)
                {
                    SelectListRow(oDiv, idTextBox, "KEY_UP");

                    if (oDiv.style.display == "none")
                    {
                        oDiv.style.display = "block";
                    }

                    oTextBox.focus();
                }
            }
            break;

        //  Down Arrow    
        case 40:
            {
                var oTDCol = oDiv.getElementsByTagName("TD");
                var bListEmpty = false;

                if (oTDCol)
                {
                    if (oTDCol.length == 0)
                    {
                        bListEmpty = true;
                    }
                }

                if (!bListEmpty)
                {
                    SelectListRow(oDiv, idTextBox, "KEY_DOWN");

                    if (oDiv.style.display == "none")
                    {
                        oDiv.style.display = "block";
                    }

                    oTextBox.focus();
                }
            }
            break;
/*
        // page up      
        case 33:
            {

                var oTDCol = oDiv.getElementsByTagName("TD");
                var bListEmpty = false;

                if (oTDCol)
                {
                    if (oTDCol.length == 0)
                    {
                        bListEmpty = true;
                    }
                }

                if (!bListEmpty)
                {
                    SelectListRow(oDiv, idTextBox, "KEY_PAGEUP");

                    if (oDiv.style.display == "none")
                    {
                        oDiv.style.display = "block";
                    }

                    oTextBox.focus();
                }
            }
            break;

        // page down     
        case 34:
            {
                var oTDCol = oDiv.getElementsByTagName("TD");
                var bListEmpty = false;

                if (oTDCol)
                {
                    if (oTDCol.length == 0)
                    {
                        bListEmpty = true;
                    }
                }

                if (!bListEmpty)
                {
                    SelectListRow(oDiv, idTextBox, "KEY_PAGEDOWN");

                    if (oDiv.style.display == "none")
                    {
                        oDiv.style.display = "block";
                    }

                    oTextBox.focus();
                }
            }
            break;
*/
        default:
            {
                ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paRefreshParams&List=Categories&Condition=" + encodeURIComponent ( oTextBox.value ), "REFRESH_PARAMS", oDiv);
            }
            break;
    }
}
//-----------------------------------------------------------------
function ChangeStore(iTDId, iItemIndex, strName, iItemID)
{
    if (iItemID < 0)
    {
        switch (iItemID)
        {
            // manage stores   
            case "-1":
                {
                    SubmitForm('fCurrentList', 'bnCreateStoreDialog');
                }
                break;

            // rename Aisle     
            case "-2":
                {
                    SubmitForm('fCurrentList', 'bnRenameAisleDialog');
                }
                break;
        }
    }
    else
    {
        var oTargetTD = GEBI("idMainBlockSource");

        ClearVariables();

        ShowLoadingMessageDelayed();

        ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paChangeCurrentStore&StoreID=" + encodeURIComponent ( iItemID ), "CHANGE_STORE", oTargetTD);
    }

}
//-----------------------------------------------------------------
function OnRecPerPageChange_ShoppingList (iTDId, iItemIndex, strName, iItemID)
{
    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paRecPerPageShoppingList&RecPerPage=" + encodeURIComponent ( strName ), "REC_PER_PAGE_SHOPPINGLIST", "");
}
//-----------------------------------------------------------------
function OnRecPerPageChange_MasterList(iTDId, iItemIndex, strName, iItemID)
{
    var oTargetTD = GEBI("idMainBlockSource");

    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paRecPerPageMasterList&RecPerPage=" + encodeURIComponent ( strName ), "REC_PER_PAGE_MASTERLIST", oTargetTD);
}
//-----------------------------------------------------------------
function OnRecPerPageChange_CouponsList(iTDId, iItemIndex, strName, iItemID)
{
    var oTargetTD = GEBI("idMainBlockSource");

    ProcessRequest("default.aspx", "action=DirectPOST&PostAction=paRecPerPageCouponsList&RecPerPage=" + encodeURIComponent ( strName ), "REC_PER_PAGE_COUPONSLIST", oTargetTD);
}
//-----------------------------------------------------------------
function OnBarcodeKeyDown(oSender)
{
    try
    {
        var oBarcodeInput = oSender;
        var oBarcodeFixed = GEBI("Barcode_fixed");
        
        if ( oBarcodeInput && oBarcodeFixed )
        {
            var BarcodeInputValue = oBarcodeInput.value.trim();

            var iEnteredDigitsCount = BarcodeInputValue.length;

            if (iEnteredDigitsCount > 13)
            {
                CreateErrorSpan(oBarcodeInput, "ErrorSpan_" + oBarcodeInput.id, "UPC code max length is 13 digits");
            }
            else
            {
                RemoveErrorSpan(oBarcodeInput, "ErrorSpan_" + oBarcodeInput.id);

                var iLeadingZeroCount = 13 - iEnteredDigitsCount;

                var strLeadingZeros = "";
                
                for ( i = 0; i < iLeadingZeroCount; i++ )
                {
                    strLeadingZeros += "0";
                }

                oBarcodeFixed.value = strLeadingZeros + BarcodeInputValue;
            }
        }
    }
    catch ( e )
    {}
}
//-----------------------------------------------------------------
function ShoppingListOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    try
    {
        var oInput = GEBI("faUpdateNewListName");

        if (oInput)
        {
            oInput.value = strName;
            oInput.className = "forminput";
        }
    }
    catch ( e ){}
}
//-----------------------------------------------------------------
function StoresOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    try
    {
        var oSelectedStore = _Default.GetStoreByID(iItemID).value;

        if (oSelectedStore)
        {
            var oInputName = GEBI("faUpdateStoreName");

            if (oInputName)
            {
                oInputName.value = oSelectedStore.strName;
                oInputName.className = "forminput";
            }

            var oInputCoupon = GEBI("faUpdateStoreCoupon");

            if (oInputCoupon)
            {
                oInputCoupon.value = oSelectedStore.strCoupon;
                oInputCoupon.className = "forminput";
            }
            
        }
    }
    catch (e) { }
}
//-----------------------------------------------------------------
function MoreActionsOnSelect(iTDId, iItemIndex, strName, iItemID)
{
    switch (iItemIndex)
    {
        case 0:
            {
                SubmitForm('fCurrentList', 'bnResetListDialog');
            }
        break;
        case 1:
            {
                SubmitForm('fCurrentList', 'bnSendPushCommand');
            }
            break;
        case 2:
            {
                SubmitForm('fCurrentList', 'bnRenameAisleDialog');
            }
            break;
    }
}
