function imgs(anchor)
{
	imgs_elem = document.getElementById('imgs_div');

	if(!imgs_elem)
	{
		imgs_elem = document.createElement('DIV');
		imgs_elem.id = 'imgs_div';
		document.getElementsByTagName('body')[0].appendChild(imgs_elem);

		imgs_elem.innerHTML = "<a href='#' id='a_close' onclick='return imgs_hide()'>zamknij</a><img id='imgs_img' onload='imgs_onload();'/><h1 id='imgs_title'></h1>";
	}

	image = document.getElementById('imgs_img');
	title = document.getElementById('imgs_title');

	if(anchor.title)
		title.innerHTML = anchor.title;
	else
		title.style.display = 'none';

	image.src = anchor.href;

	return false;
}

function imgs_onload()
{
	el = document.getElementById('imgs_div');
	image = document.getElementById('imgs_img');

	scr = get_screen_size();
	_scroll = get_scroll_xy();

	el.className = 'show';
	el.style.left = (scr.width - image.width - 10) / 2 + 'px';
	el.style.top = ((scr.height - image.height - 20) / 2 + _scroll.y) + 'px';

	return false;
}

function imgs_hide()
{
	document.getElementById('imgs_div').className = '';

	return false;
}

//inner

function get_screen_size()
{
	var winW = 0, winH = 0;

	if(self.innerWidth)
	{
		winW = self.innerWidth;
		winH = self.innerHeight;
	}
	else
		if(document.documentElement && document.documentElement.clientWidth)
		{
			winW = document.documentElement.clientWidth;
			winH = document.documentElement.clientHeight;
		}
		else
			if(document.body)
			{
				winW = document.body.clientWidth;
				winH = document.body.clientHeight;
			}

	return {width: winW, height: winH};
}

function get_scroll_xy()
{
	var scrOfX = 0, scrOfY = 0;
	if(typeof( window.pageYOffset ) == 'number' )
	{
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	}
	else
		if(document.body && (document.body.scrollLeft || document.body.scrollTop))
		{
			scrOfY = document.body.scrollTop;
			scrOfX = document.body.scrollLeft;
		}
		else
			if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
			{
				scrOfY = document.documentElement.scrollTop;
				scrOfX = document.documentElement.scrollLeft;
			}

	return {x: scrOfX, y: scrOfY};
}
