(function($)
{
    
    $(function()
    {

        
       
        /*
         * Homepage
         */
        var banners_change_interval = 3000;
        function home_show_banner(holder)
        {
            $("#home_banner_choosers .active").each(function()
            {
                var current_index   = $(this).attr('id')
                    .replace('home_banner_holder_', '');
                $("#home_banner_holder_"+current_index).removeClass('active');
				
				$("#home_banner_holder_"+current_index).find('.loop_right').css("background", "url('../images/main_right.png') no-repeat");
                $("#home_banner_"+current_index).fadeOut();
                
            });
            
            var next_index      = $(holder).attr('id').replace('home_banner_holder_', '');
            $("#home_banner_holder_"+next_index).addClass('active');
            $("#home_banner_holder_"+next_index).find('.loop_right').css("background", "url('../images/main_right_active.png') no-repeat");
			$("#home_banner_"+next_index).fadeIn();
            
			var prev_index  = next_index-1;
            $(".separate_holder").css({visibility: 'visible'});
            
            if ($("#s"+next_index)){
             $("#s"+next_index).css({visibility: 'hidden'});
            }
            if ($("#s"+prev_index)){
             $("#s"+prev_index).css({visibility: 'hidden'});
            }
        }
        if ($("#home_banner_choosers .holder").length > 0) {
            $("#home_banner_choosers").everyTime(banners_change_interval, function() {
                if ($(".active", this).nextAll(".holder:not('.active')").length) {
                    home_show_banner($(".active", this).nextAll(".holder:not('.active')"));
                } else {
                    home_show_banner($(".holder:eq(0)", this));
                }
            });
            
            $("#home_banner_choosers .holder").each(function()
            {
                var holder = this;
                $("a", this).click(function()
                {
                    $("#home_banner_choosers").stopTime(); 
                    home_show_banner(holder);
                });
            });
        }
        

    });
})(jQuery);


$(document).ready(function() {
	
	
    $(".daugiau").bind('click', function(){
	    
	    var kuris = $(this).attr('id');
     
	    
	    if ($("#a"+kuris).css('display') == "none"){

		      $("#a"+kuris).slideDown({opacity:'show'}, 200);
 	          $(this).animate({opacity:'hide'});
 	          window.location.hash = 'b'+kuris;
 	          pageTracker._trackPageview(window.location.pathname+kuris);
		    
	    }
    });
	
    $(".maziau").bind('click', function(){	
	    var kuris = $(this).attr('id');
	    if ($("#a"+kuris).css('display') == "block"){
		    $("#a"+kuris).slideUp({opacity:'hide'}, 200);
		    $(".daugiau").animate({opacity:'show'});
		    
	    }
    });	
 
	$(".txt table.vidinis tr:nth-child(1)").addClass('th');
	/*$(".txt table tr:even ").addClass('enn');
	$(".txt table").each(function(y){
		console.log(y);
		
		var count = $(this).find('tr:first').children('td').size();
		
		console.log($(this).find("tbody").children("tr"));
		$(this).find("tbody").children("tr").each(function (i) {
		
			if (i>0){
				var t = $(this).children().size();
					
				if (parseInt(t) == parseInt(count))
					$(this).children(':first').css('background-color', '#fff');
				}
		});
		
		
	});
	*/

	
	
 
});


