<?php
function process_form()
{
    if (!isset($_POST['flood-contact-form'])) {
        return;
    }
    if ($_POST['flood-contact-form'] !== "endive-flood-form") {
        return;
    }
    if (empty($_POST['name'])) {
        return;
    }
    if (empty($_POST['email'])) {
        return;
    }
    if (strpos($_POST['email'], '@') === false) {
        return;
    }
    if (empty($_POST['message'])) {
        return;
    }

    mail('ria@witloof.ca', 'Flood Contact Form Received', "
    Name: {$_POST['name']}
    Email: {$_POST['email']}
    Message: {$_POST['message']}
    ");
    header("Location: /contact.php?form-submitted=true");
    exit;
}
process_form();
?>
<!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">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="Van Eekelen Enterprises Ltd." />
    <meta name="keywords" content="Van Eekelen, witloof, chicory, Abbotsford, Chilliwack, endive, Pitt Meadows,
crop rotation, environmental farm plan, Canadian Food Agency, Composites, Legumes, Cruciferae, cole crops, 
red endive, white endive" />
    <title>Van Eekelen Enterprises Ltd.</title>
    <link href="/contact.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript">
        <!--
        function MM_swapImgRestore() {
            //v3.0
            var i,
                x,
                a = document.MM_sr;
            for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++)
                x.src = x.oSrc;
        }

        function MM_preloadImages() {
            //v3.0
            var d = document;
            if (d.images) {
                if (!d.MM_p) d.MM_p = new Array();
                var i,
                    j = d.MM_p.length,
                    a = MM_preloadImages.arguments;
                for (i = 0; i < a.length; i++)
                    if (a[i].indexOf("#") != 0) {
                        d.MM_p[j] = new Image();
                        d.MM_p[j++].src = a[i];
                    }
            }
        }

        function MM_findObj(n, d) {
            //v4.01
            var p, i, x;
            if (!d) d = document;
            if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
                d = parent.frames[n.substring(p + 1)].document;
                n = n.substring(0, p);
            }
            if (!(x = d[n]) && d.all) x = d.all[n];
            for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
            for (i = 0; !x && d.layers && i < d.layers.length; i++)
                x = MM_findObj(n, d.layers[i].document);
            if (!x && d.getElementById) x = d.getElementById(n);
            return x;
        }

        function MM_swapImage() {
            //v3.0
            var i,
                j = 0,
                x,
                a = MM_swapImage.arguments;
            document.MM_sr = new Array();
            for (i = 0; i < a.length - 2; i += 3)
                if ((x = MM_findObj(a[i])) != null) {
                    document.MM_sr[j++] = x;
                    if (!x.oSrc) x.oSrc = x.src;
                    x.src = a[i + 2];
                }
        }
        //
        -->
    </script>
    <style type="text/css">
        <!--
        .style1 {
            color: #59A633;
            font-weight: bold;
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 16px;
        }
        -->
    </style>
    <script language="JavaScript" fptype="dynamicanimation">
        <!--
        function dynAnimation() {}

        function clickSwapImg() {}
        //
        -->
    </script>
    <script language="JavaScript1.2" fptype="dynamicanimation" src="animate.js"></script>
</head>

