﻿function getScreenSize(){
        var screenSize = new Array();
        
        //Non IE browsers
        if( typeof( window.innerWidth ) == 'number' ) {
            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;
        }
        
        return screenSize;
    }
   function Launch(pnlFlashClientID)
   {
      $("#flash1").css("display", "none");
      $("#flash2").css("display", "none");
      $("#" + pnlFlashClientID).css("display", "none");
      
      
      var editor = document.getElementById("DivCreditCost");
      var opacity = document.getElementById("DivOpacity");
      
      if( editor != null && opacity != null ){    
               
        //Sets position for info div
        var screenSize = getScreenSize();       
        var EditorX = eval(screenSize['x']/2 - 250);
        var EditorY = eval(screenSize['y']/2 - 250);
                       
        //if top position < 0 than set it to 50
        if( EditorY < 0 ) EditorY = 50;        
        //if height of info div is > = than screensize in Ydimension than set top to 0px;
        if( eval(editor.clientHeight) >= eval(screenSize['y']) ) EditorY = 0;
        
        //set opacity position    
        opacity.style.left = 0 + "px";
        editor.style.top = EditorY + "px";
        editor.style.left = EditorX + "px";       
    
        opacity.style.width = screenSize['x']+"px";
        
        //
        var editorOffset = eval(editor.clientHeight + EditorY );                        
        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 hidePanel(){
    $("#flash1").css("display", "block");
      $("#flash2").css("display", "block");
      $("#flash3").css("display", "block");
    
     var editor = document.getElementById("DivCreditCost");
      var opacity= document.getElementById("DivOpacity");
      
      if( editor != null && opacity != null ){
        editor.style.left = -10000 +"px";
        opacity.style.left = -10000 +"px";              
      }
      else alert("Div editor or div opacity doesn't exist!");
   }
