$(function (){
	
//middle blocks

	$("#quick-start-blocks > div").hover(
	function () {
		$(this).addClass('active-block');
		$(" h2",this).animate({"top": "-=62px", "fontSize":"16px"}, 200 );
		$("> ul",this).fadeIn(150);
		$("> img",this).fadeIn(150);
	},
	function () {		
		$(this).removeClass('active-block');
		$(" h2",this).animate({"top": "+=62px", "fontSize":"22px"}, 100 );
		$("> ul",this).fadeOut(100);
		$("> img",this).fadeOut(100);
	}      
	);
	
	
//	AFIS prisijungimas
	
	$("#sidebar > #mano-agata > div").hover(
			function () {
				$("> a > img",this).fadeIn(150);
				$("> span",this).css("display", "none");
				$("> a#login",this).css("display", "block");
			},
			function () {
				$("> a > img",this).fadeOut(100);
				$("> span",this).css("display", "block");
				$("> a#login",this).css("display", "none");
			}      
		);
	
// namelis
	
	temp = $("#header ul#main-menu li#m-0").attr("class");
	if(temp=="active"){
		$(this).css("padding-bottom","8px");
	}
	else {
		$(this).css("padding-bottom","15px");
	}
	
//top menu animation
	$("#main-menu > li").hover(
			function () {
				t1 = $(this).attr("id");
				t2 = $(this).attr("class");
					if (t2!="active"){
						if (t1==="m-0"){
							$("> a",this).animate({"paddingTop": "45px", "paddingBottom": "13px"}, 100 );
						} else if (t1==="m-6") {
							$("> a",this).animate({"paddingTop": "+=6px", "paddingBottom": "15px"}, 100 );
						} else {
							$("> a",this).animate({"paddingTop": "+=13px", "paddingBottom": "15px"}, 100 );
						}
					}						
				},
				function () {
					if (t2!="active"){
						if (t1==="m-0"){
							$("> a",this).animate({"paddingTop": "32px", "paddingBottom": "15px"}, 100 );
						} else if (t1==="m-6") {
							$("> a",this).animate({"paddingTop": "-=6px", "paddingBottom": "15px"}, 100 );
						} else{
							$("> a",this).animate({"paddingTop": "-=13px", "paddingBottom": "17px"}, 100 );
							//$("> ul",this).fadeOut(100);
						}
					}
				} 	
	);
	
	
//naujienu slide
	$("#news-page .slide").click(function () {
	      if ($(this).next().next().next().next("div.post").is(":hidden")) {
	    	  $(this).next().next().next("span.excerpt").css("display","none");
	    	  $(this).parent().addClass("open-post");
	    	  $(this).next().next().next().next("div.post").slideDown(400);
	      } else {
	    	  $(this).next().next().next("span.excerpt").css("display","block");
	    	  $(this).parent().removeClass("open-post");
	    	  $(this).next().next().next().next("div.post").slideUp(300);
	    	  //$(this).next().next().next("span.excerpt").slideDown(300);
	      }
	    });
	
	
	
//post add rel to groups
	$("#news-page ul li div.post").each(function(i){
		$(this).find("a.thickbox img.ngg-singlepic").parent().attr({rel: i});
		}
	);
	
// preload all images from css stylesheet
	
	$.preloadCssImages();

	
// straipsniai fix
	var pathname = window.location.pathname;
	var pageNameArray = pathname.split('/');
	if (pageNameArray[1]=='straipsniai'){
		
		$("#menu-page-1 li.page-item-42").addClass('current_page_item');
	}
	

	
	
	
	
});

