<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="assets/js/jquery-ui-1.10.4.custom/css/ota/jquery-ui-1.10.4.custom.min.css">
<link rel="stylesheet" href="assets/coupon.css">
<title>Gift Code Generator</title>
</head>
<body>
<!-- UPPER HEADER -->
<div class="upper-header">
	<div class="cont">
		Call Us Today! (800) 497-8360 | <a href="mailto:customerservice@ourtownamerica.com" class="white">customerservice@ourtownamerica.com</a>
	</div>
</div>

<!-- MAIN HEADER -->
<div class="main-header">
	<div class="cont">
		<a href='http://www.ourtownamerica.com' target='_blank'>
		<img src="http://www.ourtownamerica.com/wp-content/uploads/2014/01/OTA_Stretched-300x45.png" class="logo"></a>
		<h1 class="logo fright">Gift Codes</h1>
	</div>
</div><!-- BANNER -->
<div class="banner">
	<div class="cont">
		<img src="http://www.ourtownamerica.com/wp-content/uploads/2014/04/new-mover-direct-mail-marketing.png" class="cert-girl"><br>
		<h1>Welcome to the Neighborhood</h1>
		<h2>Generate Your Gift Code Here!</h2>
		<br>
		<p class="just">
		Welcome to Our Town America's gift code generator. Local businesses in your new neighborhood wanted you to feel warm and welcomed to town so they have sent
		you a generous gift!  Please complete the form below to generate your one-time gift code that can be used for the special provided on your certificate. You may use
		your gift code to patronize the business that sent you the welcoming gift. If you have any questions, feel free to
		<a href='http://www.ourtownamerica.com/new-movers/contact-us/' target='_blank' class='otared'>contact us</a> at any time.
		<br><br><br>
		<a href="#couponform" class="cta-button" id="cta-button">Complete the Form Below</a>
		</p>
	</div>
</div>

<div class="clear"></div>
<!-- SOCIAL ICONS -->
<div class='transition-bar'>
	<div class='cont'>
		<div class='center'>
			<h3>Socialize With Us!</h3>
			<a href="https://www.facebook.com/OurTownAmerica" target="_blank">
			<img src="http://www.ourtownamerica.net/wp-content/uploads/2014/03/ico-facebook.png" border="0" alt="Ourtown Facebook"></a>
			<a href="https://twitter.com/ourtownamerica" target="_blank" >
			 <img src="http://www.ourtownamerica.net/wp-content/uploads/2014/03/ico-twitter.png" border="0" alt="Ourtown Twitter"></a>
			<a href="https://plus.google.com/b/102247956569854863429/102247956569854863429/about" target="_blank" >
			<img src="http://www.ourtownamerica.net/wp-content/uploads/2014/03/ico-gplus.png" border="0" alt="Ourtown Google+"></a>
			<a href="http://www.pinterest.com/ourtownamerica/" target="_blank" >
			 <img src="http://www.ourtownamerica.net/wp-content/uploads/2014/03/ico-pinterest.png" border="0" alt="Ourtown Pinterest"></a>
			<a href="http://www.youtube.com/user/ourtownamerica" target="_blank" >
			<img src="http://www.ourtownamerica.net/wp-content/uploads/2014/03/ico-youtube.png" border="0" alt="Ourtown Youtube"></a>
			<a href="http://www.linkedin.com/company/ourtown-america-inc-" target="_blank" >
			<img src="http://www.ourtownamerica.net/wp-content/uploads/2014/03/ico-linkedin.png" border="0" alt="Ourtown Linkedin"></a>
		</div>
	</div>
</div>

<div class="clear"></div>
<!-- BELOW BANNER -->
<div class="cont page-bottom" id="couponform">
	<br><br>
	<fieldset>
		<span class='helpNfo'>Need Help? Call us at <b>1-800-497-8360</b>  or email <a href='mailto:customerservice@ourtownamerica.com'>customerservice@ourtownamerica.com</a></span>
		<legend><h3>Certificate Information</h3></legend>
		<form method="POST" action="#" id="verify_mover">
