$(document).ready(function(){ 
 
$('#headingfade').cycle({ 
		fx:     'fade', 
		speed:  'slow', 
		timeout: 6000, 
		containerheight: '150px',
		next:   '#next2', 
		prev:   '#prev2' 
		});

	//home
	$('#home').click(function() {
		return location.replace('http://pvifootball.com/');
	});
	
	// read the news file
	$('#headingfade').show()
	$('#contentcolumn').load('readNews.php');


	// important dates
	$('#imp-dates').click(function() {
	$('#headingfade').show()
	$('#contentcolumn').load('dates.html') 
		return false;
	});

	// schedules
	$('#game-sked').click(function() {
	$('#headingfade').show()
	$('#contentcolumn').load('sked.php') 
		return false;
	});
	
	// player form
	$('#player-form').click(function() {
	$('#headingfade').show()
	$('#contentcolumn').load('player-form.html') 
		return false;
	});
	
	// field directions
	$('#field-nav').click(function() {
	$('#headingfade').show()
	$('#contentcolumn').load('fielddir.php') 
		return false;
	});
	
	// coaches
	$('#coaches-nav').click(function() {
	$('#headingfade').show()
		$('#contentcolumn').load('coaches.html') 
		return false;
	});
	
	// concession volunteers
	$('#concession-nav').click(function() {
		$('#headingfade').show()
		$('#contentcolumn').load('vol-concession.php') 
		return false;
	});
	
	// chaincrew volunteers
	$('#chaincrew-nav').click(function() {
		$('#headingfade').show()
		$('#contentcolumn').load('vol-chaincrew.php') 
		return false;
	});
	
	// team dinners volunteers
	$('#dinners').click(function() {
		$('#headingfade').show()
		$('#contentcolumn').load('vol-dinner.php') 
		return false;
	});
	
	// pictures
	$('#pictures').click(function() {
	$('#headingfade').show()
	$('#contentcolumn').load('pictures.html') 
		return false;
	});
	
	// login page
	$('#admin_login').click(function() {
		$('#headingfade').show()
		$('#contentcolumn').load('login.html')
		return false;
	});
	
	// next two options are for admins only so they are hid initially	
	// update news
	
	$('#add_news').click(function() {
		$('#headingfade').show()
		$('#contentcolumn').load('add-news.php')
		return false;
	});
	
	$('#view_data').click(function() {
		// $('#contentcolumn').load('display.php')
		// $('#contentcolumn').load('viewplayers.php')
		$.get("viewplayers.php",
			function(data){
				$('#contentcolumn').html(data);
			});
			return false;
	});
	
	$('#logout').click(function() {
		$('#headingfade').show()
		$('#contentcolumn').load('session_destroy.php')
		return false;
	});
	
	$('#student-ad').click(function() {
		$('#contentcolumn').load('student-ad.php')
		$('#headingfade').hide()
		return false;
	});
	

// this validates the form
	$("#playerForm").validate({
	rules: {
		pfirstname: "required",
	    plastname: "required",
	    email: {
	    	required: true,
		    email: true
		}
	},
	messages: {
		pfirstname: "Please enter your firstname",
		plastname: "Please enter your lastname",
		email: "Please enter a valid email address"
	}
	});
});
