/**
  * vykona sa po nacitani dokuemtu (automaticke veci, listeneri atd)
  */


$(document).ready(function(){

    // Taby    
    $('#tabs').tabs();
    
    
    // Hlavné menu (otváranie a zatváranie)
    $(".top-menu ul li").bind("mouseenter", function(event) {
        $(this).find("ul").show();
    });
    $(".top-menu ul li").bind("mouseleave", function(event) {
        $(this).find("ul").hide();
    });
    
    /*$(".top-menu>ul>li>a").click(function() {
        return false;
    });
    
    $(".top-menu>ul>li>a").css(
        {'cursor': 'default'}
    );*/
    
    //$('.gallery a').lightBox();
        
    // [START] lightbox pre obrazky, ktore su sucastou contentu
    $('.col-main img').each(function (i, e) {
    	var node = document.createElement('a');
    	var src = $(e).attr('src');

    	// ak je v URL typ small, potom lightbox bude large
    	src = src.replace('/small/','/large/');
    	
    	var cls = $(e).attr('class');
    	// set (zgrupovanie)
    	if (cls) {
    		if (cls != 'no') { // lightbox nie je povoleny
	    		$(node).attr({
	                rel: 'lightbox[' + cls + ']',
	                href: src,
	                'class': 'ltext'
	            });
    		}
    	}
    	else {	// single
    		$(node).attr({ 
                rel: 'lightbox',
                href: src,
                'class': 'ltext'
            });
    	}    	
    	$(e).wrap(node);
    });
    // standard lightbox:
    //$('.col-main a:has(img)').lightBox();
    
    // extended lightbox (podporuje set)
    $('.col-main a.ltext:has(img)').lightbox({
	    fitToScreen: true
    });
    // [END]
 
});
