/* classes for blog categories */
/* slide show */

$(document).ready(function() {
	$("#contact").css( {  display: "none", opacity: "0.0" } );
	$(".post_meta").css( { borderTop: "1px solid #999" } );
	$(".cufon_here").css( { opacity: "0.3" } );
	$("#archives ul").hide();
	var t;
	
	closeup = function () {
		t = setTimeout(function() {
			$("li#contact_trigger").animate( { paddingTop:"0px", backgroundColor:"#000000" }, 200 );
			$("#contact").animate( { opacity: "0.0" }, 500 ).hide(800);
		}, 1000);
	};
	
	$("li.nav_trigger").hoverIntent (
		function() {
			$(this).animate( { paddingTop:"10px", backgroundColor:"#FF0000" }, 200 );
		},
		function () {
			$(this).animate( { paddingTop:"0px", backgroundColor:"#000000" }, 200 );
		}
	);

	$(".post_meta").hoverIntent (
		function() {
			$(this).animate( { opacity: "1.0", color: "#000", borderTopColor: "#FF0000" }, 200 );
			// $(".post_meta ul.emdash").animate( { color: "#FF0000", backgroundImage: "url(/_images/list_emdash.gif)" }, 200 );
			$(".cufon_here").animate( { opacity: "1.0" }, 200 );
		},
		function () {
			$(this).animate( { color: "#999", borderTopColor: "#999" }, 200 );
			$(".cufon_here").animate( { opacity: "0.3" }, 200 );
		}
	);
	
	$("li#contact_trigger").hoverIntent (
		function() {
			$(this).animate( { paddingTop:"10px", backgroundColor:"#FF0000" }, 200 );
			$("#contact").show().animate( { opacity: "1.0" }, 500 );
		},
		function () {
			closeup();
		}
	);
	
	$("#archives").hoverIntent (
		function() {
			$("#archives ul").slideDown(400);
		},
		function () {
			$("#archives ul").slideUp(400);
		}
	);
	
	// project slideshow
	
	$('.piececontainer div, .slidetitle li').hide()
	$('.piececontainer div:eq(0), .slidetitle li:eq(0)').show()


	cur = 1;

	$('.next').click(function () {
		req = cur + 1;


		if ( $('#slide'+req).length > 0 ) {
			$('#slide'+cur+', .caption'+cur).fadeOut();
			$('#slide'+req+', .caption'+req).fadeIn();
			cur = req;
		} else {
			$('#slide'+cur+', .caption'+cur).fadeOut();
			$('#slide1'+', .caption1').fadeIn();
			cur = 1;
		}
	});


	$('.prev').click(function () {
		req = cur - 1;


		if ( req < 1 ) {
			$('#slide'+cur+', .caption'+cur).fadeOut();
			$('.piececontainer div:last, .slidetitle li:last').fadeIn();

			cur = $('.piececontainer div:last').attr('id').replace('slide','');

		} else {
			$('#slide'+cur+', .caption'+cur).fadeOut();
			$('#slide'+req+', .caption'+req).fadeIn();

			cur = req;

		}
	});
});