<?php
//If the form is submitted
if(isset($_POST['submit'])) {

	//Check to make sure that the name field is not empty
	if(trim($_POST['contactname']) == '') {
		$hasError = true;
	} else {
		$name = trim($_POST['contactname']);
	}

	//Check to make sure that the subject field is not empty
	if(trim($_POST['subject']) == '') {
		$hasError = true;
	} else {
		$subject = trim($_POST['subject']);
	}

	//Check to make sure sure that a valid email address is submitted
	if(trim($_POST['email']) == '')  {
		$hasError = true;
	} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
		$hasError = true;
	} else {
		$email = trim($_POST['email']);
	}

	//Check to make sure comments were entered
	if(trim($_POST['message']) == '') {
		$hasError = true;
	} else {
		if(function_exists('stripslashes')) {
			$comments = stripslashes(trim($_POST['message']));
		} else {
			$comments = trim($_POST['message']);
		}
	}

	//If there is no error, send the email
	if(!isset($hasError)) {
		$emailTo = 'courtney@courtneysemeniuk.com'; //Put your own email address here
		$body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:\n $comments";
		$headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;

		mail($emailTo, $subject, $body, $headers);
		$emailSent = true;
	}
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/nav.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Courtney Semeniuk_Graphic Design</title>
<link rel="shortcut icon" href="images/favicon.ico" />
<!-- InstanceEndEditable -->
<link href="scripts/pagestyle.css" rel="stylesheet" type="text/css" />
<link href="scripts/960_24_col.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="headstart" -->
<!-- InstanceEndEditable -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
<!--[if IE]>
  <style type="text/css">
   body { behavior: url("scripts/csshover3.htc"); }
  </style>
 <![endif]-->
 <!--[if lt IE 7]>  
<link href="scripts/pngsupport.css" rel="stylesheet" type="text/css" />
<![endif]-->

<!-- InstanceBeginEditable name="headend" -->
<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js" type="text/javascript"></script>
<script type="text/javascript" src="scripts/pp.js"></script>


<!-- InstanceEndEditable -->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-22643977-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head>

<body>
<div id="mainwrapper">
<div id="maincw" >
<div class="grid_24">
<h1>Courtney Semeniuk design &middot; photography &middot; motion</h1>
<div  id="pagenav" >
<ul>
<!-- InstanceBeginEditable name="nav" -->
<li ><a href="index.html">Home</a></li><li ><a href="webdesign.html">Web Design</a></li><li><a href="printdesign.html">Print Design</a></li><li><a href="photography.html">Photography</a></li><li><a href="motion.html">Motion</a></li>
<li class="current"><a href="contact.php">Contact</a></li>
<!-- InstanceEndEditable -->
</ul>
</div>
<!-- InstanceBeginEditable name="content" -->
<!--<div class="pd"></div>-->
<h2>Courtney Semeniuk</h2>
<div class="grid_13 prefix_1 pgtop">
<p><img src="images/logoicon.jpg" width="75" height="100" style="float:left;margin:0 15px 10px 0;" />Please use the email form below if you have any questions regarding what I do or how I do it. I check my mail often (who doesn't these days) and can probably get back to you within 24hrs with an answer to any inquiry or even a short design brief if your message has enough info to do so.</p>
<p>If your interested in hiring me for a project please download the questionaire form and we can use that as a starting point. It has many of the questions I would be asking during a consultation in the first place. If its completed then we can start working together on a great project faster.</p>
<p><a href="questionaire.doc" targe="_blank">questionaire</a></p>
</div>

<div class="grid_8 prefix_1">
<div style="width:100%;height:100px;">
</div>
</div>
<hr class="clear clearfix" />



		<?php if(isset($emailSent) && $emailSent == true) { //If email is sent ?>
        <script type="text/javascript">
		 $(function() {
			 $('#contact_form').fadeOut(200);
			 $('#msg').fadeIn(800);
		 });
		</script>
		<?php } ?>
  <div class="grid_14 push_5 alpha contact">
  
  <div id="contact_form">
  <h2>Email Me!</h2>
<!--  <form name="contact" action="">
    <fieldset>
      <label for="name" id="name_label">Name</label>
      <label class="error" for="name" id="name_error">This field is required.</label>
      <input type="text" name="name" id="name" size="30" value="" class="text-input" />

      <label for="email" id="email_label">Email</label>
      <label class="error" for="email" id="email_error">This field is required.</label>
      <input type="text" name="email" id="email" size="30" value="" class="text-input" />

      <label for="question" id="question_label">Question</label>
      <label class="error" for="question" id="question_error">This field is required.</label>
      <textarea name="question" cols="30" class="text-input" id="question"></textarea>
 
      <input type="submit" name="submit" class="button" id="submit_btn" value="Send" />
    </fieldset>
  </form>
  -->
  <?php if(isset($hasError)) { //If errors are found ?>
			<p class="error">Please check if you've filled all the fields with valid information and try again. Thank you.</p>
		<?php } ?>
        
		<?php if(isset($emailSent) && $emailSent == true) { //If email is sent ?>
        <style type="text/css">
#contactform { display: none; }
</style>
        <div class="success nojs"><p >Thank-you <?php echo $name;?> for contacting me. I should be able to respond within 24 hours. Feel free to browse my portfolios if you haven't done so already.<br />Courtney Semeniuk.</p></div>
		<?php } ?>
  <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="contactform">
			
				<label for="name">Name: *</label>
				<input type="text" name="contactname" id="contactname" value="" class="required" role="input" aria-required="true" />
						
				<label for="email">Email: *</label>
				<input type="text" name="email" id="email" value="" class="required email" role="input" aria-required="true" />
			
				<label for="subject">Subject: *</label>
				<input type="text" name="subject" id="subject" value="" class="required" role="input" aria-required="true" />
		
				<label for="message">Message: *</label>
				<textarea rows="8" name="message" id="message" class="required" role="textbox" aria-required="true"></textarea>
		
								
			<span class="requiredNote">* required field.</span>
			
			<input type="submit" value="Send Message" name="submit" id="submitButton" title="Click here to submit your message!" />
		</form>
</div>
<div id='msg'><h2>Contact Form Submitted!</h2><p><img src='images/logoicon.jpg' width='75' height='100' style='float:left;margin:0 15px 10px 15px;' />Thank-you <?php echo $name;?> for contacting me. I should be able to respond within 24 hours. Feel free to browse my portfolios if you haven't done so already.<br />Courtney Semeniuk.</p></div>

<div class="cbottom"></div>
<hr class="clear clearfix" />
</div>

<hr class="clear clearfix" />
<!-- InstanceEndEditable -->
<div class="clear clearfix"></div>
<div class="grid_24 footer">&copy;Courtney Semeniuk 2011</div>
</div>


 </div>



</div>
<!-- InstanceBeginEditable name="end" -->
<div id="DB" class="darkenBackground" style="display: none;"></div>
<!-- InstanceEndEditable -->

</body>
<!-- InstanceEnd --></html>
