$(document).ready(function () {
	$('.video a').colorbox({
		scrolling: false
	});
	
	$('a.external').click(function(){
		window.open(this.href);
		return false;
	});
	
	$('a img').parent().css('border','none');
	$('a img').parent().css('background','none');
	
	$('#rotator li:first').show();
	
	var i = 0;
	var size = $('#rotator li').length;
	
	function crossFade(){
		
		$('#rotator li').eq(i).fadeOut(500, 
			function(){
				if(i < size){$(this).next().hide().fadeIn(1000);}
				else{
					i = 0;
					$('#rotator li').eq(i).fadeIn(1000);
				}
			}
		);
		i++;

	}
	
	interval = setInterval(crossFade, 7500);
	
	$('#nav li ol').each(function(){
		var count = $(this).children().size();
		
		if(count == '0'){
			$(this).css('visibility', 'hidden');
		}
	});
	
	$('#freeform').validate({
		highlight: function(element, errorClass) {
			$('#error').fadeIn();
			$(element).addClass('error');
		},
		rules: {
			name: "required",
			email: "required",
			message: "required"
		}
	});
	
	$('#secondary blockquote p').prepend('&ldquo;').append('&rdquo;');
	$('#secondary cite').prepend('&ndash; ');
	
	$('#flash-box').flash({
		swf: 'http://www.fishladder.net/assets/flash/fish_v2.swf',
		height:'72',
		width:'1037',
		wmode: "transparent"
	});
});