<?php awesome_contact_script(); ?>

<?php 

$nameError = ""; 
$emailError = "";
$commentError = "";

?>

<?php // Defining the Query Posts ?>
<?php query_posts('pagename=contact-form'); ?>		

<?php if(isset($emailSent) && $emailSent == true) { ?>

	<div class="thanks">
		<h1>Thanks, <?php $name;?></h1>
		<p>Your email was successfully sent. I will be in touch soon.</p>
	</div>

<?php } else { ?> <?php // Start of Form Builder ?>

<?php if ( have_posts() ) : ?>

<?php /* Start the Loop */ ?>
	<?php while ( have_posts() ) : the_post(); ?>		
	
		<div class="form-content">
		
			<?php the_content(); ?>
			
			<?php if(isset($hasError) || isset($captchaError)) { ?>
				<p class="error">There was an error submitting the form.<p>
			<?php } ?>				
			
			<div class="awesome-contact-form">	
				
				<form action="<?php echo esc_url( home_url( '/' ) ); ?>" id="contact-form" method="post">
					
					<p>  <label for="contactName">Name</label>
							<input type="text" name="contactName" id="name" value="<?php if(isset($_POST['contactName'])) echo $_POST['contactName'];?>" class="requiredField" placeholder="Name" />
							<?php if($nameError != '') { ?>
								<span class="error"><?php $nameError;?></span> 
							<?php } ?>
					</p>		
					
					<p>	<label for="email">Email</label>
							<input type="text" name="email" id="email" value="<?php if(isset($_POST['email']))  echo $_POST['email'];?>" class="requiredField email" placeholder="Email Address" />
							<?php if($emailError != '') { ?>
								<span class="error"><?php $emailError;?></span>
							<?php } ?>
					</p>		
						
					<p>  <label for="commentsText">Comments</label>	
							<textarea name="comments" id="message" rows="" cols="" class="requiredField" placeholder="Message"><?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['comments']); } else { echo $_POST['comments']; } } ?></textarea>
							<?php if($commentError != '') { ?>
								<span class="error"><?php $commentError;?></span> 
							<?php } ?>
					</p>
					
					<p>	
						<input type="hidden" name="submitted" id="submit" value="true" /><button type="submit" id="submit" >Submit</button>
					</p>	

				</form>		

			</div><!-- /.awesome-contact-form -->		
			
		</div><!-- /.form-content -->
	
	<?php endwhile; ?>	
	
	<?php else: ?>
	
	<h2>Not Found</h2>
	
<?php endif; wp_reset_query(); ?>		

<?php } ?> <?php // End of Form Builder ?>	