<!--

var titleX  = {

	dvName : "TitleLayer",
	cssClass : "titleBox",
	
	closeIntId : null,
	isOpen : false,

	closeWaitMs : 100,
		
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	
	show : function(str)
	{
		this.addLayer();
		$("div#"+this.dvName).html(str);
	},
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	
	hide : function()
	{
		this.closeLayer();
	},
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	
	addLayer : function()
	{
		this.noCloseLayer();
		
		if(!this.isOpen)
		{
			var that = this;
			var d = $("body").append('<div id="'+this.dvName+'" class="'+this.cssClass+'"></div>');

			$("div#"+this.dvName).css("position", "absolute");
			$("div#"+this.dvName).css("z-index", "1000");
			this.zmieniaj();
	
			$(document).mousemove(function(){that.zmieniaj()});

			$("div#"+this.dvName).mouseover(function(){that.noCloseLayer()});
			$("div#"+this.dvName).mouseleave(function(){that.closeLayer()});
			this.isOpen = true;
		}
	},
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	
	zmieniaj : function()
	{
		$("div#"+this.dvName).css({left : (page.XmousePosition)+"px", top : (page.YmousePosition - $("div#"+this.dvName).outerHeight()-10)+"px"});
	},
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	/*
	przesun : function()
	{
		var ps = $("div#"+this.dvName).position();
		var ew = $("div#"+this.dvName).outerWidth();
		var eh = $("div#"+this.dvName).outerHeight();
		var docw = $(window).width();
		var doch = $(window).height();

		if(ps.left + ew > docw || ps.top + eh > doch)
		{
			var obj = {};

			if(ps.left + ew > docw)
				obj.left = docw-ew-50+$(window).scrollLeft();

			if(ps.top + eh > doch)
				obj.top = doch-eh-50+$(window).scrollTop();
		
			$("div#"+this.dvName).animate(obj);
		}
	},
	*/
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	
	noCloseLayer : function()
	{
		clearTimeout(this.closeIntId);
	},
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	
	closeLayer : function(now)
	{
		var that = this;
		
		if(now)
		{
			$("div#"+this.dvName).fadeOut(150, function(){$("div#"+that.dvName).remove();});
			$(document).unbind("mousemove", function(){that.zmieniaj()});
			this.nazwa = "";
			this.isOpen = false;
			clearTimeout(this.closeIntId);
		}
		else
			this.closeIntId = setTimeout(function(){that.closeLayer(true);}, this.closeWaitMs);
	}
};

//-->
