$(document).ready(function(){
	$("#form_2").hide();
	setTimeout(function(){$("#startnow").animate( { top:"-20px" } , 400 ).effect("bounce", { direction:"up", distance:40, times:3 }, 300)}, 4000);
				   
    $("#next").click(function(){
		form_next();
		return false;
	}); 
	
	$("#back").click(function(){
		form_previous();
		return false;
	});
	
});

function form_next(){
	    $("#form_1").hide();
		$("#form_2").fadeIn(500);}
		
function form_previous(){
		$("#form_2").hide();
		$("#form_1").fadeIn(100);}

function shakeError(div,errortext){
	var divError = $("#SSA_form").find("#"+div);
	$(divError).val(errortext).css({'color' : 'red', 'font-weight' : 'bold'});
	$(divError).effect("shake", { times: 3 }, 100);
	$(divError).focus(function () {
	   $(divError).val('').css({"color" : "black", 'font-weight' : 'normal'});			
								});
}


function validate(theForm)
				{
					var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
					var phoneExp = /\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/;
					
					if (theForm.campus.value === ""){ 
				    form_previous();
					shakeError("campus","Please Choose");
					return (false);}
					
					if (theForm.program.value === ""){ 
				    form_previous();
					shakeError("program","Please Choose");
					return (false);}
					
				    if (theForm.fname.value === ""){
					form_previous();
					shakeError("fname","Enter First Name");
					return (false);}
					
				    if (theForm.lname.value === ""){
					form_previous();
					shakeError("lname","Enter Last Name");
					return (false);}
					
				    if (!theForm.email.value.match(emailExp)){
					form_previous();
					shakeError("email","Enter Valid Email");
					return (false);}
					
				    if (!theForm.phone1.value.match(phoneExp)){
					form_previous();
					shakeError("phone1","Enter Your Full Phone #");
					return (false);}
					
					if (theForm.contact_time.value === ""){ 
				    form_previous();
					shakeError("contact_time","Please Choose");
					return (false);}
					
				    if (theForm.address.value === ""){
					shakeError("address","Enter Your Address");
					return (false);}
					
				    if (theForm.city.value === ""){
					shakeError("city","Enter Your City");
					return (false);}
					
				    if (theForm.state.value === ""){
					shakeError("state","Choose Your State");
					return (false);}
					
				    if (theForm.zip.value === ""){
					shakeError("zip","Enter Your Zip");
					return (false);}
					
				    if (theForm.preveduc.value === ""){
					shakeError("preveduc","Please Choose");
					return (false);}
					
					if (theForm.grad_year.value === ""){
					shakeError("grad_year","Please Choose");
					return (false);}
					
				    if (theForm.start_time.value === ""){
					shakeError("start_time","Please Choose");
					return (false);}

				  return true; 
				  }
				  