// JavaScript Document

$(document).ready(function(){	
	
	Cufon.replace('#nav a, h1, h2, .postDate, .labelCategories, .postTags A, #sidebar A, #sidebarLeft A, .imageNext, .imagePrev, #footer .left, #footer .right, A.back', { hover: true });
	
	$('.slideshow').jcarousel({
		wrap: "both",
		scroll: 1,
		animation: "fast"
	});
	
	$('#teamSlideshow').jcarousel({
		wrap: "both",
		scroll: 1,
		auto: 3,
		animation: "fast",
		buttonNextHTML: null,
		buttonPrevHTML: null
	});	
	
	$(".team-member").click( function(){

		if($(this).hasClass("teamMemberActive")){
			$(this).removeClass("teamMemberActive");
			$(this).next().hide();
		} else {

		$(".teamMemberPopup").hide();
		$(".teamMemberActive").removeClass("teamMemberActive");

			$("#" + $(this).attr("href")).show().insertAfter($(this));
			$(this).addClass("teamMemberActive");
		}
		
		return false;
	});
	
	$(".fancybox").fancybox({
		'overlayShow'	:	true,
		'overlayOpacity' : 0.8,
		'overlayColor' : '#000000',
		'titlePosition' : 'over'
		
	});

	$('.clearInput').clearInput();
													 
});

jQuery.fn.clearInput = function() {
	return this.focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
			$(this).addClass("writing");
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
			$(this).removeClass("writing");
		}
	});
};
