function FullscreenView()
{
	this.centerVertically = true;

	this.setCenterVertically = function setCenterVertically( flag )
	{
		this.centerVertically = flag;
	}

	this.setCloseViewTooltipText = function setCloseViewTooltipText( text )
	{
		this.closeViewTooltipText = text;
	}
	
	this.displayNode = function displayNode( node )
	{
		if( body = getBodyNode() )
		{
			var div = document.createElement( "div" );
					
			div.setAttribute( "id", "FullscreenBackground" );
			div.setAttribute( "onclick", "FullscreenView.close()" );
			div.setAttribute( "title", this.closeViewTooltipText );
						
			div.style.width = getFullBodyWidth() + "px";
			div.style.height = getFullBodyHeight() + "px";
			div.style.backgroundColor = "black";
			div.style.position = "absolute";
			div.style.top = "0px";
			div.style.left = "0px";
		
			setOpacity( div, 86 );
			
			body.appendChild( div );
			
			// For IE
			eval( "div.onclick = function() { FullscreenView.close(); }" );
			
			this.backgroundNode = div;

			body.appendChild( div );
						
			{
				this.node = node;

				node.style.position = "absolute";
				node.style.display = "block";
				
				this.nodeWidth = node.clientWidth;
				this.nodeHeight = node.clientHeight;

				node.style.left = parseInt( ( getWindowWidth() - this.nodeWidth ) / 2 ) + "px";
				if( this.centerVertically ) node.style.top = ( parseInt( ( getWindowHeight() - this.nodeHeight ) / 2 ) - 40 ) + "px";

				body.appendChild( node );
			}
		}
	}
	
	this.resize = function resize()
	{
		if( this.backgroundNode )
		{
			this.backgroundNode.style.width = getFullBodyWidth() + "px";
			this.backgroundNode.style.height = getFullBodyHeight() + "px";
		}

		if( this.node )
		{
			this.node.style.left = parseInt( ( getWindowWidth() - this.nodeWidth ) / 2 ) + "px";
			if( this.centerVertically ) this.node.style.top = ( parseInt( ( getWindowHeight() - this.nodeHeight ) / 2 ) - 40 ) + "px";
		}
	}
	
	this.close = function close()
	{
		this.node.style.display = "none";

		if( body = getBodyNode() )
		{
			if( this.backgroundNode )
			{
				body.removeChild( this.backgroundNode );
			}
		}
	}
}

var FullscreenView = new FullscreenView();