


function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};



jQuery(document).ready(function(){ 

    jQuery('#customers-inner').jcarousel({
        auto: 3,  
        scroll: 3,
        animation: 1500,  
        wrap: 'circular',
        initCallback: mycarousel_initCallback
    });


jQuery('#ch_lan .form_select').hover( function(){
   jQuery("strong",this).toggleClass("hovered").next("div").slideToggle();   
});


		jQuery('#banner-inner').innerfade({
				speed: 'slow',
				timeout: 20000,
				type: 'sequence'
			});



   jQuery('#kariera .item .kariera-button').click( function(){        
        jQuery(this).toggleClass("active").next(".form").toggle();
   });
   jQuery('#kariera .item .button.gray').click( function(){        
        jQuery(this).parents(".item").find(".kariera-button").toggleClass("active").next(".form").toggle();
   });  

        
     

              
 
//   jQuery(".pika-stage a").lightBox();          
  jQuery("a.lightbox").lightBox();

 
   // LAYOUT WIDTH
   var layout_width = jQuery("#layout-width").innerWidth(); 
   jQuery("input.layout_width").attr("value",layout_width);
 
  
jQuery('a').filter(function () {
return this.hostname && this.hostname !== location.hostname;
}).addClass('external');   

jQuery('a.external').attr("onclick","return !window.open(this.href)");  
   
   
   
   
// MESSAGE FORM   
jQuery("#openMessageForm").click(function() {
  jQuery("#messageForm").toggle();  
});  
jQuery("#messageForm #close").click(function() {
  jQuery("#messageForm").hide(); 
}); 
 
 
 
    
    var default_text = "Váš@email";
    var default_textarea = "Vaše zpráva..";    
  // jQuery("#messageForm input:text").attr("value",default_text);
   jQuery("#messageForm textarea").text(default_textarea); 
   
   
   

  // input:text a textarea nastavovani hodnoty po kliku - styled forms 
   jQuery("#messageForm textarea").focus( function(){  // po kliknuti na policko       
        jQuery(this).addClass("focused");

        var input = jQuery(this).val();  // zjisteni Hlasky  
     
        
         if( default_textarea == input ){  // je li zaloha prazdna - cyklus jde poprve

              this.value = "";   
              jQuery(this).val("");  // policko se vymaze         
         }         
   });     
     
   jQuery("#messageForm textarea").blur( function(){    // po opuštění políčka
        jQuery(this).removeClass("focused");
        var hlaska = jQuery(this).val();  // zjisteni textu z policka 
        var zaloha = jQuery(this).parent().attr("title"); // zjisteni puvodni hodnoty policka          
        if( hlaska == ""){  // je li policko prazdne
           jQuery(this).removeClass("notempty").val(default_textarea);
        }else{
           jQuery(this).addClass("notempty");   
        }
   });     


   jQuery("input:text").focus( function(){  // po kliknuti na policko       
        jQuery(this).addClass("focused");
        var input = "";
        var titulek = jQuery(this).parent().attr("title"); // zjisteni puvodni hodnoty policka  
         input = jQuery(this).val();  // zjisteni Hlasky  
         if( titulek == input ){  // je li zaloha prazdna - cyklus jde poprve
              jQuery(this).val("");  // policko se vymaze 
             this.value = "";            
         }         
   });     
   jQuery("input:text").blur( function(){    // po opuštění políčka
        jQuery(this).removeClass("focused");
        var hlaska = jQuery(this).val();  // zjisteni textu z policka 
        var zaloha = jQuery(this).parent().attr("title"); // zjisteni puvodni hodnoty policka          
        if( hlaska == ""){  // je li policko prazdne
           jQuery(this).removeClass("notempty").val(zaloha);
        }else{
           jQuery(this).addClass("notempty");   
        }
   });   

  // **** TOOLTIP *****
   jQuery(".tooltip").prev().addClass("tooltip-prev").hover( function(){     
    
      var message = jQuery(this).next(".tooltip").html(); 
      jQuery("#tooltip").html(message).stop(true,false).show();

            jQuery(this).mousemove(function(e) {      
                  var relativeX = e.pageX+10;
                  var relativeY = e.pageY+3; 
         
                  jQuery("#tooltip").css("top",relativeY+"px").css("left",relativeX+"px");
            });        
                    
   },function(){
      jQuery("#tooltip").hide(); 
   }); 
   

    
     
    /* 
    // tooltipy    
    jQuery('.title').hover(function() { 

            var title = jQuery(this).attr("title");        
            jQuery("body").append("<div id=\"title\"><span>"+title+"</span></div>");
            jQuery("#title span").attr("title",title); 
                      
            jQuery(this).removeAttr("title").mousemove(function(e) {      
                  var relativeX = e.pageX +17;
                  var relativeY = e.pageY +17; 
   
                  jQuery("#title").css("top",relativeY+"px").css("left",relativeX+"px").fadeTo(200,1).slideDown(150)
                                  .find("span").text(title);
            });                       
   }, function() {    
            var title = jQuery("div#title span").attr("title");
            jQuery(this).attr("title",title);              
            jQuery("#title").remove();                         
   });
   
        */
     

       /*
jQuery("map").hover( function() {
    jQuery("img#map").attr("src","/styles/images/webolution/logo-hover.png");
},function(){
    jQuery("img#map").attr("src","/styles/images/webolution/logo.png");
});   */
     
     
     
     
     
     
     
     


// --------RATING------------------   
/*

  jQuery("#rating.unrated ul#rating-stars li").hover( function() { 
  
         var label = jQuery("span",this).attr("title");
         jQuery("#rating-text").text(label);
         
         jQuery(this).addClass("hovered").prevUntil().addClass("hovered");
  },function(){
         jQuery("#rating-text").text("");
         jQuery(this).removeClass("hovered").prevUntil().removeClass("hovered");
  });
 
  jQuery("#rating.rated ul#rating-stars").hover( function() { 
         jQuery("#rating-text").toggleClass("hidden");
  },function(){
         jQuery("#rating-text").addClass("hidden");
  });
  
  jQuery("#rating.rated ul#rating-stars").live('dblclick', function() { 
      alert ('Hlasovat můžete pouze jednou !!');
  });
  
  
  jQuery("#rating.unrated ul#rating-stars li").live('click', function() {

      var art_id = jQuery("#art_id").text();        
      var id = jQuery(this).index() + 1;
       
       jQuery.ajax({
          type: "POST",
          url: location.protocol + "//" + location.host +"/scripts/ajax/rating.ajax.php",
          data: 'id='+id+'&art_id='+art_id,
          success: function(msg){
             jQuery('#rating').removeClass("unrated").addClass("rated").html( msg );
             document.cookie = 'rated-art-'+art_id+'='+id+'; expires=60; path=/';    
          }                 
       });     
  });
         */
 


/* komentare pod clankem */  /*
jQuery("#comments ul table").hover(function(){
   jQuery(this).parents("li").addClass("selected-parent").children("table").addClass("selected");
},function(){
   jQuery(this).parents("li").addClass("selected-parent").children("table").removeClass("selected");
});
jQuery("#comments li:last-child").addClass("last-child");
jQuery("#comment-switch").click(function() {
     jQuery("#comments form").hide().prependTo("#comments");
     jQuery("#comments form").fadeTo(500,1).next("#addComment-button").prependTo("#comments");
     jQuery("input:hidden[name=commentParent]").attr("value","0");
});
jQuery(" #comments button.reagovat").click(function() { 
  var value = this.value;
  jQuery("input:hidden[name=commentParent]").attr("value",value);
  jQuery(".container").removeClass("container");
  var container = jQuery(this).parents("li");
  container.addClass("container");
  container.parents(".container").removeClass("container").siblings().removeClass("container");
  jQuery("#comments form").hide().prependTo(".container").next("table").prependTo(".container");
  jQuery("#comments form").fadeTo(500,1);
});

  
  
    */
 

 
// -------- VIDEOGALERY----------
/*
   var item_width = 170;
   var videos_in_line = 3;
  
   jQuery("#videogalerie #video-list .video-item").live('click', function(){

      var videogalery =  jQuery("#videogalerie #video-inner").attr("class");
      var video =  jQuery(this).index() +1;

      jQuery(this).addClass("active").removeClass("deactive").siblings().addClass("deactive").removeClass("active");
      
      jQuery.ajax({
          type: "POST",
          url: location.protocol + "//" + location.host +"/scripts/ajax/videogalery.ajax.php",
          data: 'videogalery='+videogalery+'&video='+video,
          success: function(msg){
               jQuery('#videogalerie #active-video').html( msg );
           //  document.cookie = 'rated-art-'+art_id+'='+id+'; expires=60; path=/';    
          }                 
      });  
   });
   
   jQuery("#videogalerie #next-video").live("click", function(){
        var position = jQuery("#videogalerie #video-list-inner").position();
        var p_left = position.left-20;
        var active_item = ( p_left / 170 );
        var item_count = jQuery(".video-item").size();
        
 
        if(  item_count + active_item <= videos_in_line ){
            return false;
        } 
        jQuery("#videogalerie #video-list-inner").stop(false,true).animate({ left: '-=170'});
   });
   jQuery("#videogalerie #prev-video").live("click", function(){
        var position = jQuery("#videogalerie #video-list-inner").position();
        var p_left = position.left-20;
        var active_item = ( p_left / 170 );
        var item_count = jQuery(".video-item").size();

        if( item_count - active_item == item_count ){
           return false;
        }    
        jQuery("#videogalerie #video-list-inner").stop(false,true).animate({ left: '+=170'});
   });


//    jQuery("a.external")
  
      */
    
    
  //   zvyrazneni externich   odkazu


  

 
});
 

