// JavaScript Document

/**************  pocitadlo znaku **************/
function pocitadlo(e, max_count, kam) {
 
      			if(e.value.length > max_count)
      			{
      				e.value = e.value.substr(0, max_count);
      				alert('Počet ' + max_count + ' znaků byl překročen');
      				return;
      			}
      			e_counter = document.getElementById('pocitadlo'+kam);
 
      			remain = max_count - e.value.length;
      			e_counter.innerHTML = remain;
      			return;
};



 $(document).ready(function(){
 
/**************  barevny hover **************/

        var aobr = $("div.aobr").text() - 1;
        //alert(aobr);
        
        if ( aobr == "" ){}
        
        else { 
              if( aobr > "6" )
              {
                $('div.gall img:eq(' + aobr + ')').css("display","inline");
              }
              else
              {
                $('div.gall img:eq(' + aobr + ')').css("display","inline"); 
              };
            };
                                     
        $('div.gall').hover(
        function() {
          $(this).find('img').stop(true, true).fadeIn(500);
        }, function() {
          $(this).find('img').stop(true, true).fadeOut(500);
          }
        );
        
        //$('div.gall img:eq(4)').css("display","inline");
        
/************** submenu **************/ 
   /*       
        $('.polozka-menu.reference').hover(
        function() {
          $(this).find('.submenuRef').stop(true, true).slideDown(500);
        }, function() {
        $(this).find('.submenuRef').stop(true, true).slideUp(500);
          }
        );
    */    

 
 
/************** reference v1 **************/ 
/*var maxref = 4;
var i;

  for(i = 1; i <= maxref; i++){
   
    $("#ref" + i ).bind("mouseenter", { "myId": i }, function( event){
    $("#napis-ref"  + event.data.myId).slideToggle(400);
});

    $("#ref" + i ).bind("mouseleave", { "myId": i }, function( event){
    $("#napis-ref"  + event.data.myId).slideToggle(400);
});  
}; 
*/

/**************  reference v2 **************/ 
       $(".reference").hover(
     function() {
      $(this).find(".napis-ref").stop(true, true).delay(650).slideUp(400);
      
        /* if ($(this).find(".infoblock")) {
            $(this).find(".infoblock").stop(true, true).delay(650).slideUp(400);
          };*/
      
      
    },function() {
      $(this).find(".napis-ref").stop(true, true).delay(350).slideDown(400);
      
         /*if ($(this).find(".infoblock")) {
            $(this).find(".infoblock").stop(true, true).delay(350).slideDown(400);
          };  */
      
      }
     );
   
 /************ efekt menu ********************/
                   
         var str = $(".astranka").text();          
         //alert(str);
                   
         if (str == "uvod" ) { $("#efekt-menu").css("top","-176px") ;} //-210
         //else if (str == "webdesign" ) { $("#efekt-menu").css("top","-176px") ;}
         //else if (str == "grafika" ) { $("#efekt-menu").css("top","-141px") ;} 
         else if (str == "reference" ) { $("#efekt-menu").css("top","-141px") ;}
         else if (str == "foceni" ) { $("#efekt-menu").css("top","-105px") ;}
         else if (str == "bio" ) { $("#efekt-menu").css("top","-70px") ;}
         else if (str == "kontakt" ) { $("#efekt-menu").css("top","-34px") ;}
         else { $("#efekt-menu").css("display","none") ;};
         
         
         
 /***** submenu **************/
       
                        
        $(".lob-link").live("click",function(){   
            kolikaty = $(this).index();
            kolikaty = kolikaty  - 1;
            //alert(kolikaty);
            if ( $(this).hasClass("open") ){
            }
            else{
                 $(this).siblings().removeClass("open");
                 $(this).addClass("open");
                 $(".lob-content").css("display","none");
                 $(".lob-content:eq("+ kolikaty + ")").css("display","block");
                };       
               });
               
               
                             
/******* ight Box **************/

       $(function() {
                                                
            $('#gallery  a').lightBox();
                        
       });        
                             

 /************** document ready END ********** ^[a-zA-Z0-9.-_]+[@]{1,1}[a-z]+[.]{1,1}[a-z]{2,4}$ */
 });    

