<!doctype html>

<html lang="en">
<head>
  <title>Give Or Take</title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- We need to load this version of jQuery because it is compatible with the Slot Machine and Star Review scripts -->
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
  <!-- The next three scripts are for the Slot Machine -->
 <script src="boomtag{path}/script/jquery.spritely.js"></script>
  <script src="boomtag{path}/script/jquery.backgroundPosition.js"></script>
  <script src="boomtag{path}/script/slot.js"></script>
  <!-- Star review script -->
  <script src="boomtag{path}/script/jquery.raty.min.js"></script>
  <link href="boomtag{path}/img/give_take_images/bootstrap.min.css" rel="stylesheet">
  <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,700,800,600' rel='stylesheet' type='text/css'>
  <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,700,800,600|Open+Sans+Condensed:300' rel='stylesheet' type='text/css'>
  boomtag{action_back}
<style type="text/css">
boomtag{main_css}
</style>
   <script type="text/javascript">
        $(function() {
        	$('#jackpot').hide();
            $("#email-submit").attr('disabled', false);
            $("#email_add").attr('disabled', false);
            var date_played = new Date();

            function validateEmail($email) {
                var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
                if (!emailReg.test($email)) {
                    return false;
                } else {
                    return true;
                }
            }
            $("#email-submit").click(function() {
                $("#err_msg").html('');
                $('#jackpot').fadeOut('fast');
                $('.slot-wrapper').fadeTo("fast", 1);
                var date_play = (date_played.getFullYear()+'-'+ (date_played.getMonth()+1) +'-'+ date_played.getDate()+' '+date_played.getHours()+':'+date_played.getMinutes()+':'+date_played.getSeconds());
                if (!$("#email_add").val()) {
                    $("#err_msg").html("* Please enter your email address.");
                    return false;
                } else if (!validateEmail($("#email_add").val())) {
                    $("#err_msg").html("* Please enter a valid email address. For example <b><i>johnsmith@gmail.com</i></b>");
                    return false;
                } else {
                    $("#email-submit").attr('disabled', true);
                    $("#email_add").attr('disabled', true);
                    var start_time = new Date().getTime();
                    $.ajax({
                        url: '/slot-machine',
                        type: "POST",
                        dataType: "json",
                        data: {
                            id: 'submit',
                            email: $('#email_add').val(),
                          	date_play: date_play
                        },
                        success: function(data) {
                            var success = true;
                            if (data[0] == "success") {
                                window.location.replace('/slot-machine?1='+data[1]+'&dw='+data[2]);
                            }
                            else
                            {
                            	$('#won_msg').text('Sorry, only one spin per email address.');
								$('#jackpot').show();
                            }
                        }
                    });
                }
            });
        });
    </script>
</head>
<body>
	<div class="container">
        <div class="promo-wrap">
            <div class="row promo-message">
                <div class="col-xs-12"><h1>TAKE <br/> $boomtag{prize_won} OFF</h1></div>
            </div>
            <div class="row promo-border-lg"></div>
            <div class="row promo-msg-low">
                <h2>Please show to cashier</h2>
            </div>
            <div class="row promo-validity">
                <h2>good for <br/> boomtag{local_date_display}</h2>
            </div>
        </div>
    </div>
  	<div class="footer">
  		<div class="inner">
  			<p style="text-align: center;"><span><img src="boomtag{path}/img/give_take_images/boomtime.png"></span></p>
  		</div>
  	</div>	
  </div> <!-- #container -->
</div> <!-- #wrapper -->
</body>
</html>