/* nospam */
function nospamf(box, domain) {
 if(typeof(domain)=="undefined") domain="detex.cz";
 var proto=String.fromCharCode(109,97,105,108,116,111,58)
 w=window.open(proto+box+String.fromCharCode(64)+domain);
 if (w!=null) w.close(); //FF
}
function nospam(box, domain, attr) {
 if(typeof(domain)=="undefined") domain="detex.cz";
 if(typeof(attr)=="undefined") attr="";
 document.write("<a href=\"javascript:nospamf('"+box+"', '"+domain+"')\""+(attr.length>0?" ":"")+attr+">"+box+String.fromCharCode(64)+domain+"</a>");
}
function zavinac() {
 document.write(String.fromCharCode(64));
}
/* /nospam */

/* accordion collapsible menu */
window.activeI = 0;

function initMenus() {
	$('ul.menu ul').hide();
	$.each($('ul.menu'), function(){
	});
	
    var rozbal = function () {
        var item = $(this).find('ul');
        if (item) {
            //item.slideDown('normal');
            item.show();
            $(this).addClass('active');
        }

    };
    $.each($('.current-cat'),rozbal);
    $.each($('.current-cat-parent'),rozbal);

	$('ul.menu li a').click(
		function() {
            var actual = $(this).attr('ident');
            var isActive = $(this).parent().hasClass('active');
            if (typeof actual == 'undefined' && !isActive) {
                $(this).attr('ident', actual = (new Date()).getTime()*Math.random());
            } else if (window.activeI == actual || isActive) {window.top.location = $(this).attr('href');}
            window.activeI = actual;
            var f = function () {
                $(this).removeClass('active');
                $(this).removeClass('current-cat-parent');
            };
            var par = $(this).parent().parent();
            par.children().each(f);
            //par.parent().children().each(f);
            $(this).parent().addClass('active'); // ZMENA
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;
			if($('#' + parent).hasClass('noaccordion')) {
				if((String(parent).length > 0) && (String(this.className).length > 0)) {
					if($(this).next().is(':visible')) {
						//$.cookie(parent, null);
					}
					else {
						//$.cookie(parent, this.className);
					}
					$(this).next().slideToggle('normal');
				}				
			}
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					$('#' + parent + ' ul:visible').slideUp('normal');
				}
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#' + parent + ' ul:visible').slideUp('normal');
				if((String(parent).length > 0) && (String(this.className).length > 0)) {
					//$.cookie(parent, this.className);
				}
				checkElement.slideDown('normal');
				return false;
			}
		}
	);
}

$(document).ready(function() {initMenus();});

/* /accordion collapsible menu */

/* lightbox */

$(document).ready(function() {
	//$('p.p-fotografie a').lightBox();
	//$('div.gallery a').lightBox();
	//$('div.detail-pojem a').lightBox();
	$("a[href$='.jpg']").lightBox();
	$("a[href$='.JPG']").lightBox();
	$("a[href$='.gif']").lightBox();
	$("a[href$='.png']").lightBox();
	$("a[href$='.jpeg']").lightBox();
	$("a[href$='.JPEG']").lightBox();
	// $('a[rel*=lightbox]').lightBox();
	// $('a').lightBox();
});
/* /lightbox */
