
   var SubWinX = null;
       var rightBrowser = false;

        if ((navigator.appName.toLowerCase() == "netscape")) {
            rightBrowser = true;
			BrowserName = "N";
        }
        if (navigator.appName.toLowerCase() == "microsoft internet explorer"){
            if (parseInt(navigator.appVersion) > 3) {
               rightBrowser = true;
			   BrowserName = "IE";
            } else {
              rightBrowser = false;
			  BrowserName = "IE";
            }
        }
//alert("appName = " + navigator.appName.toLowerCase() + "  appVersion= " + navigator.appVersion + "  IntappVersion= " + parseInt(navigator.appVersion));

   function open_winx(dest, width, height, menubar, resizable) {
 
      if ((rightBrowser == false)) {
              SubWinX = window.open(dest, "SubWinX", "status=no,copyhistory=no,directories=no,toolbar=no,menubar=" + menubar + ",scrollbars=yes,width=" + width + ",height=" + height + ",resizable=" + resizable );
       } else {

           if(SubWinX  == null) {
              SubWinX = window.open(dest, "SubWinX", "status=no,copyhistory=no,directories=no,toolbar=no,menubar=" + menubar + ",scrollbars=yes,width=" + width + ",height=" + height + ",resizable=" + resizable );
			  h_width = width;
			  h_height = height;
			  h_menubar = menubar;
			  h_resizable = resizable;
           } else {
               if(SubWinX.closed) {
			   	  //alert("SubWinX.closed");
                  SubWinX = null;
                  open_winx(dest, width, height, menubar, resizable);
               } else {
			   		//alert("SubWinX.closed else");
				  if(BrowserName == "N"){
				  	newWinFlag = 1;
				  }else{
			   	  	newWinFlag = 1;
				  }
				  if (h_width != width) newWinFlag++;
				  if (h_height != height) newWinFlag++;
				  if (h_menubar != menubar) newWinFlag++;
				  if (h_resizable != resizable) newWinFlag++;
				  
				  if (newWinFlag == 0){
                  	SubWinX.location = dest;
                  	SubWinX.focus();
				  }else{
				  	//alert("newWinFlag != 0");
				  	SubWinX.close();
					if(BrowserName == "N"){
	              		SubWinX = null;
					}
                  	open_winx(dest, width, height, menubar, resizable);
				  }
               }
           }

       }  

   }
   
	function uload_win(win_name){
		win2 = eval(win_name);
		if (win2 != null) {
			win2.close();
		}
	
	}
