jQuery(document).ready(function($) {



	// $('#kaubam2rgid').masonry({ 

	// 	itemSelector: '.kaubam2rk-item', 

	// 	gutterWidth: 20,

	// 	isFitWidth: true

	// });



	// Inputs 

	//$("input:checkbox").uniform();



	// Toote lehe tabs

	$('#toote_info div').fadeOut('fast');

	$('#toote_info div:first').fadeIn();

	$('#toote_info ul li:first').addClass('active');



	$('#toote_info ul li a').click(function(){

		$('#toote_info ul li').removeClass('active');

		$(this).parent().addClass('active').fadeIn();

		var currentTab = $(this).attr('href');

		$('#toote_info div').hide().fadeOut('fast');

		$(currentTab).fadeIn().show();



		return false;

	});

	// Tarneaeg tekst slaider
	//$('#tarneaeg2').slider({
	//	direction: 'ltr'
	//});	

	$('#tarneaeg2 ul li').hide();	
	$.fn.ezslide = function ( options ) {
    var defaults = {
            fadeIn  : 1000,
            fadeOut : 100,
            delay   : 3000
        },
        settings = $.extend( defaults, options ),
        $this = this,
        cur = 0,
        fadeIt = function( which ) {
            var li = $this.find('li');

            cur = which = (which >= li.length) ? 0 : which;

            li.fadeOut( settings.fadeOut );
            li.eq( which )
              .delay( settings.fadeOut )
              .fadeIn( settings.fadeIn, function(){
                setTimeout(function() { 
                    cur++;
                    fadeIt( cur ); 
                }, settings.delay);
            });

        };
    	fadeIt( cur );
	};
	$('#tarneaeg2 ul').ezslide({
    	fadeIn  : 600,
    	fadeOut : 450,
    	delay   : 3000
	});

try {
	// Fancybox piltidele
	$("a:has(img) and :not(.nofancy)").fancybox();
} catch(e) {}

	// Fancybox gallery Toote lehel
try {
	$(".toode .gallery a").attr('rel', 'gallery').fancybox();
} catch(e) {}

/* FB.Event.subscribe('edge.create', function(response) {
				$('.fb_edge_comment_widget fb_iframe_widget').css('left','-300px');
				$('.nub').css('display','none');
        });*/
        
});


