let highest_edu_comp=0;
let location_completed_canada=0;
let eng_fre_proficiency=0;
let bilingual_proficiency=0;
let total_work_exp=0;
let work_exp_canada=0;
let age=0;
let family_connection=0;
let job_offer_alberta=0;
let job_offer_rural=0;
let job_offer_location=0;
let job_offer_regulated=0;

$(document).ready(function(){

  $('.highest_edu_comp').click(function(){
    highest_edu_comp = ($(this).prop("checked")) ? parseInt($(this).val()) : 0;
    showPoints5();
   });

$('.location_completed_canada').click(function(){
    location_completed_canada = ($(this).prop("checked")) ? parseInt($(this).val()) : 0; 
    showPoints5();
  });
   
$('.eng_fre_proficiency').click(function(){
    eng_fre_proficiency = ($(this).prop("checked")) ? parseInt($(this).val()) : 0;
    showPoints5();
 });

 $('.bilingual_proficiency').click(function(){
    bilingual_proficiency = ($(this).prop("checked")) ? parseInt($(this).val()) : 0;
    showPoints5();
 });

$('.total_work_exp').click(function(){
    total_work_exp = ($(this).prop("checked")) ? parseInt($(this).val()) : 0;
    showPoints5();
   });

$('.work_exp_canada').change(function(){ 
    work_exp_canada = parseInt($(this).val());
    showPoints5();
   });
 
$('.age').change(function(){
    age = parseInt($(this).val());
    showPoints5();
   });  

$('.family_connection').change(function(){ 
    family_connection = parseInt($(this).val());
    showPoints5();
   });

$('.job_offer_alberta').click(function(){
    job_offer_alberta = ($(this).prop("checked")) ? parseInt($(this).val()) : 0;
    showPoints5();
   });
   
$('.job_offer_rural').click(function(){
    job_offer_rural = ($(this).prop("checked")) ? parseInt($(this).val()) : 0;
    showPoints5();
   });
   
$('.job_offer_location').click(function(){
   job_offer_location = ($(this).prop("checked")) ? parseInt($(this).val()) : 0;
   showPoints5();
  });
  
$('.job_offer_regulated').click(function(){
  job_offer_regulated = ($(this).prop("checked")) ? parseInt($(this).val()) : 0;
  showPoints5();
 });  

 
 
});

showPoints5 = ()=>{
 let final_points=0;
 final_points = highest_edu_comp+location_completed_canada+eng_fre_proficiency+bilingual_proficiency+total_work_exp+work_exp_canada+age+family_connection+job_offer_alberta+job_offer_rural+job_offer_location+job_offer_regulated; 
 $('.final_points').val(final_points);
}