window.parent.name = "collectivex";
var winopts = null;
var smallwindow = null;
var w = null;
var h = null;
var windowname="main";

function OpenWin(file,h,w,type,wn) {

        windowname = wn;

        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;

        if(type == 1) {

                // 1 -- Clean with no scroll bars, no menu bars or other browser functions
                winopts = "width="+w+",height="+h+",top="+wint+",left="+winl+",toolbar=0,location=0,directories=0,status=0,status=no,menubar=yes,scrollbars=0,scrollbars=no,resizable=no,copyhistory=1";
        } else if(type == 2) { 

                // 2 -- All turned on, scroll bars, menu bars and other browser functions
                winopts = "width="+w+",height="+h+",top="+wint+",left="+winl+",toolbar=1,location=1,directories=1,status=yes,menubar=yes,scrollbars=1,scrollbars=yes,resizable=yes,copyhistory=1";
        } else if(type == 3) {

                // 3 -- Clean with scroll bars, but no menu bars or other browser functions
                winopts = "width="+w+",height="+h+",top="+wint+",left="+winl+",toolbar=0,location=0,directories=0,status=yes,menubar=no,scrollbars=1,scrollbars=yes,resizable=no,copyhistory=1";
        } else {
                
                // Default is Clean
                winopts = "width="+w+",height="+h+",top="+wint+",left="+winl+",toolbar=0,location=0,directories=0,status=no,menubar=no,scrollbars=0,scrollbars=no,resizable=no,copyhistory=1";
        }

        
        historywin(file)
}

function historywin(filename) {
        fileURL=filename;
        //      if (smallwindow != null) smallwindow.close();
    if (historywin.close) smallwindow.close();
        timerID= setTimeout('Opener(fileURL)',100);
}

function Opener(winname){
  filename = "" + winname;
  winname = windowname
  smallwindow = window.open(filename,winname,winopts)
  
  if( navigator.appVersion.indexOf("(X11") != -1 || navigator.appVersion.indexOf("(Mac") != -1) {
       smallwindow = window.open(filename,winname,winopts)
  }
  
  if( navigator.appVersion.indexOf("MSIE") == -1 ) {
      smallwindow.mainWin = this;
      WindowFocus();
    }
}

function WindowFocus(){
  
   if( navigator.appVersion.indexOf("2.") == -1)
       smallwindow.focus();    
                        
}
