<?php
  /**
   * Copyright 2011 Zazavi - http://www.zazavi.com
   * Zazavi is free software released under the terms of the GNU General Public License.
   * You should have received a copy of the license.  If not, see <http://www.gnu.org/licenses/>.
   */
  if (!defined("_VALID_PHP"))
      die('Direct access to this location is not allowed.');
?>
<div id="response"></div>
<div id="fullform" style="padding-top:10px">
  <div class="box">
    <form action="" method="post" id="admin_form" name="admin_form">
      <table width="100%" border="0" cellpadding="3" cellspacing="0">
        <tr>
          <td width="200"><strong><?php echo _CF_NAME;?>: <?php echo required();?></strong></td>
          <td><span class="inputwrap">
            <input name="name" id="name" class="inputbox required" size="45" title="<?php echo _CF_NAME_R;?>" value="<?php if ($user->logged_in) echo $user->name;?>" type="text" style="width:300px"/>
            </span></td>
        </tr>
        <tr>
          <td><strong>
            <label for="email"><?php echo _CF_EMAIL;?>: <?php echo required();?></label>
            </strong></td>
          <td><span class="inputwrap">
            <input name="email" id="email" class="inputbox required" size="45" value="<?php if ($user->logged_in) echo $user->email;?>" title="<?php echo _CF_EMAIL_R;?>" type="text" style="width:300px"/>
            </span></td>
        </tr>
        <tr>
          <td><strong><?php echo _CF_SUBJECT;?>:</strong></td>
          <td><span class="inputwrap">
            <select name="subject" class="select" style="width:310px">
              <option value=""><?php echo _CF_SUBJECT_1;?></option>
              <option value="<?php echo _CF_SUBJECT_2;?>"><?php echo _CF_SUBJECT_2;?></option>
              <option value="<?php echo _CF_SUBJECT_3;?>"><?php echo _CF_SUBJECT_3;?></option>
              <option value="<?php echo _CF_SUBJECT_4;?>"><?php echo _CF_SUBJECT_4;?></option>
              <option value="<?php echo _CF_SUBJECT_5;?>"><?php echo _CF_SUBJECT_5;?></option>
              <option value="<?php echo _CF_SUBJECT_6;?>"><?php echo _CF_SUBJECT_6;?></option>
              <option value="<?php echo _CF_SUBJECT_7;?>"><?php echo _CF_SUBJECT_7;?></option>
            </select>
            </span></td>
        </tr>
        <tr>
          <td><strong><?php echo _CF_MSG;?>: <?php echo required();?></strong></td>
          <td><span class="inputwrap">
            <textarea name="message" cols="55" rows="8" class="inputbox required" title="<?php echo _CF_MSG_R;?>" style="height: 100px; width: 300px;"></textarea>
            </span></td>
        </tr>
        <tr>
          <td><strong><?php echo _CF_TOTAL;?>: <?php echo required();?></strong></td>
          <td><span class="inputwrap">
            <input name="code" type="text" class="inputbox required" id="code" title="<?php echo _CF_TOTAL_R;?>" size="5" maxlength="1" />
            </span></td>
        </tr>
        <tr>
          <td colspan="2"><input id="submit" name="submit" class="button shadow" value="<?php echo _CF_SEND;?>" type="submit" /></td>
        </tr>
      </table>
    </form>
  </div>
</div>
<script type="text/javascript">
// <![CDATA[
$(document).ready(function() {
    $("#admin_form").submit(function () {
        var str = $(this).serialize();
        $.ajax({
            type: "POST",
            url: SITEURL + "/ajax/sendmail.php",
            data: str,
            success: function (msg) {
                $("#response").ajaxComplete(function(event, request, settings) {
				if(msg  == 'OK') {
					result = '<div class="msgOk"><?php echo _CF_OK;?><\/div>';
				$("#fullform").hide();
				} else {
				result = msg;
				}
               $(this).html(result);
                    });
                }
            });
        return false;
    });
});
// ]]>
</script>