MM_kryj = 0;
MM_id = 0;

function MM_Menu(element)
{
	i = 1;
	MM_kryj = 1;
	while (e = document.getElementById("m" + i++))
	e.style.display = "none";
	document.getElementById(element).style.display = "block";
}

function MM_Koniec()
{
	clearTimeout(MM_id);
	MM_kryj=0;
	MM_id = setTimeout(MM_Ukryj, 500)
}

function MM_Ukryj()
{
	if (MM_kryj==0)
	{
		i = 1;
		while (e = document.getElementById("m" + i++))
		e.style.display = "none";
	}
}

function SzerokoscEkranu ()
{
	return screen.width;
}

function WysokoscEkranu ()
{
	return screen.height;
}

function SzerokoscOkna ()
{
	var w = 0;
	if (typeof(window.innerWidth)=='number')
	{
		w = window.innerWidth;
	}
	else
	{
		if(document.documentElement && document.documentElement.clientWidth)
		{
			w = document.documentElement.clientWidth;
		}
		else
		{
			if(document.body && document.body.clientWidth)
			{
				w = document.body.clientWidth;
			}
		}
	}
	return w;
}

function WysokoscOkna ()
{
	var h = 0;
	if (typeof(window.innerHeight)=='number')
	{
		h = window.innerHeight;
	}
	else
	{
		if(document.documentElement && document.documentElement.clientHeight)
		{
			h = document.documentElement.clientHeight;
		}
		else
		{
			if(document.body && document.body.clientHeight)
			{
				h = document.body.clientHeight;
			}
		}
	}
	return h;
}

function GetPosition (element) //Funkcja zwraca współrzędne elementu
{
	if (element.offsetParent)
	{
		for(var px = py = 0; element.offsetParent; element = element.offsetParent)
		{
			px += element.offsetLeft;
			py += element.offsetTop;
		}
		return [px, py];
	}
	else
	{
		return [element.x, element.y];
	}
}

var MouseX = 0;
var MouseY = 0;

var WeekHandlerWidth = 0;
var WeekHandlerVisibleWidth = 0;

function MS_Move ()
{
	MouseX = event.clientX + document.body.scrollLeft;
	MouseY = event.clientY + document.body.scrollTop;
}

function WS_MouseMove (X) //Funkcja przesuwająca zajawki weekendowe
{
	if (WeekHandlerVisibleWidth < WeekHandlerWidth)
	{
		stosunek = X / WeekHandlerVisibleWidth;
		pozycja = 0 - ((WeekHandlerWidth - WeekHandlerVisibleWidth) * stosunek)
		//alert (X + " / " + WeekHandlerWidth + " / " + WeekHandlerVisibleWidth + " / " + stosunek + " / " + pozycja);
		document.getElementById ("WeekHandler").style.left = 15 + pozycja + "px";
	}
}
