<?php if(!defined('IN_GS')){ die('You cannot load this page directly.'); }?>
<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title><?php get_page_clean_title(); ?> - <?php get_site_name(); ?> - Woodbridge, NJ 07095</title>
	<?php get_header(); ?>
	<meta name="robots" content="index, follow" />
	<link media="all" rel="stylesheet" href="<?php get_theme_url(); ?>/css/main.css">
	<!--[if IE]>
		<script type="text/javascript" src="<?php get_theme_url(); ?>/js/ie.js"></script>
	<![endif]-->
</head>
<body id="<?php get_page_slug(); ?>" >
	<!-- main container of all the page elements -->
	<div id="wrapper">
		<!-- header of the page -->
		<header id="header">
			<!-- page logo -->
			<div class="logo"><a href="<?php get_site_url(); ?>"><img src="<?php get_theme_url(); ?>/images/logo.png" alt="Strawberry's Pub & Pizza"></a></div>
			<!-- main navigation of the page -->
			<nav id="nav">
				<ul>
					<?php get_navigation(return_page_slug()); ?>
				</ul>
			</nav>
		</header>
		<!-- contain the main content of the page -->
		<main id="main">
			<section class="content-box">
				<h1><?php get_page_title(); ?></h1>
				<?php get_page_content(); ?>
                
                
                <!-- FORM TABLE -->
<div id="contact">
				<?php

// Change these two variables to meet your needs.

$myemail = 'info@strawberryspub.com';
$subject = 'Website Contact Form Submission - strawberryspub.com';

$op = $_POST[op];

if($op == 'contact')
{
    $name = stripslashes($_POST[name]);
	$email = stripslashes($_POST[email]);
    $phone = stripslashes($_POST[phone]);
	$comments = stripslashes($_POST[comments]);
    $referer = $_POST[referer];
    $remote_host = $_SERVER[REMOTE_ADDR];
    $server = $_SERVER[SERVER_NAME];
    $browser = $_SERVER[HTTP_USER_AGENT];
	$datestamp = date("m-d-Y H:i:s"); 

    if(!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$",$email)) 
    { 
        $status = "<b><font color=red>Email address not valid.</font></b><br>";
    }
    if(!$name)
    {
        $status .= "<b><font color=red>Enter your name.</font></b><br>";
    }
    if(!$phone)
    {
        $status .= "<b><font color=red>Enter your phone number.</font></b><br>";
    }

    if(!$status)
	    {
        $header = "From: $email";

        $message = "
Contact Form Submission
-----
Submission Date/Time: $datestamp
-----

Name: $name
Email: $email
Phone: $phone
--
Message: 
$comments
			
        "; 

        if(mail($myemail, $subject, $message, $header))
        {
            $status = "<b><font color=red>Your message has been received.<br>We'll contact you as soon as possible.</font></b><br><br>";
        }
        else
        {
            $status = "<b><font color=red>There was a problem sending your information, please try again.</font></b><br><br>";
        }

    }
}    

// Now check the referer page and ensure it's a proper URL

$referer = $_SERVER[HTTP_REFERER];

if(!preg_match('#^http\:\/\/[a-z0-9-]+.([a-z0-9-]+.)?[a-z]+#i', $referer))
{
    unset($referer);
}

?>

<form method="post" action="<?php print $_SELF; ?>">
<input type="hidden" name="op" value="contact">
<input type="hidden" name="referer" value="<?php print $referer; ?>">
<table width="400" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2"><strong>Your Name:</strong></td>
  </tr>
  <tr>
    <td height="40" colspan="2"><input name="name" type="text" id="textfield" size="30"></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Email Address:</strong></td>
  </tr>
  <tr>
    <td height="40" colspan="2"><input name="email" type="text" id="textfield2" size="30"></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Phone Number:</strong></td>
  </tr>
  <tr>
    <td height="40" colspan="2"><input name="phone" type="text" id="textfield3" size="20"></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td height="40" colspan="2"><strong>Your Message:</strong></td>
  </tr>
  <tr>
    <td colspan="2"><textarea name="comments" cols="50" rows="15" id="textarea"></textarea></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td width="162" align="left" valign="top"><input type="image" name="button" id="button" src="<?php get_theme_url(); ?>/images/submit-button.png" alt="SEND"></td>
    <td width="238" align="left" valign="top"><?php print $status; ?></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
</table>
</form>
</div>
                    
                        <!-- END FORM TABLE -->
                
                
			</section>
			<!-- bg slider of the page -->
			<div id="bg-slider">
				<script>
			$("#bg-slider").backstretch([
				"<?php get_theme_url(); ?>/images/img01.jpg",
				"<?php get_theme_url(); ?>/images/img02.jpg",
				"<?php get_theme_url(); ?>/images/img03.jpg",
				"<?php get_theme_url(); ?>/images/img04.jpg",
				"<?php get_theme_url(); ?>/images/img05.jpg",
				"<?php get_theme_url(); ?>/images/img06.jpg",
				"<?php get_theme_url(); ?>/images/img07.jpg",
				"<?php get_theme_url(); ?>/images/img08.jpg"
			], {
					fade: 750,
					duration: 6000
			});
		</script>
			</div>
		</main>
		<!-- footer of the page -->
		<footer id="footer">
			<div class="holder">
				<div class="box">
					<address class="col"><span>110 AMBOY AVENUE &nbsp; WOODBRIDGE, NEW JERSEY</span><a href="tel:7326343131" class="tel"><i class="icon fa fa-mobile"></i> 732.634.3131</a></address>
					<div class="col">
						<time datetime="2015-04-04" class="txt">we're open 7 days a week!</time>
						<!-- social networks of the page -->
						<ul class="social-networks">
							<?php get_component('social-networks'); ?>
						</ul>
					</div>
				</div>
			</div>
		</footer>
	</div>
	<!-- include jQuery library -->
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
	<script type="text/javascript">window.jQuery || document.write('<script src="<?php get_theme_url(); ?>/js/jquery-1.11.2.min.js"><\/script>')</script>
	<!-- include slider JavaScript -->
	<script src="<?php get_theme_url(); ?>/js/jquery.backstretch.min.js"></script>
		<script>
			$("#bg-slider").backstretch([
				"<?php get_theme_url(); ?>/images/img01.jpg",
				"<?php get_theme_url(); ?>/images/img02.jpg",
				"<?php get_theme_url(); ?>/images/img03.jpg",
				"<?php get_theme_url(); ?>/images/img04.jpg",
				"<?php get_theme_url(); ?>/images/img05.jpg",
				"<?php get_theme_url(); ?>/images/img06.jpg",
				"<?php get_theme_url(); ?>/images/img07.jpg",
				"<?php get_theme_url(); ?>/images/img08.jpg"
			], {
					fade: 750,
					duration: 6000
			});
		</script>
</body>
</html>