window.addEvent('domready', function() {
  var claims_direct_accordion = new Accordion($('claimsdirect'), 'h3.toggler', 'div.element', {
    opacity: false,
    onActive: function(toggler, element){
      toggler.toggleClass('active');
    },
    onBackground: function(toggler, element){
      toggler.removeClass('active', false);
    }
  });
  $$("#body_area").addEvent('change', function(){
    $$('#injury_type option').dispose();
    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;
    };
    (new Element('option', {'value': '', 'text':'Injury Type'})).inject($('injury_type'));
    a.each(function(e) {
      (new Element('option', {'text':e[0], 'value': e[1]})).inject($('injury_type'));
    })        
  });
  $$('#injury_type').addEvent('change', function(){
    if (this.value != '') {
      $$('#amount p').set('html', "Typical Compensation:<br /><span>"+this.value+"</span>");
    } else {
      $$('#amount p').set('html', "Please choose an <span>area of the body</span> and <span>injury type</span>");
    }
  });
  $$('#body_area').fireEvent('change');
});
