jQuery(document).ready(function() {
  $('#claims-direct-accordion').accordion();
  $('#claims-direct-accordion').bind('accordionchangestart', function(event, ui) {
    ui.newHeader.addClass('active');
    ui.oldHeader.removeClass('active');
  });
  $("#body_area").bind('change', function(){
    $('#injury_type').empty();
    switch(this.value) {
      case '':
        a = []; break;
      case 'head':
        a = [['Brain Damage', '&pound;9,875 to &pound;257,750'], ['Minor Head Injury', '&pound;1,400 to &pound;8,100'], ['Facial Injuries', '&pound;1,500 to &pound;62,000'], ['Eye Injuries', '&pound;2,500 to &pound;172,500'], ['Ear Injuries', '&pound;8,000 to &pound;70,000'], ['Whiplash/General Neck injuries', '&pound;850 to &pound;95,000'], ['Psychiatric Damage', 'up to &pound;64,250']];
        break;
      case 'torso':
        a = [['Whiplash/General Neck injuries', '&pound;850 to &pound;95,000'], ['Back injuries', '&pound;5,000 to &pound;108,000'],
        ['Shoulder Injuries', '&pound;2,750 to &pound;30,750'], ['Chest and Lung Injuries', '&pound;20,000 to &pound;35,000'], ['Asbestos-related Lung disease', '&pound;30,750 to &pound;81,500'], ['Fractured ribs', 'up to &pound;2,500'], ['Food poisoning', '&pound;600 to &pound;33,500'], ['Quadriplegia', '&pound;206,750 to &pound;257,750'], ['Paraplegia', '&pound;140,000 to &pound;181,500']];
        break;
      case 'arm':
        a = [['Arm Injuries', 'up to &pound;191,500'], ['Shoulder injuries', '&pound;2,750 to &pound;30,750'], 
        ['Wrist Injuries', '&pound;2,250 to &pound;38,250'], ['Hand injuries', '&pound;600 to &pound;129,000'], 
        ['Finger Injuries', 'up to &pound;23,500'], ['Loss of thumb', '&pound;22,750 to &pound;35,000'], 
        ['Vibration White Finger / Hand Arm Vibration Syndrome', '&pound;1,900 to &pound;20,250']];
        break;
      case 'leg':
        a = [['Leg Injuries', '&pound;5,750 to &pound;180,000'], ['Knee Injuries', 'up to &pound;61,500'], ['Ankle Injuries', 'up to &pound;32,000'],
        ['Foot Injuries', 'up to &pound;128,500'], ['Toe Injuries', 'up to &pound;36,000']];
        break;
    };
    $('#injury_type').append('<option value="">Injury Type</option>');
    $.each(a, function(index, value) {
      $('#injury_type').append('<option value="'+value[1]+'">'+value[0]+'</option>');
    });
    $('#injury_type').bind('change', function(){
      if (this.value != '') {
        $('#amount p').html("Typical Compensation:<br /><span>"+this.value+"</span>");
      } else {
        $('#amount p').html("Please choose an <span>area of the body</span> and <span>injury type</span>");
      }
    });
    $('#injury_type').trigger('change');
  });
});