<body bgcolor="#59A633" onload="MM_preloadImages('images/company-over.gif','images/what-over.gif','images/products-over.gif','images/gallery-over.gif','images/recepies-over.gif','images/links-over.gif','images/contact-over.gif','images/line.gif')" language="Javascript1.2">
    <table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="4" rowspan="3" bgcolor="#777777">&nbsp;</td>
            <td colspan="2">
                <a href="index.php"><img src="images/header.gif" width="893" height="165" border="0" /><br />
                    <img src="images/subheader.gif" alt="Van Eekelen Enterprises Ltd." width="893" height="32" border="0" /></a>
            </td>
            <td width="4" rowspan="3" bgcolor="#777777">&nbsp;</td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="146" valign="top" bgcolor="#6F6F6F">
                <a href="company.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('company','','images/company-over.gif',1)"><img src="images/company.gif" alt="Company Profile" name="company" width="146" height="27" border="0" id="company" /></a><a href="what.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('what','','images/what-over.gif',1)"><img src="images/what.gif" alt="What is Witloof" name="what" width="146" height="27" border="0" id="what" /></a><a href="products.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('products','','images/products-over.gif',1)"><img src="images/products.gif" alt="Products" name="products" width="146" height="27" border="0" id="products" /></a><a href="recipes.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Recepies','','images/recepies-over.gif',1)"><img src="images/recepies.gif" alt="Recepies" name="Recepies" width="146" height="27" border="0" id="Recepies" /></a><a href="links.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('links','','images/links-over.gif',1)"><img src="images/links.gif" alt="Links" name="links" width="146" height="27" border="0" id="links" /></a><a href="contact.php" onmouseout="document['fpAnimswapImgFP1'].src=document['fpAnimswapImgFP1'].imgRolln" onmouseover="var img=document['fpAnimswapImgFP1'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;"><img src="images/contact.gif" alt="Contact" name="fpAnimswapImgFP1" width="146" height="27" border="0" id="fpAnimswapImgFP1" dynamicanimation="fpAnimswapImgFP1" lowsrc="images/contact-over.gif" /></a>
                <a href="http://www.endive.ca" target="_blank" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('endive','','images/endive-o.gif',1)"><img src="images/endive.gif" alt="Endive.ca" name="endive" width="146" height="27" border="0" id="contact" /><img src="images/line.gif" alt="" width="146" height="2" border="0" /><img src="images/spacer.gif" width="1" height="1" border="0" /></a><br />
            </td>
            <td width="757" valign="top">
                <table width="100%" border="0" cellspacing="0" cellpadding="30">
                    <tr>
                        <td>
                            <img border="0" src="images/interface/homepageimage.jpg" width="648" height="432" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <div class="full-container">
                                <div class="flood-banner">
                                    <h2 class="title">We thank everyone for their concerns about the recent flooding at our facility. The water was around 4 ft deep (Nov 19th), then dropped to 2 ft (Nov 26). We are currently (Dec 15th) in the process of cleaning up and repairing equipment. We currently have no produce. If you want to help or have questions, please leave your contact information below and we will be in touch.</h2>

                                </div>
                                <div class="img-banner">
                                    <img src="/images/flood-1.jpg" alt="" />
                                    <img src="/images/flood-2.jpg" alt="" />
                                    <img src="/images/flood-3.jpg" alt="" />
                                    <img src="/images/flood-4.jpg" alt="" />
                                </div>
                                <?php $is_current_form = (isset($_POST['flood-contact-form'])) && ($_POST['flood-contact-form'] === "endive-flood-form"); ?>

                                <?php if (empty($_GET['form-submitted'])) : ?>
                                    <form method="POST" action="/contact.php">
                                        <input class="input" type="hidden" name="flood-contact-form" value="endive-flood-form" />
                                        <div class="form-field">
                                            <label for="flood-contact-name">

                                            </label>
                                            <input class="input" placeholder="Name" required name="name" id="flood-contact-name" type="text" />
                                            <?php if ($is_current_form && empty($_POST['name'])) {

                                                echo ('error');
                                            }
                                            ?>
                                        </div>
                                        <div class="form-field">
                                            <label for="flood-contact-email">

                                            </label>
                                            <input class="input" placeholder="Email" required name="email" id="flood-contact-email" type="email" />
                                            <?php if ($is_current_form && (empty($_POST['email']) || (strpos($_POST['email'], '@') === false))) {
                                                echo ('error');
                                            }
                                            ?>
                                        </div>
                                        <div class="form-field">
                                            <label for="flood-contact-message">

                                            </label>
                                            <textarea class="input message" placeholder="Message" required name="message" id="flood-contact-message"></textarea>
                                            <?php if ($is_current_form && empty($_POST['message'])) {

                                                echo ('error');
                                            }
                                            ?>
                                        </div>
                                        <div class="form-field submit">
                                            <input type="submit" value="submit" />

                                        </div>
                                    </form>
                                <?php else : ?>
                                    <p class="submit">Thank you for contacting us!</p>
                                <?php endif; ?>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <img src="images/footer.gif" width="893" height="20" />
            </td>
        </tr>
    </table>
    <div align="center">
        <table cellspacing="0" cellpadding="0" width="797" border="0">
            <tr>
                <td align="right" height="25">
                    <p align="center">
                        <font face="Tahoma" color="#FFFFFF" size="1">copyright © 2008 Van Eekelen Enterprises Ltd.&nbsp; | &nbsp;all
                            rights reserved</font>
                    </p>
                </td>
            </tr>
        </table>
    </div>
</body>

</html>