// JavaScript Document

$(function() {
	$(".hoverswap").hover(
		function () {
			$(this).attr("src", $(this).attr("src").replace(/.png/, "-over.png"));
		},
		function () {
			$(this).attr("src", $(this).attr("src").replace(/-over.png/, ".png"));
		}
	);
});


function validateUserStory( storyForm ){
	if ( !storyForm.name.value ) {
		alert('Name is required');
		storyForm.name.focus();
		return false;
	}

	if ( !storyForm.story.value ) {
		alert('Story is required');
		storyForm.story.focus();
		return false;
	}

	if ( !storyForm.captchaCode.value ) {
		alert('Please enter the code');
		storyForm.captchaCode.focus();
		return false;
	}
	
	if( storyForm.photo.value ) {
		if ( storyForm.photo.value.lastIndexOf(".jpg") === -1 && 
			storyForm.photo.value.lastIndexOf(".JPG") === -1) {
			alert('Must use a JPG file for the photo');
			return false;
		}
	}
	
	return true;
}
