// JavaScript Document
function get_group(mnd,pid)
{
	var data="st=get_grade_details&grade_id="+mnd;
	//alert(data);
	jQuery.ajax({
			url: 'include/ajax1.php',
			type: "POST",
			cache: false,
			data: data,
			success: function (res) {
				//alert(res);
				var res1=res.split('~');
				html='<option value="">Select Grade</option>';
				for(i=1;i<res1.length;i++)
				{
					var ress=res1[i].split('=');
					html+="<option value="+ress[0]+">"+ress[1]+"</option>";
				}
				$('#grade').html(html);
				$('#grade').val(pid);
			}
		});
} 

function get_age()
{
 		var dob = new Date($('#dob').val());
		var today = new Date();
			
		var age = today.getFullYear() - dob.getFullYear();
		var m = today.getMonth() - dob.getMonth();
			
			if (m < 0 || (m === 0 && today.getDate() < dob.getDate())) 
			{
						age--;
			}
			
		$("#age").val(age);
		$("#age_details").html(age+" Years");
		
		get_group(age,'');
		
		/*if(age>=2 && age<=4)
		{
			var main="<option value='"+age+"'>First Class</option>";
			$("#grade").html(main);
		}*/
}

function get_school(grade)
{ 
	if(grade>=3 && grade<=5)
	{
		var main="<option value='"+grade+"'>Elementary School (Grade 3-5)</option>";
	}
	
	if(grade>=6 && grade<=8)
	{
		var main="<option value='"+grade+"'>Middle School (Grade 6-8)</option>";
	}
	
	if(grade>=9 && grade<=12)
	{
		var main="<option value='"+grade+"'>High School (Grade 9-12) </option>";
	}
	$("#school").html(main);
}

