// JavaScript Document
jQuery(document).ready(function(){

     Cufon.replace('div.Menu ul.firstLevel > li > a, div.Header div.Message p.message, div.Header div.Links p, p.claim01, p.claim02, p.claim03, div.MainItemHeader h1, div.MainRight div.Registration a, div.MainItem div.MainItemBody table.sliders td.td4 div a, div.Donate p, div.Donate div.LeftItemBody div.button a span, div.Donate2 div.LeftItemBody div.buttonMore a span, div.Donate2Green div.LeftItemBody div.buttonMore a span, div.Cols2b div.button a span, div.Cols2b h1, div.Donate2 p.text, div.Donate2Green div.LeftItemBody p.text, div.Rozc h2, div.Rozc div.button a span');

     /* teplomer */
     /*
          100% je 250px a je to  třeba  3 500 000 Korun
          1 % = 35 000 korun = 2,5px
          0% je 0px
          řekněme 1 000 000 korun je 28,57 %
          = 1000000/35000
          pohyb: 1% v pixelech X těch 28,57 = 71,4px
          kam odshora: 250 - 71,4 = 178,5px
     */
     var tWholePx = 162;
     var tWhole = 70000; 
     var tMove = (tWholePx-((tWholePx/100)*(tSoFar/(tWhole/100))));
     if (tSoFar <= 10000){ tMove = 135; }

     //alert(tMove);
     $("div.Teplomer .Moving span").html(tSoFar+" &euro;");
     $("div.Teplomer .Moving").animate({
          top: tMove+'px'
     }, 1500, function(){ 
          //hotovo
     });
     $("div.TeplomerEN .Moving span").html(tSoFar+" &euro;");
     $("div.TeplomerEN .Moving").animate({
          top: tMove+'px'
     }, 1500, function(){ 
          //hotovo
     });
     /* end teplomer */

     /* init */
     $("div.MainItemBody").each(function(){
          $(this).children("div.type2row:last").css("background","none");
     });
     /*$("div.Cols1All").children("div.halfItem:even").each(function(){
          $(this).addClass("halfItemLeft");
     });*/
     
     
     $('a.galerie').lightBox({fixedNavigation:true});

     /* tisk mapy */
     $("div.tiskMapy img").each(function(){
          //
     });
     $("a#Mapa").each(function(){
          mapaSrc = $("a#Mapa").attr("href");
          $("div.tiskMapa a").attr("href","/tiskMapa.php?src="+mapaSrc);
     });

     /* homepage 
     x = 1;
     $("div.Header").everyTime(10000, function(){
          $("div.Header > div.HeaderBack0"+x).fadeOut(200, function(){
               if (x==3){                    
                    $("div.Header > div.HeaderBack01, div.Header > div.HeaderBack02, div.Header > div.HeaderBack03").show(); 
                    x = 1;
               }else{
                    x++;
               }
          });
     });
*/



     /* TOP MENU */
     /* init */ 
     $("ul.secondLevel").each(function(){
          $(this).children("li:first").addClass("first"); 
          var x = $(this).parent("li").width();
          var posLeft = 150-x;
          if (posLeft<0){
               posLeft = 0;
          }
          //alert(posLeft);
          $(this).css("left","-"+posLeft+"px"); 
     });
     $("ul.thirdLevel").each(function(){
          $(this).children("li:first").addClass("first");
     });  
     
     
   
     /* dropdown */
     $("div.Menu ul.firstLevel > li").mouseover(function(){
          $(this).addClass("Hover");
          $(this).children("a").addClass("Hover");
          $(this).children("ul.secondLevel").css("visibility","visible");
     });
     $("div.Menu ul.firstLevel > li").mouseleave(function(){
          $(this).removeClass("Hover");
          $(this).children("a").removeClass("Hover");
          $(this).children("ul.secondLevel").css("visibility","hidden");
     });
     $("div.Menu ul.secondLevel > li").mouseover(function(){
          $(this).addClass("Hover2");          
     });
     $("div.Menu ul.secondLevel > li").mouseleave(function(){
          $(this).removeClass("Hover2");
     });     
     $("div.Menu ul.secondLevel > li").mouseover(function(){
          $(this).children("ul.thirdLevel").css("visibility","visible");
     });     
     $("div.Menu ul.secondLevel > li").mouseleave(function(){
          $(this).children("ul.thirdLevel").css("visibility","hidden");
     });
     $("div.Menu ul.thirdLevel > li").mouseover(function(){
          $(this).addClass("Hover2");          
     });
     $("div.Menu ul.thirdLevel > li").mouseleave(function(){
          $(this).removeClass("Hover2");
     }); 
     /* */
     $("ul.thirdLevel").each(function(){          
          var x = $(this).parent("li").height();
          $(this).css("top","0px");
     });
     


    
     
     

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
});



