﻿// Get the whole browser screen
function getWindowSize() {
          var myWidth = 0, myHeight = 0;
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            myWidth = window.parent.innerWidth;
            myHeight = window.parent.innerHeight;
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //(NOT SURE YET) IE 6+ in 'standards compliant mode'
            myWidth = window.parent.document.documentElement.clientWidth;
            myHeight = window.parent.document.documentElement.clientHeight;
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 7
            myWidth = window.parent.document.documentElement.clientWidth;
            myHeight = window.parent.document.documentElement.clientHeight;
          }
          
         return[myWidth, myHeight]; 
}

function popWindow(url, name, width, height) {
    var popLeft = 0, popTop = 0;
    var popWidth = width, popHeight = height;

    try {
            var parentSize = getWindowSize(); 
            
            popLeft = (parentSize[0]/2) - (popWidth/2);
            popTop = (parentSize[1]/2) - (popHeight/2);
            window.open(url, name, 'resizable=1, status=0, scrollbars=1, menubar=0, toolbar=0, width=' + popWidth + ', height=' + popHeight + ', top=' + popTop + ', left=' + popLeft + '');
            
      }
      catch(err) {
            window.open(url, name, 'resizable=1, status=0, scrollbars=1, menubar=0, toolbar=0, width=' + popWidth + ', height=' + popHeight + '');
      }
      
}
        

