function check_form ()
{
  var form = document.consultation;

  /* ALL INPUTS
  expectations
  reasons
  considering
  affect

  name_first
  name_last
  email
  phone1
  phone2
  time_to_call
  address1
  address2
  city
  state
  zip
  */

  var fields = "name_first name_last email phone1 time_to_call address1 city state zip".split(" ");

  if( !(form['accept_disclaimer'].checked) )
  {
    alert('You must accept the disclaimer in order to continue.');

    return false;
  }

  var missed_fields = new Array();

  // check text fields
  for( var i = 0; i < fields.length; i++ )
  {
    var curr_field = fields[i];

    if( ! form[curr_field].value )
    {
      missed_fields.push(curr_field);
    }
  }

  // construct error message
  if( missed_fields.length > 0 )
  {
    var message = '';
    for( var i = 0; i < missed_fields.length; i++ )
    {
      message += "Please insert a value for "+missed_fields[i]+".\n";
    }
    alert(message);

    return false;
  }
  else
  {
    return true;
  }
}



$(function () {
  // init flowplayer
  flowplayer("video_frame", "/etc/common/flash/flowplayer-3.0.0.swf");

  // play initial video
  flowplayer("video_frame").play({
    url           : $('#video_frame').attr('src'),
    autoPlay      : true,
    autoBuffering : true
  })

  // make video buttons play their videos
  $('.video_button').click(function () {
    // start playing my video
    flowplayer("video_frame").play({
      url           : $(this).attr('src'),
      autoPlay      : true,
      autoBuffering : true
    });

    // scroll to top
    window.scrollTo(0, 0);
  });

  // add some nice hover effect
  $('.video_button').hover(
    function () {
      $(this).addClass('hover');
    },
    function () {
      $(this).removeClass('hover');
    }
  );
});
