/* --------------------------------------------------------------------- */
/* StudentCity.com
/* 
/* @author  Timothy Haroutunian [th] <tharoutunian@studentcity.com>
/* --------------------------------------------------------------------- */

$(document).ready(function(){
	if($('#form_step').length > 0){
		if($("#form_step").val() == "process_form"){
			
		}else if($("#form_step").val() == "interviews"){
			$("#take_interview").validationAideEnable(null, {inlineShowSpeed:"fast"});
		}else{
			var myRules = jQuery.validationAide.getDefaultValidationRules(); 
			myRules.add('validator-passwords', 'Passwords do not match', function(fieldValue, fieldObj){if($("#password1").val() != $("#password2").val())return false; return true; });
			$("#campus_rep_manager").validationAideEnable(myRules, {inlineShowSpeed:"fast"});
			if($("#hear_about_select1").change(function(){
				$("#hear_about_addon").html("");
				$("#hear_about_notes").html("");
				$.ajax({type:"GET", url:"/lib/ajax/reps_ajax.php", data:"drop_down=1&hear_about_id="+$("#hear_about_select1").val(), success: function(data){
					$("#hear_about_addon").append(data);
				}});
				$.ajax({type:"GET", url:"/lib/ajax/reps_ajax.php", data:"text_field=1&hear_about_id="+$("#hear_about_select1").val(), success: function(data){
					$("#hear_about_addon").append(data);
				}});
				$.ajax({type:"GET", url:"/lib/ajax/reps_ajax.php", data:"other=1&hear_about_id="+$("#hear_about_select1").val(), success: function(data){
					if($("#hear_about_select2")){
						if($("#hear_about_select2").change(function(){
							$("#hear_about_notes").html("");
							$("#hear_about_notes").append("<input type='hidden' name='hear_about_rep_code' id='hear_about_rep_code' value='"+$("#hear_about_select2").val()+"' />");
							$("#hear_about_notes").append(data);
						}));
					}else if($("#hear_about_text_field2")){
						$("#hear_about_notes").html("");
						$("#hear_about_notes").append("<input type='hidden' name='hear_about_rep_code' id='hear_about_rep_code' value='"+$("#hear_about_text_field2").val()+"' />");
					}
					$("#hear_about_notes").append(data);
				}});
			}));
		}
	}
});
