//jjjjjjjjjjjjjjjjjjjjjjjjjcalendarjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
//AGE CONTROL JAVASCRIPT
var g_s_field_name = "";
var g_s_next_tab_field_name = "";

//==========================================================
//FUNCTION TO SET FIELD NAME, AND SHOW AGE CONTROL
function init_ctrl_age(s_field_name,s_next_tab_field_name){
  
  //SET FIELD NAME FOR CALLBACK
  try{
    g_s_field_name = s_field_name;
    g_s_next_tab_field_name = s_next_tab_field_name;}
  catch(err){alert ("Error, ctrl_age.init_ctrl_age- Could not set global field names.");}  

  //SHOW AGE CONTROL
  try{
    display_div_age('visible');}
  catch(err){alert ("Error, ctrl_age.init_ctrl_age- Could not show control age.");}  
  }
  
  
//==========================================================
//FUNCTION TO SAVE VALUE, AND HIDE AGE CONTROL
function exit_ctrl_age(s_age){
  //SET FORM FIELD VALUE TO THE CLICKED SELECTION
  if (!s_age){s_age="";}
  
  //SET CONTROL TO THE SELECTED VALUE
  try{
    var age_form_field = document.getElementById(g_s_field_name);
    age_form_field.value = s_age;}
  catch(err){alert ("Error, ctrl_age.exit_ctrl_age- Could not set the field to the selected value.");}
  
  //HIDE AGE CONTROL
  try{
    display_div_age('hidden');}
  catch(err){alert ("Error, ctrl_age.exit_ctrl_age- Could not hide the age control.");}

  //SET FORM FILED FOCUS TO NEXT CONTROL
  try{
    var next_tab_field_name = document.getElementById(g_s_next_tab_field_name);
    next_tab_field_name.focus();}
  catch(err){alert ("Error, ctrl_age.exit_ctrl_age- Could not set focus on the next field.");}
  

  }
  
//==========================================================
//FUNCTION FOR SHOWING AND HIDING AGE CONTROL
function display_div_age(s_showhide){
  
  //ACTIVATE THE CONTROL AND BLOCKING DIVS
  try{
    document.getElementById('div_hover_age').style.display = "block";
    document.getElementById('div_hover_block').style.display = "block";}
  catch(err){alert ("Error, ctrl_age.display_div_age- Could not display age control.");}  
  
  //ENABLE/DISABLE CONTROLS
  try{
    if (s_showhide=='hidden'){
      disable_controls(false);
      }
    else{
      disable_controls(true);
      }
    }
  catch(err){alert ("Error, ctrl_age.display_div_age- Could not enable/ disable age control.");}  
  
  //SHOW OR HIDE THE DIVS
  try{
    document.getElementById('div_hover_age').style.visibility = s_showhide; 
    document.getElementById('div_hover_block').style.visibility = s_showhide;
    }
  catch(err){alert ("Error, ctrl_age.display_div_age- Could not show/ hide the divs.");}

} 

//END AGE CONTROL JAVASCRIPT
//jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj