// animace u boxu
			$(document).ready(function(){
        /*if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
          $('.box')
        }*/
			
				/*$('.peek').hover(function(){
					$(".cover", this).stop().animate({top:'95px'},{queue:false,duration:400});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:400});
				});
        $('.littlePeek').hover(function(){
					$(".cover", this).stop().animate({top:'80px'},{queue:false,duration:400});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:400});
				});*/
				$('.peek').live("mouseover", function(){
					$(".cover", this).stop().animate({top:'95px'},{queue:false,duration:400});
				});
				$('.peek').live("mouseout", function(){
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:400});
				});
				
				$('.littlePeek').live("mouseover", function(){
					$(".cover", this).stop().animate({top:'80px'},{queue:false,duration:400});
				});
				$('.littlePeek').live("mouseout", function(){
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:400});
				});
				
				$('.peek img.cover').live("click", function(){
				  $('.littlePeek img.cover, .peek img.cover').stop().animate({top:'0px'},{queue:false,duration:400});
          $(this).stop().animate({top:'95px'},{queue:false,duration:400});
				});
				
        $('.littlePeek img.cover').live("click", function(){
					$('.littlePeek img.cover, .peek img.cover').stop().animate({top:'0px'},{queue:false,duration:400});
          $(this).stop().animate({top:'80px'},{queue:false,duration:400});
				});
			});
			
    // fixnuti kulatych rohu pro IE
      curvyCorners.addEvent(window, 'load', initCorners);
      function initCorners() {
        var settings = {
          tl: { radius: 3 },
          tr: { radius: 3 },
          bl: { radius: 3 },
          br: { radius: 3 },
          antiAlias: true
        }
        curvyCorners(settings, ".button");
      }
    
    // inicializace buttons divu
    function buttons_init() {
        var width=0;
        $(".buttons *").each(function(index) {
            if(!$(this).hasClass('clear')) {
                width += parseInt($(this).outerWidth('includeMargin'));
            }
            $(this).parent('.buttons').width(width);
        });
    }
    
    // scrollovani sponzoru
    function flt_scroll_init() {
        var flt_width=0;
        $(".flt-scroll > div > *").each(function(index) {
            if($(this).css('display') != 'none') {
                flt_width += parseInt($(this).outerWidth('includeMargin'));
            }
        });
        $(".flt-scroll > div").width(flt_width);
        
        $('.flt-arrow-left').css('visibility','hidden');
        if($(".flt-scroll").width() > flt_width)
            $('.flt-arrow-right').css('visibility','hidden');
    }
    
    function flt_scroll_move(button, move) {
        var parent = $(button).siblings('div.flt-scroll');
        var parentWidth = $(parent).width();
        var object = $(parent).children("#accordion");
        var left = parseInt($(object).css('left'));
        var width = $(object).width();
        
        var newLeft = 0;
        if((move > 0) && (move + left > 0)) newLeft = 0;
        else if((move < 0) && (move + left < (-1 * width + parentWidth))) newLeft = (-1 * width + parentWidth);
        else newLeft = move + left;
        
        if(newLeft != 0) $('.flt-arrow-left').css('visibility','visible');
        else $('.flt-arrow-left').css('visibility','hidden');
        if(newLeft == (-1 * width + parentWidth)) $('.flt-arrow-right').css('visibility','hidden');
        else $('.flt-arrow-right').css('visibility','visible');
        
        
        $(object).animate({"left": newLeft+'px'}, "slow");
    }
    
    $(document).ready(function() {
        flt_scroll_init();
        buttons_init();

        $('.loadArticles').click(function() { // loading new articles
          $.get('http://modniblog.cz/wp-content/themes/MB2012/output.php', {offset: articles_offset, cat: articles_cat}, function(data) {
          $('.box.peek:last').after(data);
          });
          articles_offset += 8;
          return false;
        });                    
        
        $("#accordion").tabs("#accordion div", {
            tabs: 'img', 
            effect: 'horizontal'
        });
        
        $('.scrollTop').click(function() {
          $('body').animate({scrollTop : 0}, 'slow');
          $('html').animate({scrollTop : 0}, 'slow');
          return false;
        }); 
    });
