<script type="text/javascript" src="<?php echo SITE_URL; ?>js/calander.js"></script>
<link type="text/css" href="<?php echo SITE_URL; ?>css/calander.css" rel="stylesheet" />
<script type="text/javascript">
$(document).ready(function(){
	 $("#news_date").date_input();		
});

$(document).ready(function(){});

function validate_news(){

	var slug_filter = /^[a-z0-9-]+$/ ;
		
	if($("#news_title").val()==''){
		$("#msg_news_title").html('Please enter news title');
		$("#news_title").addClass('jquery_err');
		$("#news_title").focus();
		return false;
	}else{
		$("#msg_news_title").html('');
		$("#news_title").removeClass('jquery_err');
	}
	
	
	
	
	document.newsFrm.submit();
}

</script>

<!-- Content (Right Column) -->
		<div id="content" class="box">

			<h1>News &raquo; Add News</h1>

			<?php if(isset($successMsg) && $successMsg!=''){ ?>
				<p class="msg done"><?php echo $successMsg; ?></p>
			<?php } ?>
			
			<?php if(isset($failedMsg) && $failedMsg!=''){ ?>
				<p class="msg error"><?php echo $failedMsg; ?></p>
			<?php } ?>

			<form action="addnews.php" method="post" id="newsFrm" name="newsFrm" enctype="multipart/form-data" >

				<?php if(isset($_REQUEST['news_id']) && $_REQUEST['news_id']!=''){ ?>
					<input type="hidden" id="news_id" name="news_id" value="<?php echo $newsDetail->news_id ?>" >
				<?php } ?>
				
				<!-- Login -->
				<fieldset>
					<legend>News Details</legend>
					<p class="nomt">
						<label for="inp-01" class="req">Title :</label><br />
						<textarea name="news_title" id="news_title"  cols="58" rows="5"><?php echo $newsDetail->news_title; ?></textarea>
                        <br/>
						<span class="smaller low message" id="msg_news_title">&nbsp;</span>
					</p>

					
					<p class="nomt">
						<label for="inp-01" class="req">Name :</label><br />
						<input type="text" size="50" name="news_slug" id="news_slug" value="<?php echo $newsDetail->news_slug; ?>" class="input-text-02"  /><br/>
						<span class="smaller low message" id="msg_news_slug">&nbsp;</span>
					</p>
                    
                    <p class="nomt">
						<label for="inp-01" class="req">News Date :</label><br />
						<input type="text" size="50" name="news_date" id="news_date" value="<?php echo ($newsDetail->news_date != '') ? date('d M Y',strtotime($newsDetail->news_date)) : ''; ?>" class="input-text-02"  /><br/>
						
						  
						<span class="smaller low message" id="msg_news_desc">&nbsp;</span>
					</p>
                    
<input type="hidden" size="50" name="news_desc" id="news_desc" value="<?php echo ($newsDetail->news_desc != '') ? $newsDetail->news_desc : ''; ?>" class="input-text-02"  />
					<!--p class="nomt">
						<label for="inp-01" class="req">Description :</label><br />
						<textarea name="news_desc" id="news_desc"  cols="48" ><?php echo $newsDetail->news_desc; ?></textarea><br/>
						<script type="text/javascript"> CKEDITOR.replace( 'news_desc',
						 {
							filebrowserBrowseUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/ckfinder.html',
							filebrowserUploadUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/userfiles',
							filebrowserImageBrowseUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/ckfinder.html?Type=Images',
							filebrowserFlashBrowseUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/ckfinder.html?Type=Flash',
							filebrowserUploadUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
							filebrowserImageUploadUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
							filebrowserFlashUploadUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
							}
						  ); </script>
						  
						<span class="smaller low message" id="msg_news_desc">&nbsp;</span>
					</p -->
                    
					
					<p class="nomt">
						<label for="inp-01" class="req">Meta Title :</label><br />
						<textarea name="news_meta_title" id="news_meta_title"  cols="58" rows="5"><?php echo $newsDetail->news_meta_title; ?></textarea><br/>
					</p>
					
					<p class="nomt">
						<label for="inp-01" class="req">Meta Keywords :</label><br />
						<textarea name="news_meta_keywords" id="news_meta_keywords"  cols="58" rows="5"><?php echo $newsDetail->news_meta_keywords; ?></textarea><br/>
					</p>
					
					<p class="nomt">
						<label for="inp-01" class="req">Meta Description :</label><br />
						<textarea name="news_meta_desc" id="news_meta_desc"  cols="58" rows="5"><?php echo $newsDetail->news_meta_desc; ?></textarea><br/>
					</p>
					
					
					<p class="nomb">
						<label for="inp-03" class="req">Status :</label><br />
						<select id="news_status" name="news_status" class="input-text-02">
							<option value="0" <?php echo ($newsDetail->news_status==0) ? "selected='selected'" : "" ?>>Inactive</option>
							<option value="1" <?php echo (!isset($newsDetail->news_status) || $newsDetail->news_status==1) ? "selected='selected'" : "" ?>>Active</option>
						</select><br/>
						<span class="smaller low message" id="msg_news_status">&nbsp;</span>
					</p>

				</fieldset>
				
				<?php if(isset($newsDetail->news_id) && $newsDetail->news_id!=''){ ?>
					<p><input type="button" value="Edit news" id="submitnews" name="submitnews" class="input-submit" onclick="return validate_news();" /></p>
				<?php }else{ ?>
					<p><input type="button" value="Add news" id="submitnews" name="submitnews" class="input-submit" onclick="return validate_news();" /></p>
				<?php } ?> <input type="button" value="Cancel" id="cancel" name="cancel" class="input-submit" onclick="javascript:window.location='newslist.php'" />
				<input type="hidden" name="news_image" id="news_image" value="" />
				<input type="hidden" id="hiddenSubmit" name="hiddenSubmit" value="submit" />
				
			</form>

		</div> <!-- /content -->
