$(document).ready(function() {	
		$("img.rollover").hover(
		 function() { this.src = this.src.replace("_off","_on"); },
		 function() { this.src = this.src.replace("_on","_off"); });
		 
		 $("input.rollover").hover(
		 function() { this.src = this.src.replace("_off","_on"); },
		 function() { this.src = this.src.replace("_on","_off"); });

		$(".backtotop").mouseenter (
		 	function() { $("#arrowUp").attr("src", "images/SF_MISC_Arrows/SF_Arrow_Up_on.gif"); }
		);
		
		$(".backtotop").mouseleave (
		 	function() { $("#arrowUp").attr("src", "images/SF_MISC_Arrows/SF_Arrow_Up_off.gif"); }
		);
		
		$("#backtoteacher").mouseenter (
		 	function() { $("#arrowTeacherBack").attr("src", "images/SF_MISC_Arrows/SF_Arrow_Backward_on.gif"); }
		);
		
		$("#backtoteacher").mouseleave (
		 	function() { $("#arrowTeacherBack").attr("src", "images/SF_MISC_Arrows/SF_Arrow_Backward_off.gif"); }
		);
		
		$("#backtoteacher1").mouseenter (
		 	function() { $("#arrowTeacherBack1").attr("src", "images/SF_MISC_Arrows/SF_Arrow_Backward_on.gif"); }
		);
		
		$("#backtoteacher1").mouseleave (
		 	function() { $("#arrowTeacherBack1").attr("src", "images/SF_MISC_Arrows/SF_Arrow_Backward_off.gif"); }
		);
		
		$(".navDropDown").mouseenter (
			function() { $(".navDropDown").show(); }
		);
		
		$(".navDropDown").mouseleave (
			function() { 
				hideDropDown();
			}
		);
		
		$("#subDrop1").mouseenter (
			function() { $("#subDropDiv1").css('visibility', 'visible'); }
		);
		
		$("#subDrop1").mouseleave (
			function() { $("#subDropDiv1").css('visibility', 'hidden'); }
		);
	});
	
	function hideDropDown() {
		for (var i = 1; i <= 5; i++) {
			thisNav = "nav" + i;
			
			document.getElementById(thisNav).style.visibility = "hidden";
			$(".navRollImage").each(function() {
				rollsrc = $(this).attr("src");
				rollON = rollsrc.replace(/_on.gif$/ig,"_off.gif");
				$(this).attr("src", rollON);
			});
		}	
	}
	
	function showDropDown(whichDrop) {
		
		hideDropDown();
		if (whichDrop <= 5) {
			openNav = "nav" + whichDrop;
			document.getElementById(openNav).style.visibility = "visible";
		}
		
		changeImage = "#navImage" + whichDrop;
		rollsrc = $(changeImage).attr("src");
		rollON = rollsrc.replace(/_off.gif$/ig,"_on.gif");
		$(changeImage).attr("src", rollON);
		
	}


	function validateForm() {
		if (document.getElementById("fname").value == "") {
			alert("You must type in your name");
			return false;	
		}
		return true;
	}

	function validateTwoAppForm() {
		var retval = true;
		var objForm = document.forms['topapp'];
		if ( objForm.fname.value == "" || objForm.lname.value == "" ) {
			alert("You must type in your full name"); retval = false;
		} else if ( objForm.address.value == "" || objForm.city.value == "" || objForm.state.value == "" || objForm.zipcode.value == "" ) {
			alert("You must type in your full address (address, city, state, zip code)"); retval = false;	
		} else if ( objForm.email.value == "" || objForm.phoneno.value == "" ) {
			alert("You must type in your contact information (email, phone)"); retval = false;	
		} else if ( objForm.q1.value == "" || objForm.q2.value == "" || objForm.q3.value == "" || objForm.q4.value == "" || objForm.q5.value == "" || objForm.q6.value == "" || objForm.q7.value == "" || objForm.q8.value == "" || objForm.q9.value == "" || objForm.q10.value == "" || objForm.q11.value == "" || objForm.q12.value == "" || objForm.q13.value == "" || objForm.q14.value == "" || objForm.q15.value == "" || objForm.q16.value == "" || objForm.q17.value == "" || objForm.q18.value == "" || objForm.q19.value == "" || objForm.q20.value == "" || objForm.q21.value == "") {
			alert("You must answer all questions."); retval = false;
		} else if ( objForm.which_app.value == "" ) {
			alert("You must select the teacher training you are applying for"); retval = false;	
		} else if ( !objForm.q22.checked ) {
			alert("You must submit a payment before or shortly after submitting your application. Applications without payment will not be considered."); retval = false;	
		} else if ( objForm.captcha.value == "" ) {
			alert("You must type in the security code"); retval = false;	
		}
		return retval;
	}

	function validateThreeAppForm() {
		var retval = true;
		var objForm = document.forms['topapp'];
		if ( objForm.fname.value == "" || objForm.lname.value == "" ) {
			alert("You must type in your full name"); retval = false;
		} else if ( objForm.address.value == "" || objForm.city.value == "" || objForm.state.value == "" || objForm.zipcode.value == "" ) {
			alert("You must type in your full address (address, city, state, zip code)"); retval = false;	
		} else if ( objForm.email.value == "" || objForm.phoneno.value == "" ) {
			alert("You must type in your contact information (email, phone)"); retval = false;	
		} else if ( objForm.q1.value == "" || objForm.q2.value == "" || objForm.q3.value == "" || objForm.q4.value == "" || objForm.q5.value == "" || objForm.q6.value == "" || objForm.q7.value == "" || objForm.q8.value == "" || objForm.q9.value == "" || objForm.q10.value == "" || objForm.q11.value == "" || objForm.q12.value == "" || objForm.q13.value == "" || objForm.q14.value == "" || objForm.q15.value == "" || objForm.q16.value == "" || objForm.q17.value == "" ) {
			alert("You must answer all questions."); retval = false;
		} else if ( !objForm.q18.checked ) {
			alert("You must submit a payment before or shortly after submitting your application. Applications without payment will not be considered."); retval = false;	
		} else if ( objForm.captcha.value == "" ) {
			alert("You must type in the security code"); retval = false;	
		}
		return retval;
	}
