﻿// JScript File
var win = null;
    function newWindow(mypage,myname,w,h,features) {
      if(screen.width){
      var winl = (screen.width-w)/2;
      var wint = (screen.height-h)/2;
      }else{winl = 0;wint =0;}
      if (winl < 0) winl = 0;
      if (wint < 0) wint = 0;
      var settings = 'height=' + h + ',';
      settings += 'width=' + w + ',';
      settings += 'top=' + wint + ',';
      settings += 'left=' + winl + ',';
      settings += features;
      if(CheckOpen())
      {
        win = window.open("./nuclidesposter.aspx?imgURL=" + mypage,myname,settings);
        win.window.focus();
      }
      else
      {
        win.close();
        win = window.open("./nuclidesposter.aspx?imgURL=" + mypage,myname,settings);
        win.window.focus();
      }  
    }
    
    function newGeneralWindow(mypage,myname,w,h,features) {
      if(screen.width){
      var winl = (screen.width-w)/2;
      var wint = (screen.height-h)/2;
      }else{winl = 0;wint =0;}
      if (winl < 0) winl = 0;
      if (wint < 0) wint = 0;
      var settings = 'height=' + h + ',';
      settings += 'width=' + w + ',';
      settings += 'top=' + wint + ',';
      settings += 'left=' + winl + ',';
      settings += features;
      if(CheckOpen())
      {
        win = window.open(mypage,myname,settings);
        win.window.focus();
      }
      else
      {
        win.close();
        win = window.open(mypage,myname,settings);
        win.window.focus();
      }  
    }
    
    function CheckOpen () 
    {
      if(win != null)
      {
          if (win.closed == true) 
          {
            return true;
          } 
          else 
          {
            return false;
          }
      }
      else
      {
        return true;
      }
    }

