﻿// JScript File

        function visibleOverly(isVisible)
        {
            var overlyDiv = document.getElementById("cusomModalOverly");
            if (overlyDiv != null) {
                if (isVisible) {
                    var currentBrowserWindowSize = getCurrentWindowSize();
                    //               overlyDiv.style.height = currentBrowserWindowSize.height + "px";
                    //              overlyDiv.style.width = currentBrowserWindowSize.width + "px";
                    overlyDiv.style.height = "2000px";
                    overlyDiv.style.width = currentBrowserWindowSize.width + "px";
                    overlyDiv.className = "customOverly";
                    overlyDiv.style.display = "block";
                }

                else {
                    overlyDiv.className = null;
                    overlyDiv.style.display = "none";
                }
            }
        }

        function getCurrentWindowSize()
        {
            var myWidth = 0, myHeight = 0;

            if (typeof (window.innerWidth) == 'number')
            {
                //Non-IE
                myWidth = window.innerWidth;
                myHeight = window.innerHeight;
            } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
            {
                //IE 6+ in 'standards compliant mode'
                myWidth = parseInt(document.documentElement.clientWidth);
                myHeight = parseInt(document.documentElement.clientHeight);
            } else if (document.body && (document.body.clientWidth || document.body.clientHeight))
            {
                //IE 4 compatible
                myWidth = parseInt(document.body.clientWidth);
                myHeight = parseInt(document.body.clientHeight);
            }

            return { width: myWidth, height: myHeight };
        }
        
        function isSafari()
        {
            var safari = false;
            safari = (document.childNodes) && (!document.all) && (!navigator.taintEnabled) && (!navigator.accentColorName); 
            return safari;
        }
        
        function isOpera()
        {
            var opera = false;
            opera = window.opera ? true : false; 
            
            return opera;
        }
        
        function applyCustomModality(oWindow)
        {
            if(oWindow.IsModal() && (isSafari() /* || isOpera() *Uncoment this code if you experience the same problem under Opera* */))
            {
               visibleOverly(true);
            }
        }
        
        function OnWindowClientShow(sender, args)
        {   
            applyCustomModality(sender);
        }
        
        function OnWindowClientClose(sender, args)
        {   
           if(isSafari() || isOpera())
            {
               visibleOverly(false);
            }
        }

