$(document).ready(function() {
//Form validation
		// $('form#contact').validate({
		// 	rules: {
		// 		first: "required",
		// 		last: "required",
		// 		state: "required",
		// 		email: {
		// 			required: true,
		// 			email: true
		// 		},
		// 		email2: {
		// 			required: true,
		// 			email: true,
		// 			equalTo: "#email"
		// 		},
		// 		hear: "required"
		// 	}
		// });
		
//How did you hear about us
		$('#advertising2').hide();
		$('#contact #advertising').click(function() {
			$('#advertising2').toggle();
		});
		$('#contact .more-advertising input').click(function() {
			$('#advertising2').hide();
		});
		
		$('input[@name=hear]').click(function() {
			//$('input#advertising').checked=false;
			$('input#friend-name').val("");
			$('input#agent-name').val("");
			$('input#other-name').val("");
		});
		
		$('input#friend').click(function() {
			$('input#friend-name').val("Please tell us their name");
		});
		$('input#friend-name').click(function() {
			$(this).val("");
		});
		
		$('input#agent').click(function() {
			$('input#agent-name').val("Please tell us their name");
		});
		$('input#agent-name').click(function() {
			$(this).val("");
		});
		
		$('input#other').click(function() {
			$('input#other-name').val("Please tell us how you heard of us");
		});
		$('input#other-name').click(function() {
			$(this).val("");
		});
		
//topNav rollovers
		// Preload all rollovers
		$("#topNav img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.jpg$/ig,"2.jpg");
			$("<img>").attr("src", rollON);
		});
		
		// Navigation rollovers
		$("#topNav a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.jpg$/ig,"2.jpg"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$("#topNav a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		
//mastheadNav rollovers
		$('#nav a[id]').mouseover(function() {
			$(this).shadow({ 
				color: "#ffffff",
				offset: 0,
				opacity: 0.1
				});
		});
		
		$('#nav a[id]').mouseout(function() {
			$(this).shadowDestroy();
		});
		
		$('#leftCol #media-player a[id]').mouseover(function() {
			$(this).shadow({ 
				color: "#ffffff",
				offset: 0,
				opacity: 0.1
				});
		});
		
		$('#leftCol #media-player a[id]').mouseout(function() {
			$(this).shadowDestroy();
		});
		
//callout boxes rollovers
		$('#mainContent a img').mouseover(function() {
			$(this).animate({ opacity: .65}, 250);
		});
		
		$('#mainContent a img').mouseout(function() {
				$(this).animate({ opacity: 1}, 100);
		});
	
//subNav dividers
	$('#subNav ul li').append('<img src="../images/subNavDivider.gif" />');

});

//tabs
$(document).ready(function() {
    $('#container-1 > ul').tabs();
});