function validate_step_1(){
	
	var next = true;
	
	/*$("#step_1 table tr td :input").each(function(){
		$(this).removeClass("apply_now_error_field");
	});
	
	$("#step_1 table tr td :input").each(function(){
		//alert($(this).attr("name"));
		
		if(	$(this).val() == ""	&& next){
			alert("Please fill all the required fields");
			$(this).addClass("apply_now_error_field");
			$(this).focus();
			
			next = false;
		}
	});*/
	
	if(next){
		$("#step_1").hide();
		$("#step_2").show();
	}
	else{
		return false;
	}
}

function validate_step_2(){
	$("#step_2").hide();
	$("#step_3").show();
}

function validate_step_3(){
	$("#step_3").hide();
	$("#step_4").show();
}

function validate_step_4(){
	$("#step_4").hide();
	$("#step_5").show();
}

function go_back(current_step){
	
	var previous_setp = current_step - 1;
	
	$("#step_"+current_step).hide();
	$("#step_"+previous_setp).show();
	
}

function check_parent(){
	
	var is_father 	= $("#guardian_type_father");
	var is_mother 	= $("#guardian_type_mother");
	var type 		= "";
	
	var	id			= $("#parent_personal_id").val();
	var email		= $("#parent_email").val();
	
	if(is_mother.attr("checked")){
		type = "mother";
	}
	if(is_father.attr("checked")){
		type = "father";
	}
	
	$.ajax({
		type: 	'post',
		url:	'http://www.lighthouse.ed.cr/site/admissions/check_parent/',
		data: 	'type='+type+'&id='+id+"&email="+email,
		success: function(response){
		
			var return_array	= response.split("|");
			var return_code		= return_array[0];
			var return_value	= return_array[1];
			
			if(return_code == "ok"){
				//alert(return_value);
				$("#parents_info_ajax").html(return_value);
				$("#parents_info_ajax").show();
			}
			else{
				//alert("error");
				$("#parents_info_ajax").show();
				
				$("#"+type+"_personal_id").val($("#parent_personal_id").val());
				$("#"+type+"_email").val($("#parent_email").val());
				
				$("#parents_info_check").hide();
			}
		}
	});
}

