jQuery(document).ready(function($) {
		
	// Search
	$("#s").blur(function(){ if ( $(this).val() == "" ) $(this).val("Search..."); $(this).removeClass('focus'); });
	$("#s").focus(function(){ if ( $(this).val() == "Search..." ) $(this).val(''); $(this).addClass('focus'); });
	
	// Fix for IE6 drop down menu
	$("#access ul li").hover( function(){
		$(this).children("ul").addClass("over");
	}, function() { 
		$(this).children("ul").removeClass("over");
	});
	
	// FAQ answer toggle
	$(".faq-question").click(function() {
		$(this).next(".faq-answer").toggle("fast");
	});
	
	// Paragraph Bullet Margin Fix
	$("#content ul").prev("p").css("margin-bottom", "5px");
	
	// Add classes to first and last elements in each list, and odd class for zebra
	$("ul li:first-child, ol li:first-child").addClass("first");
	$("ul li:last-child, ol li:last-child").addClass("last");
	$("ul li:odd, ol li:odd").addClass("odd");
	
	// Add classes to first and last table cells in a row
	$("tr td:first-child, tr th:first-child").addClass("first");
	$("tr td:last-child, tr th:last-child").addClass("last");
	$("table tr:first-child").addClass("first");
	$("table tr:last-child").addClass("last");
	$("tr:odd").addClass("odd");
	
	// Connections Bio Toggle
	$(".bio-toggle").click(function(){
		var $toggle = $(this);
		var $excerpt = $(this).prev().children('.bio-remainder');
		if (!$excerpt.is(':visible') ) {
			$toggle.html('Hide');
			$excerpt.slideDown();
		} else {
			$toggle.html('Read More');
			$excerpt.slideUp();
		}
	});
	
	// Image hover greyscale to colour
	/*
	$("img.greyscale-hover").each(function () {
		// Store the image and it's attributes as variables
		var $img = $(this);
		var $img_width = $img.attr('width');
		var $img_height = $img.attr('height');
		// Wrap the image in a div with exact dimensions as the image
		$img.wrap('<div class="greyscale-hover" style="width:' + $img_width + 'px;height:' + $img_height + 'px;"></div>');
		// Store the newly created parent div as a variable 
		var $parent = $img.parent();
		// Clone the image, and run it through pixastic to covert it to a greyscale canvas object
		$img.clone().appendTo($parent).pixastic("desaturate");
	});
	*/
	/* -- Usage Example
	$("div.greyscale-hover").hover(
		function(){ $(this).find("canvas").fadeOut('slow'); },
	  	function(){ $(this).find("canvas").fadeIn('slow'); }
	);
	*/
	
	// Home Features
	/*
	$(".home-feature div.greyscale-hover").hover(
		function(){ $(this).find("canvas").fadeOut('fastest'); },
	  	function(){ $(this).find("canvas").fadeIn('fast'); }
	);
	*/
	
	// Project List
	$("#project-list li").live('click', function() {
		$href = $(this).attr('href');
		if (!$href == '') {
			window.location = $href;
		}
	});
	
	$("#project-list li").hover(
		function(){
			$(this).addClass('project-hover');
			$(this).find("canvas").fadeOut('fastest'); 
		}, 
		function(){
			$(this).removeClass('project-hover');
			$(this).find("canvas").fadeIn('fast');
		}
	);

	$(".slider").click(function() {
		var $sliderContent = $(this).children(".slider-content");
		if (!$sliderContent.is(':visible') ) {
			$sliderContent.slideDown();
		} else {
			$sliderContent.slideUp();
		}
		//$(this).next(".slider-content").slideToggle();
	});

	/*
	$("a.iframeFancybox1").fancybox({
		'width'					:	600,
		'height'				:	380,
		'scrolling'				:	'no',
		'overlayOpacity'		:	'0.4',
		'overlayColor'			:	'#000',
		'hideOnContentClick'	:  false,
		'autoScale'				:  false,
   		'transitionIn'			:  'elastic',
		'transitionOut'			:   'elastic',
		'type'					:   'iframe'
	});
	*/
	
});
