<?php 
	require "models/rivermedia.php";
	$rivermedia = new RIVERMEDIA;
	$rivermedia->auth();
	$rivermedia->contact_form();
	$fields = $_SESSION['contact_fields'];
?>
        <form class="form-horizontal" id="form_contact" autocomplete="dammit" action="javascript:void(0);">
          <!-- fake fields are a workaround for chrome autofill getting the wrong fields -->
          <input style="display:none" type="text" id="fakefirstnameremembered_1" name="fakefirstnameremembered_1"/>
          <input style="display:none" type="text" id="fakelastnameremembered_1" name="fakelastnameremembered_1"/>
          <input style="display:none" type="email" id="fakeemailremembered_1" name="fakeemailremembered_1"/>
          <input style="display:none" type="text" id="fakephoneremembered_1" name="fakephoneremembered_1"/>
            <div class="form-group col-lg-6">
              <label for="contact_firstname" class="col-lg-12" id="label_contact_firstname">First name</label>
              <div class="col-lg-12">
                <input type="text" class="form-control" id="contact_firstname" name="contact_firstname" placeholder="First name"  value="<?php echo $fields['firstname']; ?>">
              </div>
            </div>
          <input style="display:none" type="text" id="fakefirstnameremembered_2" name="fakefirstnameremembered_2"/>
          <input style="display:none" type="text" id="fakelastnameremembered_2" name="fakelastnameremembered_2"/>
          <input style="display:none" type="email" id="fakeemailremembered_2" name="fakeemailremembered_2"/>
          <input style="display:none" type="text" id="fakephoneremembered_2" name="fakephoneremembered_2"/>
            <div class="form-group col-lg-6">
              <label for="contact_lastname" class="col-lg-12" id="label_contact_lastname">Last name</label>
              <div class="col-lg-12">
                <input type="text" class="form-control" id="contact_lastname" name="contact_lastname" placeholder="Last name"  value="<?php echo $fields['lastname']; ?>">
              </div>
            </div>
          <input style="display:none" type="text" id="fakefirstnameremembered_3" name="fakefirstnameremembered_3"/>
          <input style="display:none" type="text" id="fakelastnameremembered_3" name="fakelastnameremembered_3"/>
          <input style="display:none" type="email" id="fakeemailremembered_3" name="fakeemailremembered_3"/>
          <input style="display:none" type="text" id="fakephoneremembered_3" name="fakephoneremembered_3"/>
            <div class="clearfix"></div>
            <div class="form-group col-lg-6">
              <label for="contact_tel" class="col-lg-6" id="label_contact_tel">Phone</label>
              <div class="col-lg-12">
                <input type="text" class="form-control phonefields" id="contact_tel" name="contact_tel" placeholder="Phone"  value="<?php echo $fields['phone']; ?>">
              </div>
            </div>
          <input style="display:none" type="text" id="fakefirstnameremembered_4" name="fakefirstnameremembered_4"/>
          <input style="display:none" type="text" id="fakelastnameremembered_4" name="fakelastnameremembered_4"/>
          <input style="display:none" type="email" id="fakeemailremembered_4" name="fakeemailremembered_4"/>
          <input style="display:none" type="text" id="fakephoneremembered_4" name="fakephoneremembered_4"/>
            <div class="form-group col-lg-6">
              <label for="contact_email" class="col-lg-12" id="label_contact_email">Email address&nbsp;<span></span></label>
              <div class="col-lg-12">
                <input type="text" class="form-control" id="contact_email" name="contact_email" placeholder="Email address" value="<?php echo $fields['email']; ?>" autosuggest="random-stuff">
              </div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-lg-12">
              <label for="contact_message" class="col-lg-12" id="label_contact_message">Message</label>
              <div class="col-lg-12">
                <textarea name="contact_message" id="contact_message" class="form-control" rows="1" placeholder="Message"><?php echo $fields['message']; ?></textarea>
              </div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-lg-12">
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-primary" id="submit_contact">Submit</button>
            </div>
            <div class="clearfix"></div>
<?php 
if (array_key_exists('status', $fields)) {
?>
            <div id="contact_alert" class="alert alert-success">
              <strong>Success!</strong> Your email has been sent...
            </div>
<?php	
};
?>            
        </form>
<?php 
unset($_SESSION['contact_fields']);
?>