// Functions to open sub-window and size it.
// Notes: http://scriptasylum.com/tutorials/openwindows.html
// Position defaults to center.

function openWindow(url,w,h,tb,stb,l,mb,sb,rs){
// Calculate center
var x;
var y;
//half the screen width minus half the new window width (plus 5 pixel borders).
x = (window.screen.width/2) - ((w/2) + 10);
//half the screen height minus half the new window height (plus title and status bars).
y = (window.screen.height/2) - ((h/2) + 40);

var t=(document.layers)? ',screenX='+x+',screenY='+y: ',left='+x+',top='+y; //A LITTLE CROSS-BROWSER CODE FOR WINDOW POSITIONING
tb=(tb)?'yes':'no';
stb=(stb)?'yes':'no';
l=(l)?'yes':'no';
mb=(mb)?'yes':'no';
sb=(sb)?'yes':'no';
rs=(rs)?'yes':'no';

var x=window.open(url, 'newWin'+new Date().getTime(), 'scrollbars='+sb+',width='+w+',height='+h+',toolbar='+tb+',status='+stb+',menubar='+mb+',links='+l+',resizable='+rs+t);
x.focus();
}

// These call openWindow with bare minumum parameters:
// url,width,height

// Menus and bars are ON.  Scrollbars ON.  Resize ON.
function openWin(url,w,h) { openWindow(url,w,h,1,1,1,1,1,1); }

// Menus and bars are OFF.  Scrollbars OFF.  Resize ON.
function openWinbare(url,w,h) { openWindow(url,w,h,0,0,0,0,0,1); }

// Menus and bars are OFF.  Scrollbars ON.  Resize OFF.
function openWinscroll(url,w,h) { openWindow(url,w,h,0,0,0,0,1,0); }
