<?php include('./utility/texteditor_limited.php')?>
<form name="searchfrm" id="searchfrm" action="<?php echo $page_name?>" method="post" target="_parent" enctype="multipart/form-data">
 <div style="padding-top:40px;">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left" class="breadcrumb"><a href="index.php">Home</a> &raquo; Post News</td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td><h3>Post News</h3></td>
                </tr>
              <tr>
                <td><br /><h3 style="color:red"><?php echo $error_msg;?></h3></td>
                </tr>
              <tr>
                <td>
                  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="table table-bordered table-striped">
                    <tr>
                      <td width="42%" align="right"><strong>Title</strong></td>
                      <td width="58%" align="left">
                      <div class="form-group">
                          <input name="title" type="text" class="form-control" id="title" style="width:300px; height:35px" value="<?php echo $userDetails->title?>" />
                          <div id="title_vmsg"></div>
                      </div>
                      </td>
                    </tr>
                    <tr>
                      <td align="right" ><strong>Start Date</strong></td>
                      <td align="left">
					  	<input name="startdate" type="text" class="form-control" id="startdate" style="width:300px; height:35px" data-format="YYYY-MM-DD" value="<?php echo $userDetails->startdate?>" />
					  <script type="text/javascript">
								 $(function () {
									$('#startdate').datetimepicker({
										pickTime: false
									});
									$('#startdate').on("change.dp", function(e) {										 
										var sdate = new Date($('#startdate').val());
										sdate.setDate(sdate.getDate()+25);
										var d = sdate.getFullYear()+"-"+(sdate.getMonth()+1)+"-"+sdate.getDate();
										//d = new Date(d);
										var sdate_year = sdate.getFullYear();
										var sdate_month = sdate.getMonth()+1;
										var sdate_day = sdate.getDate();										
										if(sdate_month < 10){
											sdate_month = "0"+sdate_month;
										}
										
										if(sdate_day < 10){
											sdate_day = "0"+sdate_day;
										}
										var EndDate = sdate_year+"-"+sdate_month+"-"+sdate_day;										
										$('#enddate').val(EndDate);
									});
								});
							</script>
					  </td>
                    </tr>
					<tr>
                      <td align="right"><strong>End Date</strong></td>
                      <td align="left">
					  	<input name="enddate" type="text" class="form-control" id="enddate" style="width:300px; height:35px" data-format="YYYY-MM-DD" value="<?php echo $userDetails->enddate?>" />
					 <script type="text/javascript">
								 $(function () {
									$('#enddate').datetimepicker({
										pickTime: false
									});
								});
							</script>
					  </td>
                    </tr>
                    <tr>
                      <td align="right"><strong>Detail<br />
                      </strong></td>
                      <td align="left"><textarea name="description" id="description" cols="45" rows="5"><?php echo $userDetails->description?></textarea></td>
                    </tr>
                    <tr>
                      <td align="right" ><strong>Upload Image</strong></td>
                      <td align="left"><strong>
					  <div class="form-group">
                          <input type="file" name="simage" id="simage" />
                          <div id="image_vmsg"></div>
                      </div>
                      </strong></td>
                    </tr>
                    <tr align="left">
                      <td align="right">&nbsp;</td>
                      <td><strong>
					  <div class="form-group">
                          <input type="file" name="simage2" id="simage2" />
                          <div id="image2_vmsg"></div>
                      </div>
                      </strong></td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>External Link</strong></td>
                      <td width="58%" align="left">
					  <div class="form-group">
					  	<input name="extlink" type="text" class="form-control" id="extlink" style="width:300px; height:35px" value="<?php echo $userDetails->extlink?>" />
						<div id="title_vmsg"></div>
                      </div>
						</td>
                    </tr>
                    <tr align="left">
                      <td align="right">&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr align="left">
                      <td align="right">&nbsp;</td>
                      <td><input type="submit" class="btn btn-blue" name="Submit" id="Submit" value="Submit" /></td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td align="center">&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td align="center">&nbsp;</td>
              </tr>
              </table>
             </div>
</form>
<script type="text/javascript">
$(document).ready(function() {
    $('#searchfrm').bootstrapValidator({
        message: 'This value is not valid',
        fields: {
            title: {
				container:'#title_vmsg',
                message: 'The Title is not valid',
                validators: {
                    notEmpty: {
                        message: 'The Title is required and can\'t be empty'
                    }
                }
            }
        }
    });
});
</script>