/* CYCLE */
$(function() {
    $('#home-banner-image, #banner-image').cycle();
});

$(document).ready(function(){
$("img.a").hover(
function() {
$(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
$(this).stop().animate({"opacity": "1"}, "slow");
});
 /* FORM SUBMISSION */
	$(".submit").click(function() {
		error = false;
		ErrorString = "ERROR\n\n";
		$(".ErrorMessage").remove();
		$(this).parent().parent().parent().find(".required").each(function(index) {
			TheLength = $(this).val().length;
			TheFieldName = $(this).parent().find("label").text();
			TheFieldName = TheFieldName.replace("*", "");
			TheFieldName = TheFieldName.replace(":", "");
			if (TheLength < 1)
			{
				error = true;
				$(this).parent().find("label").css("color", "#c00");
				ErrorString = ErrorString + "Please enter a value for: " + TheFieldName + "\n";
			}
			else 
			{
				$(this).parent().find("label").css("color", "#666");
			}
		});
		/* CHECK IF EMAIL ADDRESS IS VALID */
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		EmailAddress = $(this).parent().parent().parent().find(".email").val();
		if(!emailReg.test(EmailAddress)) {
            ErrorString = "ERROR\n\nPlease enter a valid Email Address";
            error = true;
			$(this).parent().parent().parent().find(".email").parent().find("label").css("color", "#c00");
        }
		/* SUBMIT FORM IF NO ERRORS */	
		if (error == false){
			$(this).parent().parent().parent().submit();
		}
		/* DISPLAY ALERT IF ERRORS */
		else
		{
			$(this).parent().parent().parent().find('p:first').prepend('<strong style="color: #c00" class="ErrorMessage">Errors in form submission data, please review the highlighted fields<br /><br /></strong>');
			return false;
		}
	});
});


	
