﻿// JScript File

       function showNetroModalPanel(divName)
       {
          var editor = document.getElementById(divName);
          var opacity = document.getElementById("NetroDivOpacity");
          ///alert(editor.clientHeight);
          if( editor != null && opacity != null ){
                   
            //Sets position for info div
            var screenSize = getScreenSize();
            var EditorX = eval((screenSize['x'] - editor.clientWidth) / 2 );
            var EditorY = eval(screenSize['y']/2 + getScrollHeight() - editor.clientHeight/2);

            //set opacity position
            opacity.style.left = 0 + "px";
            editor.style.top = EditorY + "px";
            editor.style.left = EditorX + "px";           

            opacity.style.width = screenSize['x']+"px";
            opacity.style.height = screenSize['y']+"px";
     
            //
            var editorOffset = eval(getScrollHeight() + eval(screenSize['y']));                        
            if( editorOffset > eval(screenSize['y']) )
                 opacity.style.height = editorOffset+"px";
            else opacity.style.height = screenSize['y']+ "px";                


            }
          else alert("Div editor or div opacity doesnt exist!!");
       }
       
       function showNetroModalPanelWithPosition(divName, leftPX, topPX)
       {
          var editor = document.getElementById(divName);
          var opacity = document.getElementById("NetroDivOpacity");
          ///alert(editor.clientHeight);
          if( editor != null && opacity != null ){
                   
            //Sets position for info div
            var screenSize = getScreenSize();

            //set opacity position
            opacity.style.left = 0 + "px";
            editor.style.top = topPX + "px";
            editor.style.left = leftPX + "px";           

            opacity.style.width = screenSize['x']+"px";
            opacity.style.height = screenSize['y']+"px";
     
            //
            var editorOffset = eval(getScrollHeight() + eval(screenSize['y']));                        
            if( editorOffset > eval(screenSize['y']) )
                 opacity.style.height = editorOffset+"px";
            else opacity.style.height = screenSize['y']+ "px";                


            }
          else alert("Div editor or div opacity doesnt exist!!");
       }
       
       function hideNetroModalPanel(divName)
        {
            var editor = document.getElementById(divName);
            var opacity= document.getElementById("NetroDivOpacity");
          
            if( editor != null && opacity != null ){
                editor.style.left = -10000 +"px";
                opacity.style.left = -10000 +"px";              
            }
            else alert("Div editor or div opacity doesnt exist!!");
       }
       
       function getScreenSize(){
        var screenSize = new Array();


        if( window.innerWidth || window.innerHeight ) {
            screenSize['x'] = window.innerWidth;
            screenSize['y'] = window.innerHeight;
        }
        else if( document.documentElement.clientWidth || document.documentElement.clientHeight ){

            screenSize['x'] = document.documentElement.clientWidth;
            screenSize['y'] = document.documentElement.clientHeight;
            
        }
        else
        {
        screenSize['x'] = document.body.clientWidth;
            screenSize['y'] = document.body.clientHeight;
        }
        
        return screenSize;
    }
    
    function getWindowHeight() 
       {
          var myHeight = 0;
          
          if( typeof( window.innerHeight ) == 'number' ) 
          {
            //Non-IE
            myHeight = window.innerHeight;
          } else if( document.documentElement && document.documentElement.clientHeight ) 
          {
            //IE 6+ in 'standards compliant mode'
            myHeight = document.documentElement.clientHeight;
          } else if( document.body && document.body.clientHeight ) 
          {
            //IE 4 compatible
            myHeight = document.body.clientHeight;
          }
          
          return myHeight;
       }
        
       function getWindowWidth() 
       {
          var myWidth = 0;
          
          if( typeof( window.innerWidth ) == 'number' ) 
          {
            //Non-IE
            myWidth = window.innerWidth;
          } else if( document.documentElement && document.documentElement.clientWidth ) 
          {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
          } else if( document.body && document.body.clientWidth ) 
          {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
          }
          return myWidth;
        }
        
         function getScrollHeight()
       {
           var h = window.pageYOffset ||
                   document.body.scrollTop ||
                   document.documentElement.scrollTop;
                   
           return h ? h : 0;
       }