<!--			<div class='fullwidth center pb10'>
				<label for='sponsorid'><h2>Please Enter Your Certificate Code:
				<a href="#" title="Where is my code? Your certificate code is a 6 digit number located in the box labeled 'Certificate Code'. " class="tooltip">
				<img src='/images/icons/silk/help.png' alt="Where is my code? Your certificate code is a 6 digit number located in the box labeled 'Certificate Code' "></a></h2></label><br>
				<input type="text" name="verify_form[sponsorid]" id="sponsorid" value=""maxlength="6" class="required lg archbook center">
				<span id='err_sponsorid'></span>
				<br>
			</div>-->

			<div class='fullwidth center pb10'>
				<div class='fleft center info-div'>
					<label for="name_last" class="med">Your <b class="otared">Last Name</b>:
						<a href="#" title="Where is my name? Your last name was printed on the shipping label of your welcome package." class="tooltip">
						<img src='/images/icons/silk/help.png' alt="Where is my name?"></a>
						<br><span class="xs">(As Printed on the Front of the Package)</span></label>
						<br><br><br>
						<input type="text" name="verify_form[name_last]" id="name_last" value=""maxlength="16" class="required" tabindex="1" required="required">
					<br>
					<span id='err_name_last'></span>
				</div>
				<div class='fleft center info-div'>
					<label for="email" class="med">Your <b class="otared">E-Mail Address</b>:
						<a href="#" title="Your e-mail address is where we will send your gift code and confirmation." class="tooltip">
						<img src='/images/icons/silk/help.png' alt="Your e-mail address is where we will send your gift code and confirmation."></a>
						<br><span class="xs">(For Confirmation Delivery)</span></label>
						<br><br><br>
					<input type="text" name="verify_form[email]" id="email" value="" class="required email" maxlength="100" tabindex="2" required="required">
					<br><span id='err_email'></span>
				</div>
				<div class='fleft center info-div'>
					<label for="house_number" class="med">Your <b class="otared">House Number</b>:
						<a href="#" title="Your house number is the number before your street name that was printed on your shipping label of your welcome package." class="tooltip">
						<img src='/images/icons/silk/help.png' alt="Your house number is the number before your street name that was printed on your shipping label of your welcome package."></a>
						<br><span class="xs">(Numbers Only)<br>Format: <b>123</b> Main Street</span></label>
						<br><br>
					<input type="text" name="verify_form[house_number]" id="house_number" value="" maxlength="10" class="required" tabindex="3" required="required">
					<br>
					<span id='err_house_number'></span>
				</div>
				<div class='fleft center info-div'>
					<label for="zip_code" class="med">Your <b class="otared">Full Zip Code</b>:
						<a href="#" title="Your full zip code consists of the first five (5) digits of your zip code and then the four (4) digit extension and can be found on the shipping label of your welcome package." class="tooltip">
						<img src='/images/icons/silk/help.png' alt="Your full zip code consists of the first five (5) digits of your zip code and then the four (4) digit extension and can be found on the shipping label of your welcome package."></a>
						<br><span class="xs">(<a href="https://tools.usps.com/go/ZipLookupAction!input.action" target="_blank">Click here</a> to find your full zip)<br>Format: 12345-1234</span></label>
						<br><br>
					<input type="text" name="verify_form[zip_code]" id="zip_code" value="" maxlength="10" class="required zip_code" tabindex="4" required="required">
					<br>
					<span id='err_zip_code'></span>
				</div>
				<div class="clear"></div>
				<br>
				<input type="submit" value="Continue" tabindex="5">
			</div>
		</form>
	</fieldset>
</div>
<div class="clear"></div>
<br>
<div class="footerbg">
	<div class="cont center">
		Copyright &copy; 2026 Our Town America, Inc. | All Rights Reserved.
	</div>
</div>

<!-- Alert Dialog -->
<div id="alertDialog" title="" style="display:none;"></div>
<!-- Coupon Code Dialog -->
<div id="ccDialog" title="" style="display:none;"></div>

