
bbcjs.trace('<b><font color="green">jst_win.js</font> was included.</b>',2);
bbcjs.win =
{
version		: 0.1,
numWindows	: 0
}
//Window constructor. Is basically META info for what will be a window eventually...
bbcjs.win.Window = function (url,width,height)
{
this.url = url;
this.features = {
width : width,
height : height,
location : 'no',
scrollbars : 'yes',
fullscreen : 'no',
status : 'yes',
menubar : 'no',
toolbar : 'no',
directories : 'no',
resizable : 'yes'
};
bbcjs.win.numWindows++;
this.name = 'popwin_'+(bbcjs.win.numWindows);
this.replace = false;
this.open = bbcjs.win.open;
this.openWindow = false;
}
//Open window function, takes in either parameters, or called via Window object...
bbcjs.win.open = function(url,width,height)
{
var win, featstr, t;
bbcjs.trace("Window open function called...",3);
//If this is an instance of a bbcjs.win.Window, use "this"...
if (typeof(this.url)!="undefined") t = this;
else t = new bbcjs.win.Window(url,width,height);
//temporarily allows changing of popup url (doesn't change object);
if (typeof(url)=="undefined") url = t.url;
//Our features string (eg toolbar=yes etc)...
featstr = "";
//Build up args from all "feature" object elements
for (var i in t.features)
{
featstr += i+"="+t.features[i]+",";
}
featstr = featstr.substring(0,featstr.length-1);
//Trace statements...
bbcjs.trace("Feature String is: <br /><b>"+featstr+"</b>",4);
bbcjs.trace("Opening new window for:<br />&nbsp;&nbsp;&nbsp;"+t.url,3);
bbcjs.trace("&nbsp;&nbsp;&nbsp;Window name is: <b>"+t.name+"</b>",4);
bbcjs.trace("Full window.open command:<br />window.open('"+t.url+"', '"+t.name+"', '"+featstr+"', "+t.replace+")",5);
//Open the window, and bring to front.
win = window.open(url, t.name, featstr, t.replace);
win.focus();
//Set a reference to be the window we just opened. Useful for reusing windows...
t.openWindow = win;
return win;
}

