var edt_bg_clr = "#ffffff";

// Switch 'year to' fields for student or staff on user registration and edit
function edu_year_chk(rb_usr_tp, ddl_y_to_nm, ddl_y_to_staff_nm) {
  
  // Check control`s ID
  if(null == rb_usr_tp || null == ddl_y_to_nm || null == ddl_y_to_staff_nm)
    return;

  // Get student`s year to control
  var y_to = document.getElementById(ddl_y_to_nm);
  if(null == y_to)
    return;

  // Get staff`s year to control
  var y_to_staff = document.getElementById(ddl_y_to_staff_nm);
  if(null == y_to_staff)
    return;

  // Get radiobuttons list
  var btns = document.getElementById(rb_usr_tp);
  if(null == btns)
    return;

  // Get radiobuttons
  var btnss = btns.getElementsByTagName('input');
  if(null == btnss)
    return;

  // Check radiobuttons set
  
  // Students check
  if(btnss[0].checked) {
    y_to.disabled = false;
    y_to.style.display = '';
    y_to_staff.style.display = 'none';
    return;
  }
  // Staff check
  if(btnss[1].checked){
    y_to.style.display = 'none';
    y_to_staff.style.display = '';
    return;
  }
  // No check - staff hide, student show, student disable
  y_to.disabled = true;
  y_to.style.display = '';
  y_to_staff.style.display = 'none';
} // edu_year_chk()


// Hide maiden field on select 'man' on registration and edit
function maiden_nm_hide(maiden_sw_ctrl_id, maiden_flds_css) {

  // Check parameters
  if(null == maiden_sw_ctrl_id || null == maiden_flds_css)
    return;

  // Get switch control
  var maiden_sw_ctrl = document.getElementById(maiden_sw_ctrl_id);
  if(null == maiden_sw_ctrl) 
    return;

  // Get elements for hide
  var hide_ctrls = document.getElementsByClassName(maiden_flds_css);

  // Check exist elements
  if(null == hide_ctrls || 0 == hide_ctrls.length) 
    return;

  // Hide-show elements
  for (var i = 0; i < hide_ctrls.length; i++) {
    hide_ctrls[i].style.display = (0 == maiden_sw_ctrl.selectedIndex) ? 'none' : '';
  }
} // maiden_nm_hide()


// Change button by 'use'/'not use' LinkedIn radiobutton on user registration and edit
function li_use_switch(rb_use_li_id, btn_next_id, btn_next_li_id) {

  // Check parameters
  if(null == rb_use_li_id || null == btn_next_id || null == btn_next_li_id )
    return;

  // Get button 'next'
  var btn_next = document.getElementById(btn_next_id);
  if(null == btn_next) 
    return;

  // Get hidden with 'not use LI' value
  var btn_next_li = document.getElementById(btn_next_li_id);
  if(null == btn_next_li)
    return;

  // Get radiobuttons list
  var btns_lst = document.getElementById(rb_use_li_id);
  if(null == btns_lst)
    return;

  // Get radiobuttons
  var btns = btns_lst.getElementsByTagName('input');
  if(null == btns)
    return;

  // Check radiobuttons set

  // 'Use LI' check
  if(btns[1].checked) {
    btn_next.style.display = 'none';
    btn_next_li.style.display = '';
    return;
  }

  // Default value or select 'Not use LI'
  btn_next.style.display = '';
  btn_next_li.style.display = 'none';
} // li_use_switch()

