$(document).ready(
	function() {

		// Open links with rel="external" in new window - like ye ole' target="_blank"
		$('a[rel="external"]').click(function() {window.open( $(this).attr('href') ); return false;});


		// Zebra-stripe data tables
		$("table.data tbody").each(function() {
			$(this).removeClass("odd even");
			$("tr:odd", this).addClass("odd");
			$("tr:even", this).addClass("even");
		});


		// Main Nav background animation
		$('#main_nav a')
				.css( {backgroundPosition: "0 -100px"} )
				.mouseover(function(){
					$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:250})
				})
				.mouseout(function(){
					$(this).stop().animate({backgroundPosition:"(0 -100px)"}, {duration:100, complete:function(){
						$(this).css({backgroundPosition: "0 -100px"})
					}})
				})
	
		// Sub Nav background animation
		$('.sub_nav a')
				.css( {backgroundPosition: "333px 0"} )
				.mouseover(function(){
					$(this).stop().animate({backgroundPosition:"(26px 0)"}, {duration:250})
				})
				.mouseout(function(){
					$(this).stop().animate({backgroundPosition:"(333px 0)"}, {duration:100, complete:function(){
						$(this).css({backgroundPosition: "333px 0"})
					}})
				})
		
		// Thumb photos random-ness
		var totalNum = 6;
		var rndNum = Math.floor(Math.random() * totalNum);
		$("span.thumb").css("background-image","url(/images/thumbs/" + "0" + rndNum  +
		".png)");
		
		
	}
);
