$(function() {
	if ( $('body').attr('class') == 'contact_us') {		
		$("#contact_form").validate(
			{
				errorClass: "invalid",	
				rules: {
					"name": "required",
					email: {
						required: true,
						email: true
					},
				regarding: "required",
				comments: "required"
			},
			messages: {
				"name": "Please enter your name",
				email: "Please enter a valid email address",
				regarding: "Please select a topic",
				comments: "Please enter your comments"
			}
		});
		
		// Minor CSS fix for form validation
		$('textarea + label.invalid').css({"margin-top": "6em"});
	}
	
	if ($('body').attr('class') == 'kings_club') {
		$("#email_club").validate({
			errorClass: "invalid",	
			rules: {
				"name": "required",
				email: {
					required: true,
					email: true
				}
			},
		
			messages: {
				"name": "Please enter your name",
				email: "Please enter a valid email address"
			}
		});
		
		// Minor CSS fix for form validation
		$('textarea + label.invalid').css({"margin-top": "6em"});
	
	
		today = new Date();
		this_year = today.getFullYear();
		old_year = this_year - 100;
		
		// Calendar popup for Aloha Club	
		$('input.birthday').attachDatepicker({
			yearRange: old_year + ':' + this_year,
			dateFormat: 'mm/dd/yy',
			closeAtTop: false
		})
	}
		
	// Load the flash intro on the homepage
	if ($('body').attr('class') == 'home') {
		// IE sucks
		if ( $.browser.msie && (parseInt($.browser.version) == 6 || parseInt($.browser.version) == 7 || parseInt($.browser.version) == 8) ) {
			// Hide the HTML fallback nav, and a script tag on the homepage will load the movie 
			$('#intro table').css({ display: 'none' });
		// Standards don't
		} else {
			$('#intro').flash(
				{
					src: 'flash/intro.swf',
					width: 1000,
					height: 300,
					wmode: 'transparent',
					bgcolor: "#d9c66d",
					id: 'introMovie',
					name: 'introMovie',
					allowScriptAccess: "always",
					swfliveconnect: "true"
				},
				{version: 9}
			);
		}
	}

	// Add PDF icon to all PDF files
	//$('a[href$=.pdf]').css({
	//	paddingLeft: '20px',
	//	background: 'url(/images/page_white_acrobat.png) no-repeat 1px center'
	//})
});
