
	var itemHot = '';
	var timer1 = timer2 = 0;

	$('outline02').observe('mouseover', function(event) {
		event.stop();

		if($('inline_overlay02').getOpacity() != 0.0) return;
		$('inline_overlay02').setOpacity(0.9);
		$('inline_overlay03').setOpacity(0.0);
	});

	$('outln02').observe('mouseout', function(event) {
		event.stop();

		timer1 = setTimeout(function() {
			$('inline_overlay02').setOpacity(0.0);
			}, 1000);

	});

	$('outline03').observe('mouseover', function(event) {
		event.stop();

		if($('inline_overlay03').getOpacity() != 0.0) return;
		$('inline_overlay03').setOpacity(0.9);
		$('inline_overlay02').setOpacity(0.0);
	});

	$('outln03').observe('mouseout', function(event) {
		event.stop();
		
		timer2 = setTimeout(function() {
			$('inline_overlay03').setOpacity(0.0);
			}, 1000);
	});

	$('outline02').observe('mousemove', function(event) {
		event.stop();

		if(itemHot != '' && $(itemHot))
		{
			$(itemHot).style.zIndex = '1';
			itemHot = '';
		}

		clearTimeout(timer1);

		xy = $('outline02').positionedOffset();

		var x = Event.pointerX(event) - 100;//- xy.left;
		var y = Event.pointerY(event) - xy.top;

		y = Math.floor(y/46);
		x = Math.floor(x/180);

		itemHot = 'outln02_item_' + x + '-' + y;

		if($(itemHot)) $(itemHot).style.zIndex = '500';
	});

	$('outline03').observe('mousemove', function(event) {
		event.stop();

		if(itemHot != '' && $(itemHot))
		{
			$(itemHot).style.zIndex = '1';
			itemHot = '';
		}

		clearTimeout(timer2);

		xy = $('outline03').positionedOffset();

		var x = Event.pointerX(event) - 100;//- xy.left;
		var y = Event.pointerY(event) - xy.top;

		y = Math.floor(y/46);
		x = Math.floor(x/180);

		itemHot = 'outln03_item_' + x + '-' + y;

		if($(itemHot)) $(itemHot).style.zIndex = '500';
	});

	function Items()
	{
		this.data = 0;
		this.length = 0;
	}

	function itemsFetch()
	{
		new Ajax.Request('/item_fetch.php',{
				method: 'get',
				parameters: '',
				contentType: 'text/xml',
				onSuccess: function (transport) {itemsFetchOnComplete(transport.responseXML);}});
	}

	function itemsFetchOnComplete(responseXML)
	{
		items = new Items();
		items.data = responseXML.getElementsByTagName('item');
		items.length = items.data.length;

		itemsOut(items,1,"outln02",outlines["outln02"]);
		itemsOut(items,2,"outln03",outlines["outln03"]);
	}

	function itemsOut(items,media,id,outline)
	{
		x = 0;
		y = 0;
		x_prv = 0;

		var mediaMatch = new Array();

		mediaMatch["Movie"] = 1;
		mediaMatch["Gfx"] = 1;
		mediaMatch["Photo"] = 2;

		if(outline.cnt)
		{
			for(i=0,j=0;i<outline.cnt;j++)
			{
				var item = items.data.item(j);

				item_media = item.getAttribute("media");

				if(mediaMatch[item_media] != media) continue;

				item_thumb_path = item.firstChild.getAttribute("path");

				childs = item.childNodes;
				medium_path = new Array();

				for(k=1;k<childs.length;k++)
				{
					child = childs.item(k);

					medium_path[k-1] = child.getAttribute("path");
				}

				params = new Array();
				params[0] = '' + x + '-' + y;
				params[1] = medium_path[0];
				params[2] = item_media;

				new ImagePreloader(item_thumb_path, params, function(image, params)
					{
						if(params[2] == "Movie")
						{
							label = "<div class = 'label'></div>";
							player = "player=qt;";
							size = "width=640;height=480;";
						}
						else
						{
							label = "";
							player = "player=img;";
							size = "";
						}

						item = id + '_item_' + params[0];

						$(id + '_' + params[0]).innerHTML = '<div style = \"position: relative;\" id = \"' + item + '\"><a href = \"' + params[1] + '\" class = \"item\" rel = \"shadowbox;' + size + player + '\"><img src=\"' + image.src + '\" alt=\"\"></a>' + label + '</div>';
						Shadowbox.setup("");
					});

				x++;
				i++;

				if(x >= 3 && outline.cnt-i <= 2 && y == outline.rows-2)
				{
					x_prv = x;
					x = 0; y++;
					continue;				
				}

				if(x == 5 && x == x_prv)
				{
					x_prv = x-1;
					x = 0; y++;
					continue;
				}

				if(x > 2)
				{
					if(Math.random() < 0.15)
					{
						x_prv = x-1;
						x = 0; y++;
						continue;
					}
				}

				if(x == 6) {y++; x_prv = x-1; x = 0;}
			}

		}
	}