﻿function doCollapseExpandDiv(i_strDiv, i_strDivImage, i_strExpandedImage, i_strCollapsedImage, i_strMessageLabel, i_strExpandedText, i_strCollapsedText)
    {
        var blnReturnValue = true; // visible
        
        var objDiv = document.getElementById(i_strDiv);
        var objDivImage = document.getElementById(i_strDivImage);
        var objExpandedImage = document.getElementById(i_strExpandedImage);
        var objCollapsedImage = document.getElementById(i_strCollapsedImage);
        
        var objMessageLabel;
        
        if (i_strMessageLabel != "")
        {
            objMessageLabel = document.getElementById(i_strMessageLabel);
        }
        
        if (objDiv.style.visibility == "visible")
            {
            blnReturnValue = false; // hidden
            
            objDiv.style.visibility = "hidden";
            objDiv.style.display = "none";
            objDivImage.src = objCollapsedImage.src;
            
            if (i_strMessageLabel != "")
                {
                objMessageLabel.innerText  = i_strCollapsedText;
                }
            }
        else
            {
            objDiv.style.visibility = "visible";
            objDiv.style.display = "";
            objDivImage.src = objExpandedImage.src;
            
            if (i_strMessageLabel != "")
                {
                objMessageLabel.innerText  = i_strExpandedText;
                }            
            }
            
        return blnReturnValue;
    }
    
function updateMenuVisibility(i_blnVisible)
    {
        wsClientScriptMethods.UpdateMenuVisibility(i_blnVisible);
    }    
    
function doMakeUpperCase(i_objControl)
    {
    i_objControl.value = i_objControl.value.toUpperCase();
    }

function showModalPopup(i_strURL, i_intWidth, i_intHeight)
    {
    var strParameters = 
                    "dialogWidth=" + i_intWidth.toString() + "px;" +
                    "dialogHeight=" + i_intHeight.toString() + "px;" +
                    "resizable=no;" +
                    "center=yes;" +
                    "status=no;" +
                    "scroll=no;" +
                    "unadorned=yes";

    showDarkdiv();                     
    window.showModalDialog(i_strURL,'',strParameters);
    hideDarkDiv();
    
    window.event.cancelBubble=true;
    return false;
    }

function showModalPopupWithLocation(i_strURL, i_intWidth, i_intHeight, i_intLeft, i_intTop)
    {
    var strParameters = 
                    "dialogWidth=" + i_intWidth.toString() + "px;" +
                    "dialogHeight=" + i_intHeight.toString() + "px;" +
                    "dialogLeft=" + i_intLeft.toString() + ";" +
                    "dialogTop=" + i_intTop.toString() + ";" +
                    "resizable=no;" +
                    "center=no;" +
                    "status=no;" +
                    "scroll=no;" +
                    "unadorned=yes";

    showDarkdiv();                     
    window.showModalDialog(i_strURL,'',strParameters);
    hideDarkDiv();
    
    window.event.cancelBubble=true;
    return false;
    }
  
function showModelessPopup(i_strURL, i_intWidth, i_intHeight)
    {
    
	var strParameters;
	    strParameters = strParameters = "top=0";
	    strParameters = strParameters + ",left=0";
	    strParameters = strParameters + ",width=" + i_intWidth.toString() + "";
	    strParameters = strParameters + ",height=" + i_intHeight.toString() + "";
	    strParameters = strParameters + ",resizable=yes";
	    strParameters = strParameters + ",toolbar=no";
	    strParameters = strParameters + ",location=no";
	    strParameters = strParameters + ",directories=no";
	    strParameters = strParameters + ",status=no";
	    strParameters = strParameters + ",scrollbars=yes";
	    strParameters = strParameters + ",menubar=no";

    var objWindow = window.open(i_strURL,"ZeusPopup",strParameters,true);
    //if(objWindow.focus()){}; -- does not work if there is a window already open
    
    window.event.cancelBubble=true;
    return false;
    }
        
function showDarkdiv() 
    { 
    var darkDivExisting=document.getElementById('darkLayer');
    if (!darkDivExisting)
        {
           var darkDiv = document.createElement('div');
           darkDiv.setAttribute('id', 'darkLayer');
           var opacity = 10;
           var opaque = (opacity / 100);
           darkDiv.style.opacity=opaque;                      
           darkDiv.style.MozOpacity=opaque;                   
           darkDiv.style.filter='alpha(opacity='+opacity+')'; 
           darkDiv.style.zIndex=200;        
           darkDiv.style.backgroundColor='#000000';  
           darkDiv.style.width= '100%';
           darkDiv.style.height= '100%';
           darkDiv.style.display='block';		       
           darkDiv.style.position = 'fixed';
           darkDiv.style.top = '0px';
           darkDiv.style.left = '0px';
           document.body.appendChild(darkDiv);
         }
    else
         {
           darkDivExisting.style.display='block';
         }
    } 
    
function hideDarkDiv() 
    { 
        var darkDiv=document.getElementById('darkLayer');
        darkDiv.style.display='none';
    }    
    
function showListFullText(i_objListBox)
    {
        if (i_objListBox.selectedIndex > -1)
        {
        alert(i_objListBox.options[i_objListBox.selectedIndex].text);
        }
    }