
function setupCaseStudies() {

	if($.browser.safari) {
		$("#case_main_image img").css("display", "none").fadeIn("slow").unbind(); 
	} else {
		// safari doesn't work with this ocde for some reason: 
		$("#case_main_image img").load(function() {
			$(this).unbind('load').fadeIn("slow");
		}).hide();
	}

	$("#case_thumbs a img:eq(0)").addClass("on").fadeTo("normal", 0.25); 
		
	$("#case_thumbs a").click(function() {

		$("#case_thumbs img.on").fadeTo("slow", 1.0).removeClass("on"); 

		var href = $(this).attr("href"); 

		if($.browser.msie) {
			$("#case_main_image img").attr("src", href);

		} else {
			$("#case_main_image img").unbind("load").fadeOut("fast", function() {
				$(this).attr("src", href).load(function() {
					$(this).unbind("load").fadeIn("fast");
				}); 
			});
		}

		$(this).children("img").addClass("on").fadeTo("normal", 0.25); 
		return false; 
	}); 	

}

$(document).ready(function() {

	/*** TOP SEARCH QUERY FIELD ***********************************************************/

	var searchDefaultValue = $("#search_query").val(); 

	$("#search_query").focus(function() {
		$(this).addClass("on");
		if($(this).val() == searchDefaultValue) $(this).val(''); 


	}).blur(function() {
		if(!$(this).val()) $(this).val(searchDefaultValue); 
		if($(this).val() == searchDefaultValue) $(this).removeClass("on"); 
	}); 

	/*** MAKE SUBNAV PARENT LIST ITEMS HAVE "ON" CLASS ************************************/

	$("li.on").parents("li").addClass("on_parent"); 


	/*** GENERAL PURPOSE ******************************************************************/	

	if($.browser.safari) $("body").addClass("safari"); 

	/*** EXCEPTIONS ***********************************************************************/

	//if($("#bodycopy").is(".case")) setupCaseStudies(); 
			
	

}); 
