// File: window_man.js
// This script is for opening and managing sub windows from a main html page. * 
// Aspire 10/30/2001 - Matt Myers
var win_size_props = "width=640,height=480";
var win = null;
var old_name = null;
var ext = ".swf";

var IE = navigator.appName.indexOf("Microsoft") != -1 ? true : false;
if(IE){
    ext = "_real.html";
}
//openWin:  opens a new window pointing to file 'name' without file extention.
// w and h are optional, but if one is given the other must be given also.
// scroll is optional as well. The value of scroll is true or false.
function openWin(name, w, h, scroll, xpos, ypos){
    if(scroll)
	win_other_props = ",resizable,scrollbars";
    else
	win_other_props = ",resizable";
    if(xpos)
	win_other_props += ",screenX="+xpos;
    else if(ypos)
	win_other_props += ",screenY="+ypos;

    if( name.indexOf('.') == -1 ){
	name += ext;
    }
    if(win != null && old_name != name && !win.closed){
	win.close();
    }
    if(win != null && old_name == name && !win.closed){  // If it's the same window just give focus.
	win.focus();
    }
    else{
	if(w && h){
	    var props = "width="+w+",height="+h+win_other_props;
	    win = window.open(name, 'my_win', props);
	}
	else{
	    win = window.open(name, 'my_win', win_size_props+win_other_props);
	}
	win.focus();
    }
    old_name = name;
}

