$(document).ready(function(){ $('html').removeClass('no-js');

$('#kat li.active').parent('ul').addClass('active');
$('#kat ul.active').parent('li').parent('ul').addClass('active');

$("#kat span").click(function() {
	$(this).toggleClass("activ").next().slideToggle("fast");
});	
$(".baner-p div, .reklama").cycle( {
	fx : 'fade',
	speed : 3000
});
$('.zoom').lightBox();
$(".gal-ajax").click(function() {
	var aurl = $(this).attr('href');
	
	$.ajax({
		  url: aurl,
		  beforeSend: function() {
			$("html").css("overflow", "hidden");
			$(".galery-bg").show();
		  },
		  success: function(data) {
		    $('.gallery-box').html(data);
		    $(".scrollable").scrollable();
		    $(".items a").click(function() {
		    	if ($(this).hasClass("active")) { return false; }
		    	var url = $(this).attr("href");//.replace("/mini/", "/big/");
		    	var title = $(this).attr("title");
		    	var wrap = $("#image_wrap").show();
		    	 $(".gtitle").html(title);
		    	var img = new Image();
		    	img.onload = function() {
		    		wrap.show();
		    		wrap.find("img").attr("src", url);
		    		if ($.browser.msie) {
		    		var h = -(img.height/2)+'px';
			    	var w = -(img.width/2)+'px';
			    	//alert( w + " " + h);
			    	wrap.find("img").css({'margin-top': h, 'margin-left': w});
		    		}
		    	};

		    	img.src = url;
		    	
		    	$(".items a").removeClass("active");
		    	$(this).addClass("active");
		    	return false;
		    }).filter(":first").click();
		    
		    $('.gallery-box').fadeIn('slow');
		    
		    $(".galery-bg, #image_wrap").click(function() {
		   	 	$('.gallery-box').fadeOut('fgast').html('');
		   	 	$(".galery-bg").hide();
		   		$("html").css("overflow", "auto");
		   	 	
		   });
		  }
		});
	return false;
});



	
$('.top-menu li').hover(
		function(){
			$(this).stop().animate({paddingTop: '5px'}, 200)
						  
		},
		function(){
			 $(this).stop().animate({paddingTop: '0'}, 200)
			 			  
		}
	);

$('#kat span').hover(function(){
	$(this).stop().animate({ 
		paddingLeft: '5px'
	}, 200)
	
 },function(){
	 $(this).stop().animate({
		paddingLeft: '0'
	}, 200)
 });

$('#kat li.p').hover(
		function(){
			$(this).animate({backgroundPosition:"100px 0"}, {duration:500})
		},
		function(){
			$(this).animate({backgroundPosition:"-120px 0"}, 
					{duration:100, complete:function(){$(this).css({backgroundPosition: "-120px 0"})}})
		});

$('.read-action').click(function(){
	var str = $('.text-box-hide').html();
	$('.text-box').html(str);
	$(this).remove();
	return false;
});

$('#download-ul h3').click(function(){
	$(this).next('div').slideToggle('fast');
});
$('.b-down span').click(function(){
	$(this).next('ul').slideToggle('fast');
});
$('.cat-box h4').click(function(){
	$(this).next('.cat-box2').slideToggle('fast');
});
$('.b-down span.box-active').parent().show().parent().show().parent().show();
// end ready()
});
