FSite2.Layer = function(className, hidden, id)     //Tworzy nowa warstwe (idobiektu, klasaobiektu (obrazek preloadera), ukrywanie obiektu (text preloadera))
{
	this.object = document.createElement('div');
	if (className)
		this.object.className = className;
	if (id)
		this.object.id=id;
	if (hidden)
		this.hide();
	this.object.style.position = 'absolute';
	this.object.style.left = '0px';
	this.object.style.top = '0px';
	document.body.appendChild(this.object);
}

// Powiększenie warstwy na cały rozmiar zawartości okna
FSite2.Layer.prototype.fullScreen = function()
{
	this.object.style.width = getContentWidth() + 'px';
	this.object.style.height = getContentHeight() + 'px';
	this.object.style.left = '0px';
	this.object.style.top = '0px';
}

// Wysrodkowanie wartsty
FSite2.Layer.prototype.center = function()
{
	this.object.style.left = getScrollX() + Math.round((getWindowWidth() - getObjectWidth(this.object)) / 2) + 'px';
	this.object.style.top = getScrollY() + Math.round((getWindowHeight() - getObjectHeight(this.object)) / 2) + 'px';
}

FSite2.Layer.prototype.remove = function()
{
	this.object.parentNode.removeChild(this.object);
}

FSite2.Layer.prototype.show = function()
{
	this.object.style.display = 'block';
	this.center();
	this.object.style.visibility = 'visible';
}

FSite2.Layer.prototype.hide = function()
{
	this.object.style.display = 'none';
	this.object.style.visibility = 'hidden';
}