<!-- jQUERY SCRIPTS -->
<script src="assets/js/jquery-ui-1.10.4.custom/js/jquery-1.10.2.js"></script>
<script src="assets/js/jquery-ui-1.10.4.custom/js/jquery-ui-1.10.4.custom.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.0.0.js"></script>
<script src="assets/js/jquery-validate/jquery.validate.min.js"></script>
<!-- /var/www/html/rockwell/coupon/inc -->
<script>
$(document).ready(function(){

	$(function() {
		$( document ).tooltip({
			position: {
				my: "center bottom-20",
				at: "center top",
					using: function( position, feedback ) {
						$( this ).css( position );
						$( "<div>" )
						.addClass( "arrow" )
						.addClass( feedback.vertical )
						.addClass( feedback.horizontal )
						.appendTo( this );
				}
			}
		});
	  });

	jQuery.validator.addMethod("phoneUS", function(phone_number, element) {
	    phone_number = phone_number.replace(/\s+/g, "");
	    if ( (phone_number.length == 0) && this.optional(element) && ( !$("input[name='verify_form[phone]']").val() == "" || !$("input[name='verify_form[phone_cell]']").val() =="" ) )
	      return true;
	    if  ( (phone_number.length == 10) || (phone_number.length == 12)
	      && phone_number.match(/^[2-9]\d{2}-?[2-9]\d{2}-?\d{4}$/))
	      return true;

	    return false;
	  }, "Please specify a valid home/cell phone number");

	  $(".phoneUS").validate({
	    rules: {
	      field: {
	        required: true,
	        phoneUS: true
	      }
	    }
	  });

	  jQuery.validator.addMethod("zip_code", function(zip, element) {
	      zip = zip.replace(/\s+/g, "");
	    return this.optional(element) || zip.length > 8 &&
	      zip.match(/^\d{5}-?\d{4}$/);
	  }, "Please enter full ZIP code including last 4 digits");

	  $(".zip_code").validate({
	    rules: {
	      field: {
	        required: true,
	        zip_code: true
	      }
	    }
	  });

	$("#verify_mover").validate({
		errorPlacement: function(error, element){
			var elId = $(element).attr('id'); //should return one
			var err = $("#err_" + elId); //strings should concatenate to err_one
			error.appendTo(err);
		}
	});
	$("#verify_mover").submit(function(){
		$("#alertDialog").empty();
		$('label.error').animate({opacity: 1.0}, 1500).fadeOut(2000);

		var lname = $("#name_last").val();
		var hnum = $("#house_number").val();
		var zip = $("#zip_code").val();
		var email = $("#email").val();
		var sponsorid = $("#sponsorid").val();
		var action = 'verify';

		$.ajax({
		    url: "ajax.php",
		    type: "POST",
		    dataType: 'json',
		    data: { action: action, lname: lname, hnum: hnum, zip: zip, email: email, sponsorid: sponsorid }
		}).done(function(data,v) {
			var jsonString = JSON.stringify(data);
			var check = jsonString.substring(0,1);
			if ( check != '{' && check != "["){
				$("#alertDialog").dialog( "option", "title", "Alert" );
				$("#alertDialog").append("<br><span class='ui-icon ui-icon-alert'></span><p>"+data+"</p>");
				$("#alertDialog").dialog("open");
			}
			else if(data.length === 1){
				data = data[0];
				var msg = '';
				msg = msg + "<p style='font-size:0.9em;'>Hello " + data.movername + ",<br><br>";
				msg = msg + 'Congratulations, we have found and verified you as a new mover in our system. ';
				msg = msg + data.sponsorname + ' has sent you a welcoming gift. To redeem this gift, just use the gift code provided below. ';
				msg = msg + 'Here is your gift code:<br><br>';
				msg = msg + "<div class='coupon-code-box'>"+data.code+"</div><br>";
				msg = msg + 'We will also email this code to you to the email address you provided.<br>Enjoy!</p>';
				$("#ccDialog").dialog( "option", "title", "Verified" );
				$("#ccDialog").append(msg);
				$("#ccDialog").dialog("open");
			}else{
				// there is more than one result
				var msg = '';
				msg = msg + "<p style='font-size:0.9em;'>Hello " + data[0].movername + ",<br><br>";
				msg = msg + 'Congratulations, we\'ve found '+data.length+' local businesses that would like to welcome you to the area. To redeem these gifts, just use the gift codes provided below.';
				msg = msg + '<hr><br>';
				for(var i=0; i<data.length; i++)
					msg += "<b>"+data[i].sponsorname+"</b><br><div class='coupon-code-box'>"+data[i].code+"</div><br>";
				$("#ccDialog").dialog( "option", "title", "Verified" );
				$("#ccDialog").append(msg);
				$("#ccDialog").dialog("open");
			}
		},"json");
		return false;
	});

	// COUPON CODE DIALOG
	$(function() {
	    $( "#ccDialog" ).dialog({
	      modal: true,
	      autoOpen: false,
	      width: 400,
	      buttons: {
	        OK: function() {
			$( this ).dialog( "close" );
			location.href = 'thanks.php';
	        }
	      }
	    });
	  });

	// PAGE TITLE
	pageTitle = "Gift Code Generator";
	$("title").remove();
	$("head").append("<title>"+pageTitle+"</title>");

	// ALERT DIALOG
	$(function() {
	    $( "#alertDialog" ).dialog({
	      modal: true,
	      autoOpen: false,
	      width: 400,
	      buttons: {
	        OK: function() {
	          $( this ).dialog( "close" );
	        }
	      }
	    });
	  });

});

// Google Fonts
  WebFontConfig = {
    google: { families: [ 'Anton::latin',  'Roboto+Condensed::latin', 'Roboto+Slab::latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })();
</script>

</body>
</html>