﻿
        function SetImage(controlName, imgName) {
            try {
                document.getElementById(controlName).src = imgName;
                ShowControl(controlName);
            }
            catch (e) {
            }
        }
            
        function ShowControl(controlName) {
            try {
            document.getElementById(controlName).style.display = "";
            }
            catch (e) {
            }
        }
            
        function HideControl(controlName) {
            try {
                document.getElementById(controlName).style.display = "none";
            }
            catch (e) {
            }
        }
        
        
        function SetTbSearchEnabled(tbSearch, btSerach)
        {
            try
            {
                document.getElementById(btSerach).disabled = document.getElementById(tbSearch).Text == ""; 
            }
            catch (e)
            {
            }
        }
        
        function ExpandReductAllDemo() {
            ExpandReductAll("Demo", 8);
        }
        function MinMaximiseDemo(bt, control, txt) {
            MinMaximiseWidthReduct(bt, control, txt, "Demo", 8);
        }
        
        function ExpandReductAllHist3D() {
            ExpandReductAll("Hist", 9);
        }
        function MinMaximiseHist3D(bt, control, txt) {
            MinMaximiseWidthReduct(bt, control, txt, "Hist", 9);
        }
        
        function ExpandReductAllMerch() {
            ExpandReductAll("Merch", 5);
        }
        function MinMaximiseMerch(bt, control, txt) {
            MinMaximiseWidthReduct(bt, control, txt, "Merch", 5);
        }
        
        function ExpandReductAllTechno() {
            ExpandReductAll("Techno", 8);
        }
        function MinMaximiseTechno(bt, control, txt) {
            MinMaximiseWidthReduct(bt, control, txt, "Techno", 8);
        }
        
        function ExpandReductAllConcept() {
            ExpandReductAll("Concept", 4);
        }
        function MinMaximiseConcept(bt, control, txt) {
            MinMaximiseWidthReduct(bt, control, txt, "Concept", 4);
        }
        function ExpandReductAllCompany() {
            ExpandReductAll("Societe", 2);
        }
        
        function ExpandReductAll(controlsName, nbControls) {
            try {
            
               var btExpand = document.getElementById("BpExpandAll");
                if (btExpand.className == "BtExpandAll")
                {
                    for (num = 1; num < nbControls + 1; num++) 
                    {
                        var bt = controlsName + num;
                        if (document.getElementById(bt).style.display == "none")
                        {
                            document.getElementById(bt).style.display = "";
                            //document.getElementById(controlsName + num + "Txt").style.cursor = "default";
                            document.getElementById(bt + "bt").className = "Minimize";
                        }
                     }
                    btExpand.innerHTML = "Réduire tout";
                    btExpand.className = "BtReductAll";
                }
                else
                {
                    for (num = 1; num < nbControls + 1; num++) 
                    {
                        var bt = controlsName + num;
                        if (document.getElementById(bt).style.display == "")
                        {
                            document.getElementById(bt).style.display = "none";
                            //document.getElementById(controlsName + num + "Txt").style.cursor = "default";
                            document.getElementById(bt + "bt").className = "Maximize";
                        }
                     }   
                        
                    btExpand.innerHTML = "Etendre tout";
                    btExpand.className = "BtExpandAll";
                }
            }
            catch (e) {
            }
        }
        
            
        function MinMaximiseWidthReduct(bt, control, txt, controlsName, nbControls) {
            try {
            
            MinMaximise(bt, control, txt);
            
            var btAll = document.getElementById("BpExpandAll");
            var btAllExpand = btAll.className == "BtExpandAll";
            var btReducted = document.getElementById(control).style.display == "none";
            
            if (btReducted)
            {
                var num = 1;
                var btExpanded = false;
                while (!btExpanded && num < nbControls + 1) 
                    if (document.getElementById(controlsName + num).style.display == "")
                        btExpanded = true;
                    else
                        num++;

                if (!btExpanded)
                {
                    btAll.innerHTML = "Etendre tout";
                    btAll.className = "BtExpandAll";
                }
            }
            else
            {
                if (btAllExpand)
                {
                    btAll.innerHTML = "Réduire tout";
                    btAll.className = "BtReductAll";
                }
            }
            
            }
            catch (e) {
            }
        }
        
            
        function MinMaximise(bt, control, txt) {
            try {
            
                if (document.getElementById(control).style.display == "none")
                {
                    document.getElementById(control).style.display = "";
                    document.getElementById(bt).className = "Minimize";
                }
                else
                {
                    document.getElementById(control).style.display = "none";
                    document.getElementById(bt).className = "Maximize";
                }
            }
            catch (e) {
            }
        }
        
        function MinMaximiseRoom() {
            try {
            
                if (document.getElementById("HistRoom").style.display == "none")
                {
                    document.getElementById("HistRoom").style.display = "";
                    //document.getElementById("HistRoomTxt").style.cursor = "default";
                    document.getElementById("HistRoomBt").className = "Minimize";
                    document.getElementById("HistRoomBorder").style.backgroundPosition = "0 -27px";
                }
                else
                {
                    document.getElementById("HistRoom").style.display = "none";
                    //document.getElementById("HistRoomTxt").style.cursor = "pointer";
                    document.getElementById("HistRoomBt").className = "Maximize";
                    document.getElementById("HistRoomBorder").style.backgroundPosition = "0 0";
                    
                }
            }
            catch (e) {
            }
        }
        
        
        function SetBackgroundPosition(control, position) {
            try {
            
                document.getElementById(control).style.backgroundPosition = position;
            }
            catch (e) {
            }
        }
