//
// Default Javascript functions
//
// I should cycle through these a bit as I suspect many of the functions
// can be optimized, or at least the code size optimized.  As I also cycle
// through the main pages, I can improve these as well.
//

//
// Brings the current window on top of others
// This function seems to not always work.
function stayontop() {
        window.focus();
        setTimeout("stayontop()", 10);//1000=1sec. Adjust seconds here
}

//
// Opens a new popup and puts it on top.
// Args:
//   url:    URL to open
//   targ:   Target name
//   opts:   Window Options (size, location, etc)
//           Passed as a string
function openpopup(url, targ, opts) {
	popup = window.open(url, targ, opts, replace=1);
	if (window.focus) {
		popup.focus();
	}
}

//
// Opens a help popup.
// The default sizes are defined here, and passed to openpopup.
// Args:
//   url:    URL that will be opened.
//   h:      Height of new box
//   w:      Width of new box
//
function help_popup(url, w, h) {
	opts = 'height=' + h + ', width=' + w + ', toolbar=0, menubar=0,';
	opts = opts + 'scrollbars=1, hotkeys=0, status=0, ';
	opts = opts + 'directories=0, dependant=1, resizeable=1, ';
	opts = opts + 'alwaysRaised=1';
	openpopup(url, 'help', opts);
}

//
// Opens a new browser window
// The default sizes are defined here, and passed to openpopup.
// Args:
//   url:    URL that will be opened.
//   h:      Height of new box
//   w:      Width of new box
//
function newwindow(url, w, h) {
	opts = 'height=' + h + ', width=' + w;
	openpopup(url, 'new', opts);
}
