$(document).ready(function() {
     $("input.loginEmail").click(function(){
          $(this).attr("value","");
     });
     $("input.Abs01, input.Abs02, input.Abs03").click(function(){
          $(this).attr("value","");
     });
     $("input.loginPass").click(function(){
          jmeno = $(this).attr("name");
          $(this).hide();
          $("input.loginSubmit").before('<input type="password" name="'+jmeno+'" value="" class="loginPass" />');
          $("input.loginPass").focus();
     });
     
     $('a.galerie').lightBox({fixedNavigation:true});



     /* nadace, aktualita - zobrazovani 
     $("div.NadaceHome p.morelink a").click(function(){
          $(this).parent("p.morelink").next("div.aktualita").slideDown(1000);
          $(this).parent("p.morelink").hide();
     });
     $("div.NadaceHome p.hide a").click(function(){
          $(this).parent("p.hide").parent("div.aktualita").slideUp(1000, function(){
               $("p.morelink").show();
          });
     });*/


     
     /* aktuality */
     $(".newsItem .newsContent").hide();
     $(".newsItem").css({"padding-bottom":"15px","font-size":"15px"});
     $(".newsItem h1").css({"cursor":"pointer","background":"transparent","padding-left":"0px","font-size":"15px","margin-bottom":"2px"});
     $(".newsItem h1").click(function(){
          $(this).parent(".newsItem").children(".newsContent").slideToggle();
     });
     
     /* nastaveni klikací mapy */                    
    $("#kraj1").mouseover(function(){
          //alert('sdf');
          $("img.map1").show();
     });
     $("#kraj1").mouseout(function(){
          if ($("img.map1").is(".selectedMap")){
               $("img.map1").show();
          }else{
               $("img.map1").hide();
          }
     }); 
     $("#kraj2").mouseover(function(){
          $("img.map2").show();
     });
     $("#kraj2").mouseout(function(){
          if ($("img.map2").is(".selectedMap")){
               $("img.map23").show();
          }else{
               $("img.map2").hide();
          }
     }); 
     $("#kraj3").mouseover(function(){
          $("img.map3").show();
     });
     $("#kraj3").mouseout(function(){
          if ($("img.map3").is(".selectedMap")){
               $("img.map3").show();
          }else{
               $("img.map3").hide();
          }
     });      
     $("#kraj4").mouseover(function(){
          $("img.map4").show();
     });
     $("#kraj4").mouseout(function(){
          if ($("img.map4").is(".selectedMap")){
               $("img.map4").show();
          }else{
               $("img.map4").hide();
          }
     });        
     $("#kraj5").mouseover(function(){
          $("img.map5").show();
     });
     $("#kraj5").mouseout(function(){
          if ($("img.map5").is(".selectedMap")){
               $("img.map5").show();
          }else{
               $("img.map5").hide();
          }
     });          
     $("#kraj6").mouseover(function(){
          $("img.map6").show();
     });
     $("#kraj6").mouseout(function(){
          if ($("img.map6").is(".selectedMap")){
               $("img.map6").show();
          }else{
               $("img.map6").hide();
          }
     });            
     $("#kraj7").mouseover(function(){
          $("img.map7").show();
     });
     $("#kraj7").mouseout(function(){
          if ($("img.map7").is(".selectedMap")){
               $("img.map7").show();
          }else{
               $("img.map7").hide();
          }
     });               
     $("#kraj8").mouseover(function(){
          $("img.map8").show();
     });
     $("#kraj8").mouseout(function(){
          if ($("img.map8").is(".selectedMap")){
               $("img.map8").show();
          }else{
               $("img.map8").hide();
          }
     }); 
     $("#kraj9").mouseover(function(){
          $("img.map9").show();
     });
     $("#kraj9").mouseout(function(){
          if ($("img.map9").is(".selectedMap")){
               $("img.map9").show();
          }else{
               $("img.map9").hide();
          }
     });    
     $("#kraj10").mouseover(function(){
          $("img.map10").show();
     });
     $("#kraj10").mouseout(function(){
          if ($("img.map10").is(".selectedMap")){
               $("img.map10").show();
          }else{
               $("img.map10").hide();
          }
     });  
     $("#kraj11").mouseover(function(){
          $("img.map11").show();
     });
     $("#kraj11").mouseout(function(){
          if ($("img.map11").is(".selectedMap")){
               $("img.map11").show();
          }else{
               $("img.map11").hide();
          }
     });    
     $("#kraj12").mouseover(function(){
          $("img.map12").show();
     });
     $("#kraj12").mouseout(function(){
          if ($("img.map12").is(".selectedMap")){
               $("img.map12").show();
          }else{
               $("img.map12").hide();
          }
     });    
     $("#kraj13").mouseover(function(){
          $("img.map13").show();
     });
     $("#kraj13").mouseout(function(){
          if ($("img.map13").is(".selectedMap")){
               $("img.map13").show();
          }else{
               $("img.map13").hide();
          }
     });    
     $("#kraj14").mouseover(function(){
          $("img.map14").show();
     });
     $("#kraj14").mouseout(function(){
          if ($("img.map14").is(".selectedMap")){
               $("img.map14").show();
          }else{
               $("img.map14").hide();
          }
     })                  
     $("area").click(function(){
          $("img[class^='map']").hide();
          $("img[class^='map']").removeClass("selectedMap");
          aktKraj = $(this).attr("id");
          aktKraj = aktKraj.substring(4, 6);
          aktKraj = 'map'+aktKraj;                         
          $("img."+aktKraj).show();
          $("img."+aktKraj).addClass("selectedMap");
     }); 
     $("#kraj1").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.praha").show();
     });
     $("#kraj2").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.stredocesky").show();
     });
     $("#kraj3").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.jihocesky").show();
     });
     $("#kraj4").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.vysocina").show();
     });
     $("#kraj5").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.jihomoravsky").show();
     });
     $("#kraj6").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.zlinsky").show();
     });
     $("#kraj7").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.moravskoslezsky").show();
     });
     $("#kraj8").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.olomoucky").show();
     });
     $("#kraj9").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.pardubicky").show();
     });
     $("#kraj10").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.kralovehradecky").show();
     });
     $("#kraj11").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.liberecky").show();
     });
     $("#kraj12").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.ustecky").show();
     });
     $("#kraj13").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.karlovarsky").show();
     });
     $("#kraj14").click(function(){
          $("table.granty tr[class!=tHead]").hide();
          $("table.granty tr.plzensky").show();
     });
     $("div.map span.reset").click(function(){
          $("table.granty tr").show();
          $("table.granty tr.showRow").hide();
          $("img.selectedMap").hide();
     });
     
     /* granty, detail v tabulce */
     $("div.NadaceGranty table.granty tr").find("td:first").addClass("First");
     $("tr.showRow").find("td.img").find("img:eq(1)").css({'margin-left':'4px'});
     $("tr.showRow").find("td.img").css({'border-right' : 'none', 'text-align' : 'center'});
     $(".showRow").click(function(){
          $("tr.showRow").hide();
          var x = $(this).attr("id");
          $("tr."+x).show();
     });
     
     
     
     
     

     /* toggling edit profile */ 
     $("a.changepassword").click(function(){
          $("div.ProfilMenuItem").removeClass("Active");
          $("a.changepassword").parent("div.ProfilMenuItem").addClass("Active");
          $("form.personalInfo").hide();
          $("div.ProfilForm").addClass("ProfilFormPass");
          $("form.changePassword").show();
          //alert('sdf');
     });
     $("a.personalinfo").click(function(){
          $("div.ProfilMenuItem").removeClass("Active");
          $("a.personalinfo").parent("div.ProfilMenuItem").addClass("Active");
          $("form.changePassword").hide();
          $("div.ProfilForm").removeClass("ProfilFormPass");
          $("form.personalInfo").show();
          //alert('sdf');
     });

  
     /* HP, colorbar */
     $("div.HomePage div.b01").mouseover(function(){
          $("div.ColorBar").css("background","transparent url(gfx/colorBar/OSpolecnosti.png) 0px 0px no-repeat");
     });
     $("div.HomePage div.b01").mouseout(function(){
          $("div.ColorBar").css("background","none");
     });
     $("div.HomePage div.b02").mouseover(function(){
          $("div.ColorBar").css("background","transparent url(gfx/colorBar/ProNovinare.png) 107px 0px no-repeat");
     });
     $("div.HomePage div.b02").mouseout(function(){
          $("div.ColorBar").css("background","none");
     });
     $("div.HomePage div.b03").mouseover(function(){
          $("div.ColorBar").css("background","transparent url(gfx/colorBar/Zamestnani.png) 221px 0px no-repeat");
     });
     $("div.HomePage div.b03").mouseout(function(){
          $("div.ColorBar").css("background","none");
     });
     $("div.HomePage div.b04").mouseover(function(){
          $("div.ColorBar").css("background","transparent url(gfx/colorBar/SpolecenskaOdpovednost.png) 322px 0px no-repeat");
     });
     $("div.HomePage div.b04").mouseout(function(){
          $("div.ColorBar").css("background","none");
     });
     $("div.HomePage div.b05").mouseover(function(){
          $("div.ColorBar").css("background","transparent url(gfx/colorBar/Kontakt.png) 504px 0px no-repeat");
     });
     $("div.HomePage div.b05").mouseout(function(){
          $("div.ColorBar").css("background","none");
     });
     
     /* checkboxy */
     $(":checkbox").css({display:"none"}); 
     $("form.favoriteCat div").css("margin-bottom","5px");          
     $(":checkbox").wrap("<div class='checkdiv'></div>");

     $("checkbox:checked").each(function(){
          $(this).parent("div").addClass("checked");
     });     
     $("div.checkdiv").click(function(){
          if($(this).children().is(":checked")==true){
               $(this).children().removeAttr("checked");
               $(this).removeClass("checked");
          }else{
               $(this).children().attr("checked","checked");
               $(this).addClass("checked");    
          };
     });
     
     /* druha uroven menu, dropdown */
     $("div.SpolecenskaOdpovednost ul li ul li.Active ul li").each(function(){
          //alert('sdf');
          $(this).parent("ul").parent("li").children("a").each(function(){
               $(this).css("cssText", "background-image: url(gfx/leftMenuHover_SO2ActDown.png) !important"); 
          });
     });
     /* třetí uroven menu, dropdown */
     $("div.SpolecenskaOdpovednost ul li ul li.Active ul li.Active ul li").each(function(){
          //alert('sdf');
          $(this).parent("ul").parent("li").children("a").each(function(){
               $(this).css("cssText", "background-image: url(gfx/leftMenuHover_SO3ActDown.png) !important"); 
          });
     });
     
});
















