var langVisible = false;

function languages()
{
	if (!langVisible) {
		Effect.SlideDown('Languages', {duration: 0.2});
		langVisible = true;
	} else {
		Effect.SlideUp('Languages', {duration: 0.2});
		langVisible = false;
	}
}

var Gallery = {
	loadImage: null,

	show: function(image, thumb) {
		$$('a.thumbnail.selected').each(function (node) {
			node.removeClassName("selected");
		});
		$("GalleryImageLoading").show();
		Gallery.loadImage = new Image();
		Gallery.loadImage.onload = function() {
			$("GalleryImageLoading").hide();
			$("GalleryImage").src = Gallery.loadImage.src;
		}
		Gallery.loadImage.src = image;
		$("__gt" + thumb).addClassName('selected');
	}
}

function toggleCategory(id) {
	if (!$('__cat' + id).visible()) {
		Effect.SlideDown('__cat' + id, {duration: 0.3});
	} else {
		Effect.SlideUp('__cat' + id, {duration: 0.3});
	}
}

function queryPopup(url, lang, id)
{
	var s = lang == 'pl' ? '' : '_' + lang;
	window.open(
		'index' + s + '.php?p=Query:popup&url=' + escape(url) + '&id=' + id,
		'kontakt',
		'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=1, width=480, height=340'
	);
}

/**
 * Menu
 */
var lastMenu = null;
var lastMenuTop = null;
var tm = null;
var tmt = null;

function showMenu()
{
	hideMenu();
	if (!$('TopMenuSub').visible()) {
		Effect.BlindDown('TopMenuSub', {duration: 0.3});
	}
	lastMenu = 1;
}

function hideMenu()
{
	if (lastMenu != null) {
		$('TopMenuSub').hide();
		lastMenu = null;
		if (tm != null) {
			clearTimeout(tm);
			tm = null;
		}
	}
}