// Get bands and models
$(document).ready(function()
{
  $("#email_submit").click(function()
  {
            var email = $("#tell_a_friend_email").val();
            
            $.ajax({
                        type: "POST",
                        url: "_email_friend.php",
                        data: 'email='+email,
                        dataType: "xml",
                        success: function(xml)
                        {
                            $(xml).find('message').each(function()
                            {
                              var message = $(this).text();
                              if(message == "success")
                              {
                                  $("#email_form").css('display', 'none');
                                  $("#email_success").css('display', 'block');
                                  $('#email_success').html('<p><strong>Thankyou your message has been sent.</strong></p>');
                                  $('#email_error').css('display', 'none');
                                  return true;
                              }
                              else
                              {
                                  $('#email_error').html('<p class="error">Please enter a valid email</p>');
                                  $("#email_success").css('display', 'none');
                                  return false;
                              }
                            });
                        }
              }); 
  });
});