//Home page welcome slide down
$(function() { 
	
	$('#toggle').toggle(function() {
  		$('#slide-content').slideDown('slow');
  		$('#toggle').attr('class', 'toggle-expanded');
  	}, function() {
  		$('#slide-content').slideUp('slow');
  		$('#toggle').attr('class', 'toggle-collapsed');
	});
	
	$(".team-img").css({"opacity": "0.5"});
	
	$(".team-img").hover(function() {
		$(this).stop().animate({"opacity": "1"}, "slow");
	},
		function() {
		$(this).stop().animate({"opacity": "0.5"}, "slow");
	});
	
	$(".project").css({"opacity": "0.5"});
	
	$(".selected").css({"opacity": "1"});
	
	$(".project").hover(function() {
		$(this).stop().animate({"opacity": "1"}, "slow");
	},
		function() {
			if($(this).hasClass('selected'))
				$(this).stop().animate({"opacity": "1"}, "slow");
			else
				$(this).stop().animate({"opacity": "0.5"}, "slow");
	});

	// custom easing called "custom"
	$.easing.custom = function (x, t, b, c, d) {
		var s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	}
	// use the custom easing
	$(".scrollable").scrollable({easing: 'custom', speed: 700, circular: true});
	
	$('.project-img').bind('click',function(){
		$(".project").stop().animate({"opacity": "0.5"}, "slow").removeClass('selected');
		// $(".project");
		$(this).parent().stop().animate({"opacity": "1"}, "slow").addClass('selected');
		// $(this).parent();
		
		var videoid = $(this).attr('href');
		$("#playerBox").html('').fadeOut('fast',function(){
			// $("#playerBox");
			$.get("/ajax/homevideo.php",{id:videoid }, function(data){
				$("#playerBox").html(data).fadeIn();
			}, "html");
		});
	});
});


