
function bookingslots( slots )
{
  if( parseInt( slots ) )
  {
    var output = '';
  
    for( a=1; a<=slots; a++ )
    {
      output += '<div class="participant"><p><strong>Participant '+a+'</strong></p><p>Name: <input type="text" id="participant'+a+'name" /> &nbsp; Age*: <select id="participant'+a+'age"><option value="0-3 years">0-3 years</option><option value="3-6 years">3-6 years</option><option value="6-12 years">6-12 years</option><option value="12-18 years">12-18 years</option><option value="18 years+" selected="selected">18 years+</option></select><br /><span>*If this is a parent and child class please enter the childs age.</span></p></div>';
    }
      
    document.getElementById('slots').innerHTML = output;
  }
}

function setDescription()
{
  if( !document.getElementById('tc').checked )
  {
    alert('Please accept the terms and conditions before continuing');
    return(false);
  }
  
  if( !document.getElementById('name').value || !document.getElementById('add1').value || !document.getElementById('add3').value || !document.getElementById('postcode').value || !document.getElementById('email').value )
  {
    alert('Please complete the required contact fields');
    return(false);
  }

  var output = '';
  
  for( a=1; a<=document.getElementById('item_quantity_1').value; a++ )
  {
    if( document.getElementById('participant'+a+'name').value )
    {
      if( a > 1 )
        output += '|';
        
      output += document.getElementById('participant'+a+'name').value + ' ('+ document.getElementById('participant'+a+'age').value +')';
    }
    else
    {
      alert('Please enter a name for each participant');
      return(false);
    }
  }
  document.getElementById('item_description_1').value += output;
}

function setApron()
{
  var quantity = document.getElementById('iq2').value;
  var output = '<input type="hidden" name="item_quantity_2" id="item_quantity_2" value="'+quantity+'" />';
  
  if( quantity != 0 )
    document.getElementById('item2').innerHTML = output;
  else
    document.getElementById('item2').innerHTML = '';
}