// Easing equation, borrowed from jQuery easing plugin
// http://gsgd.co.uk/sandbox/jquery/easing/
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};


function mycarousel_initCallback(carousel)
{
    //nastavím si objekt
    c = carousel;

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

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

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


 $(document).ready(function(){    
    /* LOKALNI SKROLOVANI */
  $.localScroll({
		queue:true,
		duration:1000,
		hash:false
	});		



  $("#zalozky").tabs({ 
    cache: true,
    fx: {opacity: 'toggle' } ,     
    load: function(event, ui) {
         

        $('#zalozky div.caruso_ajax ul').jcarousel({
      		wrap:"both",
      		scroll:3,
      		auto: 4,
      		animation:"slow",
          initCallback: mycarousel_initCallback
        });
    }, 
       
    select: function(event, ui) {    
       
            
        var url = $.data(ui.tab, 'load.tabs');        
        if( url != "/novinky/" && url != "/akce/" && url != "/nejprodavanejsi/" && url != undefined) {
            location.href = url;
            return false;
        }
        return true;
    }

  });


  $('#zalozky div.caruso_obal ul').jcarousel({
		wrap:"both",
		scroll:1,
		auto: 2,
		animation:"slow",
    initCallback: mycarousel_initCallback
  });



  /* Overlabel */
  $("label.overlabel").overlabel();
 
  
  $(".schovej").hide();
  
  
  /* Vycentrování obrázků */
  $("ul.products_li span.img, .item .itemimg, .images .hlavni").imgCenter();
  
    
    //Nastavení prvků
    $("input").focus(function(){
        $(this).css({backgroundColor:"#FFDDAA"});
      });
    $("input").blur(function(){
      $(this).css({backgroundColor:"#FFFFFF"});
    });
    $("textarea").focus(function(){
      $(this).css({backgroundColor:"#FFDDAA"});
    });
    $("textarea").blur(function(){
      $(this).css({backgroundColor:"#FFFFFF"});
    });  
  		


});
