/* funkce, ktera jednak vypise mail pres JS, cimz blokne boty a jednak pouzije entity, cimz je to jeste lepsi :) */
function js_protect_email(var1,var2)
{
    var zavinac = "&#64;";
    var mailto = "mai&#108;&#116;&#111;&#58;";
    var e_mail = var1+zavinac+var2;
    var title = "title='"+e_mail+"'";

    document.write("<a class='email' href='"+mailto+e_mail+"'"+title+">"+e_mail+"</a>");
}

$(document).ready(function() {

	//Cufon.replace('#leftCol a.main', { fontFamily: 'Myriad Pro Regular', hover: true });

    vyska = $("#leftCol").height();
    $("#bckImgDiv").height(vyska);

 
      /* dhtml banner */
    var changer = $('div.changer');

    if(changer.length) {
        var dur = 5000;
        var lis = changer.find('img');
        var go = false;

        if(lis.length > 1) {
            lis.hide().eq(0).show();

            changer.data('index', 0);
            changer.data('timeout', null);

    
            function setChanger(){
                if(go) {
                    var index = changer.data('index');
                    var cur = lis.eq(index);
                    var next = null;

                    if(index == lis.length - 1) {
                        next = lis.eq(0);
                        changer.data('index', 0);
                    } else {
                        next = lis.eq(index + 1);
                        changer.data('index', ++index);
                    }

                    cur.fadeOut();
                    next.fadeIn();
                }

                changer.data('timeout', window.setTimeout(setChanger, dur));
                go = true;
            };

            setChanger();
        }
    }
    
    



	 
});


$(window).load(function () {
   /* $('div.gridGal').imageGrid(554, 'a', 'galpic'); */
   $("#oplzz").delay(10000).fadeOut();
   
   
   var sirkapohybuHotnews = $("#hotnews").width() - 29;
   
   /* animace akcniho buttonu */
    $("#hotnewsToggle").toggle( function(event) {
        event.preventDefault();             
        
         $("#hotnews").animate({
            'left': '+='+sirkapohybuHotnews
            }, 1000            
        );   
      }, function() {        
        $("#hotnews").animate({
            'left': '-='+sirkapohybuHotnews
            }, 1000            
        );       
      }
    );
    
    if ($("#hotnews.homepage").length) {
        $("#hotnews").show();
        $("#hotnews").delay(5000).animate({
            'left': '-='+sirkapohybuHotnews
            }, 1000            
        ); 
    } else {        
        $("#hotnews").css( 'left' , function(current) { return current - sirkapohybuHotnews+'px' });
        $("#hotnews").show();
        
    }   
    
    
    /* zobrazeni a schovani bloku textu v katalogu */
    $("a.showHiddenText").click( function(event) {
        event.preventDefault();
        $("#" + $(this).attr('href') ).toggle();
    });
    $("a.closeHiddenText").click( function(event) {
        event.preventDefault();
        $("#" + $(this).attr('href') ).hide();
    });
    
    
    
});



