

/**************************************
* Wrapper for Window 
***************************************/
function CWnd()
{
	this[CWnd.HEIGHT]      = 650;
	this[CWnd.WIDTH]       = 600;
	this[CWnd.LEFT]        = -1;
	this[CWnd.TOP]         = -1; 
	
	this[CWnd.CHANELMODE]  = "No";
	this[CWnd.DIRECTORIES] = "No";
	this[CWnd.FULLSCREEN]  = "No";
	this[CWnd.LOCATION]    = "No";
	this[CWnd.MENUBAR]     = "No";
	this[CWnd.TOOLBAR]     = "No";

	this[CWnd.RESIZABLE] = "Yes";
	this[CWnd.STATUS]    = "No";
	this[CWnd.SCROLLBARS]= "Yes";
		
	this.getFeatures = function ()
	{
		var features = [];
		var i = 0;
		features[i++] = CWnd.HEIGHT    + "=" + this[CWnd.HEIGHT]   + "px,";
		features[i++] = CWnd.WIDTH     + "=" + this[CWnd.WIDTH]    + "px,";


		features[i++] = CWnd.LEFT    + "=" + (this[CWnd.LEFT]== -1 ? (screen.width - this[CWnd.WIDTH])/2 : this[CWnd.LEFT]) + ",";
		features[i++] = CWnd.TOP     + "=" + (this[CWnd.TOP]== -1 ? (screen.height - this[CWnd.HEIGHT])/2 : this[CWnd.TOP]) + ",";
		
		
		features[i++] = CWnd.CHANELMODE  + "=" + this[CWnd.CHANELMODE] + ",";
		features[i++] = CWnd.DIRECTORIES + "=" + this[CWnd.DIRECTORIES]+ ",";
		features[i++] = CWnd.FULLSCREEN  + "=" + this[CWnd.FULLSCREEN] + ",";
		features[i++] = CWnd.LOCATION    + "=" + this[CWnd.LOCATION]   + ",";
		features[i++] = CWnd.MENUBAR     + "=" + this[CWnd.MENUBAR]    + ",";
		features[i++] = CWnd.TOOLBAR     + "=" + this[CWnd.TOOLBAR]    + ",";
		features[i++] = CWnd.RESIZABLE   + "=" + this[CWnd.RESIZABLE]  + ",";
		features[i++] = CWnd.STATUS      + "=" + this[CWnd.STATUS]     + ",";
		features[i++] = CWnd.SCROLLBARS  + "=" + this[CWnd.SCROLLBARS] + "";
		return features.join("");
	};
	this.wnd = null;
	this.open = function(path,name,features)
	{
		var undef;
		var tmpfeatures = "";

		if(features != undef) { tmpfeatures = features;} 
		else { tmpfeatures = this.getFeatures();}
		
		if(this.wnd && !this.closed) {
			try{this.wnd.close();}catch(e){}
		}

		this.wnd = window.open(path,name,tmpfeatures);
		return this.wnd;
	};
}

CWnd.HEIGHT      = "height";
CWnd.WIDTH       = "width";
CWnd.LEFT        = "left";
CWnd.TOP         = "top";
CWnd.CHANELMODE  = "channelmode";
CWnd.DIRECTORIES = "directories";
CWnd.FULLSCREEN  = "fullscreen";
CWnd.LOCATION    = "location";
CWnd.MENUBAR     = "menubar";
CWnd.TOOLBAR     = "toolbar";
CWnd.SCROLLBARS  = "scrollbars";
CWnd.STATUS      = "status";
CWnd.RESIZABLE   = "resizable";


function show(id)
{
	var wnd = new CWnd();
	wnd.open("preview.php?id="+id)
}

