function validateBMI()
{
  // validate form data
  var fail = false;

  if($("#first").val().length == 0)
  {
    alert("Please enter your first name.");
    fail = true;
    return false;
  }

  if($("#last").val().length == 0)
  {
    alert("Please enter your last name.");
    fail = true;
    return false;
  }

  var email = $("#email").val();
  if(email.length == 0)
  {
    alert("Please enter your email address.");
    fail = true;
    return false;
  }
  else
  {
    var ampersat = email.indexOf("@");
    var dot = email.lastIndexOf(".");

    // make sure the email address contains an @ and a . and that there is a . after the @
    if(ampersat < 0 || dot < 0 || ampersat > dot)
    {
      alert("Please enter a valid email address.");
      fail = true;
      return false;
    }
  }

  if($("#height").val() == 0)
  {
    alert("Please enter your height.");
    fail = true;
    return false;
  }

  if($("#weight").val().length == 0)
  {
    alert("Please enter your weight.");
    fail = true;
    return false;
  }

  if(!fail) return true;

  return false;
}

$("document").ready(function()
{
  // add form and modal ness to the page
  // wait 5 seconds
  setTimeout(function()
  {
	  // hide flash player
	  $("object").css("opacity", "0");
	  
    // make modal thing fade in
    $("div#cover_all").css({display: "block", opacity: "0"});
    $("div#cover_all").animate({opacity: 0.8}, 500, function()
    {
      // drop form down
      $("div#pop_up_squeeze").css({display: "block"});
      $("div#pop_up_squeeze").animate({top: "100px"}, 1000);
      
      // close button functionality
      $("a#squeeze-close").click(function()
      {
      	$("div#pop_up_squeeze").fadeOut(200);
      	$("div#cover_all").fadeOut(200, function()
      	{
      		// show player
   				$("object").css("opacity", "100");
      	});
      	return false;
      });
    });
  }, 5000); //5000
  
  // set up player for JS enhancement
  // remove player
  $("div#interview-player object").remove();
  
  // resize and postion
	$("div#interview-player").css({height:"55px", marginTop:"30px"});
	
	// make the span look and work like a link
	$("span#listen-now").css({cursor:"pointer"});
  
  // add flash on span click
  $("span#listen-now").click(function()
  {	  
  	// remove this click functionality, stops more than one player being spawnde
  	$(this).unbind();

	  $("div#interview-player").animate({marginTop:"10px", height:"85px"}, 300);
	  
	  $(this).after("<script language='JavaScript' src='player/audio-player.js'></script>"+
	  	"<object type='application/x-shockwave-flash' data='player/player.swf' id='audioplayer1' height='24' width='290'>"+
			"<param name='movie' value='player/player.swf'>"+
			"<param name='FlashVars' value='playerID=audioplayer1&soundFile=player/interview.mp3&animation=no&autostart=yes'>"+
			"<param name='uality' value='high'>"+
			"<param name='menu' value='false'>"+
			"<param name='wmode' value='transparent'>"+
			"</object>"); 
			
			return false;
  });
});
