$(document).ready(function(){

	// pretty type
	Cufon.replace('#nav li a', {hover:true});

	// search input
	var input_search = $("#keywords");
	var default_text_search = "Search";
	input_search.focus(function(){  
		if($(this).attr("value") == default_text_search) $(this).attr("value", "");
	});
	input_search.blur(function(){  
		if($(this).attr("value") == "") $(this).attr("value", default_text_search);
	});

	// external links
	$("a[href*='http://']:not([href*='steeglaw.com'])").addClass("external-link");
	$("a[href*='https://']:not([href*='steeglaw.com'])").addClass("external-link");
	$('a.external-link').each(function() {
	    $(this).attr("title", $(this).attr("title")+" (opens in a new window)");
	    $(this).attr("target", "_blank");
	});

	// home page gallery
	$('#gallery').cycle({
		fx: 'fade',
		timeout: '3000',
		speed: '1000'
	});

	// div-level hover
	$("div.person").hover(
		function () {$(this).addClass("hover");},
		function () {$(this).removeClass("hover");}
	);

	// 'print page' link
	$('#snapshot p.email').after('<p class="print"><a href="#">Print this page</a></p>');
	$('p.print a').click(function() {
		window.print();
		return false;
	});

	// form validation
	$("#ccoptin").validate({
		rules: {
			"ea": {
				required: true,
				email: true
			}
		},
		messages: {
			"ea": {
				required: "Please provide your Email Address",
				email: "This is not a valid Email Address"
			}
		}
	});

});
