
TVentana.prototype.Ancho         = 550;
TVentana.prototype.Alto          = 400;
TVentana.prototype.Centrar       = true;
TVentana.prototype.CentrarTop    = false;
TVentana.prototype.Dependiente   = false;
TVentana.prototype.FullScreen    = false;
TVentana.prototype.Handle        = null;
TVentana.prototype.Menu          = false;
TVentana.prototype.Nombre        = "";
TVentana.prototype.ScrollBars    = true;
TVentana.prototype.Status        = false;
TVentana.prototype.SiempreTop    = false;
TVentana.prototype.Redimensionar = false;
TVentana.prototype.Top           = -1;
TVentana.prototype.URL           = "";
TVentana.prototype.ZLock         = false;


TVentana.prototype.Close = function ()
{
	this.Handle.close ();
}


TVentana.prototype._Dimensiones = function ()
{
	var Result = '';
	var nLeft;
	var nTop;
	
	if (this.FullScreen)
		Result = "width=" + (screen.availWidth - 10) + ",height=" + (screen.availHeight - 10) + ",top=0,left=0";
	else
	{	Result = "width=" + this.Ancho + ",height=" + this.Alto;
		if (this.CentrarTop)
		{	nLeft  = parseInt((screen.availWidth - this.Ancho) / 2);
			nTop   = 0;
			Result += ",top=" + nTop + ",left=" + nLeft;
		} else if (this.Centrar)
		{	nLeft  = parseInt((screen.availWidth - this.Ancho) / 2);
			nTop   = parseInt((screen.availHeight - this.Alto) / 2);
			Result += ",top=" + nTop + ",left=" + nLeft;
		} else if (this.Top >= 0) Result += ",top=" + this.Top;
	}
	return (Result);
}


TVentana.prototype.Focus = function ()
{
	this.Handle.focus ();
}


TVentana.prototype.focus = function () // No usar
{
	this.Handle.focus ();
}


TVentana.prototype.Reload = function (URL)
{
	if (this.Handle)
	{	this.Handle.location.reload (URL);
		this.Handle.focus ();
	}
}


TVentana.prototype.Open = function (DarFoco)
{
	var Propiedades = "";

	if (typeof DarFoco == 'undefined') DarFoco = false;
	
	Propiedades = this._Dimensiones ();

	if (this.Menu) Propiedades += ',menubar=yes,titlebar=yes,toolbar=yes,location=yes,status=yes,resizable=yes';
	if (this.ScrollBars) Propiedades += ",scrollbars=yes";
	if (this.Dependiente) Propiedades += ',dependent=yes';
	if (this.SiempreTop) Propiedades += ',alwaysRaised=yes';
	if (this.Status) Propiedades += ",status=yes";
	if (this.Redimensionar) Propiedades += ',resizable=yes';
	if (this.ZLock) Propiedades += ',z-lock=yes';
	this.Handle = window.open (this.URL, this.Nombre, Propiedades);
  if (DarFoco && this.Handle != null ) this.Handle.focus (); 
};


TVentana.prototype.SetTop = function (nTop)
{
	this.Centrar = false;
	this.Top     = nTop;
}


function TVentana ()
{
}

