/*---------------*/
/* Sign-Up Pages */
/*---------------*/

jQuery(document).ready(function($) {
    
  // establish the light box capabilities to show terms
  $('#rpr-terms-and-conditions-link').click(function(e) {
    e.preventDefault();
    
    // duplicate the hidden html content in lightbox including all handlers 
    rpr__lightbox.open($('.rpr-hidden .rpr-terms-and-conditions').clone(true));
  });

  // enable the step submission buttons to function
  $('#rpr-signup-step-1-submit').click(function(e) {
    var f = $('#rpr-signup-form');
    f.children('input.action').val('step1_submit');
    f.get(0).submit();
  });
  $('#rpr-signup-step-2-submit').click(function(e) {
    var f = $('#rpr-signup-form');
    f.children('input.action').val('step2_submit');
    f.get(0).submit();
  });
  $('#rpr-signup-step-3-submit').click(function(e) {
    var f = $('#rpr-signup-form');
    f.children('input.action').val('step3_submit');
    f.get(0).submit();
  });
  
  // explicitly associate each arrow indicator with the proper panel
  $('#rpr-signup-step-1-arrow').data('panel', $('#rpr-signup-step-1'));
  $('#rpr-signup-step-2-arrow').data('panel', $('#rpr-signup-step-2'));
  $('#rpr-signup-step-3-arrow').data('panel', $('#rpr-signup-step-3'));
  
  // add the handler which enable the step arrows to properly
  // switch the current form panel and adjust their appearance
  $('.rpr-step-arrows .arrow').click(function(e) {
    e.preventDefault();
    if (!$('#rpr-signup-step-4').hasClass('rpr-hidden')) return;
    $('#rpr-signup-form .signup-step').addClass('rpr-hidden');
    $('.rpr-step-arrows .arrow').removeClass('active');
    $(this).addClass('active');
    $(this).data('panel').removeClass('rpr-hidden');
    rpr__align_rounded_button_labels();
  });
  
  // show the complimentary service code input form when
  // prospect has selected none for coach specific training
  $('#rpr-signup-training-select').change(function(e) {
    if ($(this).val() == $('#rpr-signup-training-none').text())
      $('#rpr-signup-complimentary-service-code').show();
    else $('#rpr-signup-complimentary-service-code').hide();
  });

});









