<!-- Hide from old browsers
// a set of utility functions for pop up window management
// $Id: popwm.js,v 1.8 2003/10/14 23:52:42 fangchin Exp $


// the following wrapper function of window.open() allows a user to specify
//
// o url  : the destination URL,
// o wname: the window's name (e.g. for target) 
// o w    : window width, 
// o h    : window hight, 
// o loff : offset from left edge of the display, 
// o toff : offset from the top edge of the display, and 
// o aoff : auto close the window (optional)
// o ctime: a given wait time before window closure (optional)
//
// if aoff is not given, then ctime shouldn't be given either.

function winopen(url,wname,w,h,loff,toff,aoff,ctime) {
    var windowFeatures = 
	"scrollbars=yes" +
	",toolbar=yes" +
	",copyhistory=yes," +
	",width=" + w +
	",height=" + h +
	",screenX=" + loff +
	",screenY=" + toff;
    win = window.open(url, wname, windowFeatures);
    if (aoff == "y") {
	start_time(ctime);
    }
}

function start_time(x) {
    var time= new Date();
    hours = time.getHours();
    mins = time.getMinutes();
    secs = time.getSeconds();
    closeTime = hours*3600+mins*60+secs;
    closeTime += x; // Amount of time that the window stays open in seconds
    timer();
}

function timer() {
    var time = new Date();
    hours = time.getHours();
    mins = time.getMinutes();
    secs = time.getSeconds();
    curTime = hours*3600+mins*60+secs;
    if (curTime >= closeTime){
	if (win.closed == false) {
	    win.close();
	}
    } else {
	window.setTimeout("timer()",1000);
    }
}
// -->   
