$(document).ready(function(){
	$("#points_calculator_aus_176_form").submit( function(){
		var title, full_name, marital_status, email_address, cell_number, dd, mm, yyyy, resident, want_to_go_countries, why_want_visa, highest_qualification, field_of_study, rate_english, current_occupation, employment_type, experience, otherInformation, partner_skill;
		title = $("#title").val();
		full_name = $("#full_name").val();
		email_address = $("#email_address").val();
		cell_number = $("#cell_number").val();
		dd = $("#dd").val();
		mm = $("#mm").val();
		yyyy = $("#yyyy").val();
		current_occupation = $("#current_occupation").val();
		partner_skill = $("#partner_skill_yes").attr('checked');
		var errors = "";	
		if( $.trim(full_name) == '' )
		{ 
			errors += "Full Name Required.\n";
		}
		if( $.trim(email_address) == '' )
		{
			errors += "Email Address Required.\n";
		} 
		else if( !validateEmail(email_address) )
		{
			errors += "Invalid Email Address.\n";
		}
		if( $.trim(cell_number) == '' )
		{
			errors += "Mobile Number Required.\n";
		} 
		else if( cell_number.length < 10 )
		{
			errors += "Invalid Mobile Number.\n";
		}
		/*if(!partner_skill) 
		{
			errors += "Partner skill is compulsory in order to calculate the points.\n";
		}*/
		if( errors != "" )
		{
			alert( "Points calculator has the following errors:\n" + errors );
			return false;
		}

		return true;	

	});
	
	$("#uk_tier1_visa_eligibility_points_calculator_form").submit( function(){
		var age, title, full_name, marital_status, email_address, cell_number, dd, mm, yyyy, resident, highest_qualification, field_of_study, rate_english, current_occupation, employement, work_experience, earnings, uk_experience, maintenance_funds;
		
		age = $("#age").val();
		title = $("#title").val();
		full_name = $("#full_name").val();
		marital_status = $("#marital_status").val();
		email_address = $("#email_address").val();
		cell_number = $("#cell_number").val();
		dd = $("#dd").val();
		mm = $("#mm").val();
		yyyy = $("#yyyy").val();
		resident = $("#resident").val();
		highest_qualification = $("#highest_qualification").val();
		field_of_study = $("#field_of_study").val();
		rate_english = $("#rate_english").val();
		current_occupation = $("#current_occupation").val();
		employement = $("#employement").val();
		work_experience = $("#work_experience").val();
		earnings = $("#earnings").val();
		uk_experience = $("#uk_experience").val();
		maintenance_funds = $("#maintenance_funds").val();
		
		 if( age == "" )
		 {
			alert("Please select age.");
			return false;
		 }
		 if( title == "" )
		 {
			alert("Please select title.");
			return false;
		 }
		 if( full_name == "" )
		 {
			alert("Please fill Full Name.");
			return false;
		 }
		 if( marital_status == "" )
		 { 
			alert("Please select your Marital Status.");
			return false;
		}
		if( email_address == "" )
		{
			alert("Please fill your email.");
			return false;
		}
		if( cell_number == "" )
		{
			alert("Please fill your cell number.");
			return false;
		} 
		if( dd == "" || mm == "" || yyyy == "" )
		{
			alert("Please fill you dob.");
			return false;
		} 
		if( resident == "" )
		{
			alert("Please select your resident.");
			return false;
		}
		if( highest_qualification == "" )
		{
			alert("Please select your qualification.");
			return false;
		}
		if( field_of_study == "" )
		{
			alert("Please select your field of study.");
			return false;
		}
		if( rate_englisha == "" )
		{
			alert("Please rate your english.");
			return false;
		}
		if( current_occupation == "" )
		{
			alert("Please select your current occupation.");
			return false;
		}
		if( employement == "" )
		{
			alert("Please select your employement.");
			return false;
		}
		if( work_experience == "" )
		{
			alert("Please selct your work experience.");
			return false;
		}
		if( earnings == "" )
		{
			alert("Please select your earnings.");
			return false;
		}
		if( uk_experience == "" )
		{
			alert("Please select uk experience.");
			return false;
		}
		if( maintenance_funds == "" )
		{
			alert("Please select Maintenance funds.");
			return false;
		}
		return true;	
	});
	
	$("#points_calculator_hk_form").submit( function(){
		var title, full_name, email_address, cell_number, dd, mm, yyyy, current_occupation;
		title = $("#title").val();
		full_name = $("#full_name").val();
		email_address = $("#email_address").val();
		cell_number = $("#cell_number").val();
		dd = $("#dd").val();
		mm = $("#mm").val();
		yyyy = $("#yyyy").val();
		current_occupation = $("#current_occupation").val();
		var errors = "";	
		if( $.trim(full_name) == '' )
		{ 
			errors += "Full Name Required.\n";
		}
		if( $.trim(email_address) == '' )
		{
			errors += "Email Address Required.\n";
		} 
		else if( !validateEmail(email_address) )
		{
			errors += "Invalid Email Address.\n";
		}
		if( $.trim(cell_number) == '' )
		{
			errors += "Mobile Number Required.\n";
		} 
		else if( cell_number.length < 10 )
		{
			errors += "Invalid Mobile Number.\n";
		}
		if(!current_occupation) 
		{
			errors += "Current Occupation is Required.\n";
		}
		if( errors != "" )
		{
			alert( "Points calculator has the following errors:\n" + errors );
			return false;
		}

		return true;	

	});
	
})

