// Open a little window.

var popupWin = null;
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
     function autoTab(input,len, e) {
        var keyCode = (isNN) ? e.which : e.keyCode;
        var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
         if(input.value.length >= len && !containsElement(filter,keyCode)) {
           input.value = input.value.slice(0, len);
           input.form[(getIndex(input)+1) % input.form.length].focus();
     }
          function containsElement(arr, ele) {
               var found = false, index = 0;
            while(!found && index < arr.length)
              if(arr[index] == ele)
                 found = true;
                  else
                 index++;
               return found;
                }
          function getIndex(input) {
               var index = -1, i = 0, found = false;
                while (i < input.form.length && index == -1)
                        if (input.form[i] == input)index = i;
                          else i++;
                         return index;
                 }
          return true;
      }
function openWindow(location, w, h)
{
  openCustomizedWindow(location, w, h, 1);
}

function openCustomizedWindow(location, w, h, showToolbar)
{
       if (popupWin != null && !popupWin.closed)
       {
         popupWin.close();
         popupWin = null;
       }

      // Detect screen resolution. Only works in 4+ browsers. If resolution is
     var browserName=navigator.appName;
     var browserVer=parseInt(navigator.appVersion);

     // Detect screen1 resolution. Only works in 4+ browsers. If resolution is
       // smaller than the desired window size, adjust the window size.
        if (!(browserName=="Netscape" && browserVer<=4) )
        {
          wd = (w > screen.availWidth) ? eval(screen.availWidth - 15) : w;
          ht = (h > screen.availHeight) ? eval(screen.availHeight - 15) : h;
 	        if (screen) {
 	          wd = (w > screen.availWidth) ? eval(screen.availWidth - 15) : w;
       	    ht = (h > screen.availHeight) ? eval(screen.availHeight - 15) : h;
 	        }
          else
          {
            wd = (w > 600) ? 600 : w;
            ht = (h > 380) ? 380 : h;
          }
        }
       else
       {
         wd = (w > 600) ? 600 : w;
         ht = (h > 380) ? 380 : h;
       }

       // Open a resizable popup window with scrollbars, the toolbar (buttons),
      // no status bar, in the top left corner of the screen (window positioning
     // no status bar, in the top left corner of the screen1 (window positioning
       // only works in IE 4+).

       popupWin = window.open("", "display", "menubar=1, scrollbars=1,resizable=1,width="+wd+
                  ",height="+ht+",left=0,top=0,toolbar="+showToolbar+",menubar=0,status=0");
       popupWin.focus();
       popupWin.location.href = location;

       return true;
}

 function openWindowWithProperties(location, w, h, showToolBar, showMenuBar,showScrollBar, showStatusBar,resizable)
 {
     if (popupWin != null && !popupWin.closed)
     {
       popupWin.close();
       popupWin = null;
     }
 
  // Detect screen resolution. Only works in 4+ browsers. If resolution is
 	var browserName=navigator.appName;
 	var browserVer=parseInt(navigator.appVersion);

     // Detect screen1 resolution. Only works in 4+ browsers. If resolution is
       // smaller than the desired window size, adjust the window size.

  if (!(browserName=="Netscape" && browserVer<=4) )
  {
    wd = (w > screen.availWidth) ? eval(screen.availWidth - 15) : w;
    ht = (h > screen.availHeight) ? eval(screen.availHeight - 15) : h;
    if (screen) {
      wd = (w > screen.availWidth) ? eval(screen.availWidth - 15) : w;
      ht = (h > screen.availHeight) ? eval(screen.availHeight - 15) : h;
    }
    else
    {
      wd = (w > 600) ? 600 : w;
      ht = (h > 380) ? 380 : h;
    }
  }
  else
  {
    wd = (w > 600) ? 600 : w;
    ht = (h > 380) ? 380 : h;
  }

 // Open a resizable popup window with scrollbars, the toolbar (buttons),
 // no status bar, in the top left corner of the screen (window positioning
 // only works in IE 4+).
 popupWin = window.open("", "display", "menubar="+showMenuBar +",scrollbars=" +showScrollBar +",resizable=" +resizable +",width="+wd+
            ",height="+ht+",left=0,top=0,toolbar="+showToolBar+",menubar="+showMenuBar +",status="+showStatusBar);
 popupWin.focus();
 popupWin.location.href = location;

 return true;
}
