google.load("jquery","1.4.2");

google.setOnLoadCallback(function(){
	
	$.ajaxSetup({async: false});
	$.getScript("js/jquery.cycle.all.2.72.js");
	$.ajaxSetup({async: true});
	
	$.ajaxSetup({async: false});
	$.getScript("js/jquery.colorbox.js");
	$.ajaxSetup({async: true});
	
	$(".popups").colorbox();
	$("#aFpopup").colorbox({width:"50%", inline:true, href:"#aquaticsForm"});

	
	$(".iframePopup").colorbox({ width:"80%", height:"80%", iframe: true });
	
	$('#slideshow').cycle({ 
		fx:    'fade', 
		speed:  2500 
	});
	
});

function submitContact() {

	formIsLegit=true;
	
	$("input.required").css("borderStyle","solid").css("borderWidth","1px");

	// If this is the full register option, check all variables, otherwise only 
	// check the required fields for contact us.
	if($("input[name=j_This_Form_is_to]:checked").val() == "Register for Aquatics Program")
	{
	
	$("input.required").each(function() {			
		
		if($(this).attr("value").length<1) {
			formIsLegit=false;
			$(this).css("borderStyle","dashed").css("borderWidth","2px");
		}
								 
								 });
	}	else
	{
		if($("input[name=a_Full_Name]").attr("value").length<1) {
			formIsLegit=false;
			$("input[name=a_Full_Name]").css("borderStyle","dashed").css("borderWidth","2px");
		}
		if($("input[name=b_Email_Address]").attr("value").length<1) {
			formIsLegit=false;
			$("input[name=b_Email_Address]").css("borderStyle","dashed").css("borderWidth","2px");
		}
	}
	
	if(formIsLegit) { return true; } else { alert("Please fill out all required form fields."); return false; }

}
