$(function() {
	/* LIST */
	$("#projects .list").accordion({
		header: "> .projectHeader",
		collapsible : true,
		active : false,
		autoHeight: false
	});	
	
	$("#projects .list").bind('accordionchange', function(event, ui) {
		$(".title", ui.newHeader).css("color","#fff") // jQuery object, activated header
		$(".title", ui.oldHeader).css("color","#36ACDE") // jQuery object, previous header		
	});
	
	
	/* SQUARE */
	$("#projects .square li").each(function() {
		$(this).hover(
			function() {
				$(".data",this).stop();
				$(".data",this).animate({'top': '64px'},500)
			},
			function() {
				$(".data",this).stop();
				$(".data",this).animate({'top': '128px'},500)
			}						
		)					
	});	
	
	
	/* RECTANGLE */
	$("#projects .rectangle li").each(function() {
		$(this).hover(
			function() {
				$(".data",this).stop();
				$(".data",this).animate({'top': '0px'},250)
			},
			function() {
				$(".data",this).stop();
				$(".data",this).animate({'top': '119px'},250)
			}
		)				
	});	
	
	
	/* RECENT PROJECTS */
	$("#projects .rectangle li, #projects .square li").each(function() {
		$(this).attr("href",$("a",this).attr("href"));
		$(this).click(function() {
			window.location.href=$(this).attr("href");
		})
	})
	
	/* PRELOADER */
	$("#projects ul .picture").preload({loaderImage: "i/ajax-loader.gif",marginTop: 45});
	
	/* ANIMATION */
	$("#projects .project").css({opacity: 0});
	 
	var delay=0;
	var step=150;
	$("#projects .project").each(function() {
		$(this).animate({opacity: 0}, delay).animate({opacity: 1}, 300)
		delay=delay+step;
	})
	
	
})
