function TWindow() {
	this.handle = null
	this.unique = true
	this.url = null
	this.nome = null
	this.height = null // numero
	this.left = null // numero
	this.location =  false // yes, no
	this.menubar =  false // yes, no
	this.resizable =  false // yes, no
	this.top =  null // numero
	this.scrollbars =  null // yes, no, auto
	this.status =  false // yes, no
	this.toolbar =  false  // yes, no 
	this.width =  null // numero
	this.Locate = WinLocate
	this.Center = WinCenter
	this.Open  = WinOpen
	this.Focus = WinFocus
	this.Close = WinClose
}

function WinOpen() {
	if(this.unique && this.handle)
		this.Focus()
	else
	{
		first = true
		FeaturesStr = ''
		if (this.height) {
			FeaturesStr += 'height='
			FeaturesStr += this.height
			first = false
		}
		if (this.left) {
			if( ! first ) FeaturesStr += ','
			FeaturesStr += 'left='
			FeaturesStr += this.left
			first = false
		}
		if (this.location) {
			if( ! first ) FeaturesStr += ','
			FeaturesStr += 'location=yes'
			first = false
		}
		if (this.menubar) {
			if( ! first ) FeaturesStr += ','
			FeaturesStr += 'menubar=yes'
			FeaturesStr += this.menubar
			first = false
		}
		if (this.resizable) {
			if( ! first ) FeaturesStr += ','
			FeaturesStr += 'resizable=yes'
			first = false
		}
		if (this.top) {
			if( ! first ) FeaturesStr += ','
			FeaturesStr += 'top='
			FeaturesStr += this.top
			first = false
		}
		if (this.scrollbars) {
			if( ! first ) FeaturesStr += ','
			FeaturesStr += 'scrollbars='
			FeaturesStr += this.scrollbars 
			first = false
		}
		if (this.status) {
			if( ! first ) FeaturesStr += ','
			FeaturesStr += 'status=yes'
			first = false
		}
		if (this.toolbar) {
			if( ! first ) FeaturesStr += ','
			FeaturesStr += 'toolbar=yes'
			first = false
		}
		if (this.width) {
			if( ! first ) FeaturesStr += ','
			FeaturesStr += 'width='
			FeaturesStr += this.width
			first = false
		}
		this.handle = window.open( this.url, this.nome, FeaturesStr)
		if(!this.unique && this.handle)
			this.handle.focus()
		if(!this.nome)
			this.handle = null
	}
}

function WinLocate(left, top, width, height) {
	this.left = left
	this.top = top
	this.width = width
	this.height = height
}

function WinCenter(width, height) {
	this.left = (screen.width) ? (screen.width-width)/2 : 0;
	this.top = (screen.height) ? (screen.height-height)/2 : 0;
	this.width = width
	this.height = height
}

function WinFocus() {
	if (this.handle)
		this.handle.focus()
}

function WinClose() {
	if (this.handle)
		this.handle.close()
}
