<!-- OFFICIAL FLIPMOB EDIT PAGE -->
<?php
error_reporting(0);
ini_set('display_errors', 0);
if (isset($_GET['saved'])) {
	//$msg = htmlentities(strip_tags($_GET['msg']));
	$saved = "Saved Successfully!";
}
?>
<!--<script src="/3rdparty/ckeditoradv/ckeditor.js"> </script>-->
<script src="/3rdparty/ckeditor/ckeditor.js"> </script>
<link rel="stylesheet" href="/static/css/jquery.datetimepicker.css"/>
<script src='/static/js/jquery.datetimepicker.js'> </script>

<style type="text/css">
	body {
		background: #f9f9f9;
		/*background: #f5f5f5;*/
	}
	.form .txt {
		background: #eee !important;
		border: 0px;
	}
	div.spacer {
		padding-top: 57px;
	}
	#map-canvas {
		width: 90%;
		float: right;
		border: 3px solid #fff;
	}
	.hidden {
		display: none;
	}
	h1, h2, h3, h4, h5, h6 {
		font-family: 'Open Sans';
		font-weight: 300;
	}
	h2 {
		line-height: 28px;
	}
	.container_12.splitintwo {
		width: 60%;
		float: left;
	}
	.container_12.splitintwor {
		width: 35%;
		float: right;
	}
	.container_12.splitintwos {
		width: 48%;
		float: left;
	}
	.saved  {
		background: #cd1000;
	margin-top: 0px;
	color: #fff;
	text-align: center;
	padding: 10px;
	font-size: 15px;
	}
	.saved a, .saved a:active, .saved a:visited {
		background: #fff;
	color: #28d52d;
		border-radius: 50px;
	-moz-border-radius: 50px;
	-webkit-border-radius: 50px;
	padding: 3px 10px;
	font-weight: 800;
	}
	.saved a:hover {
		color: #fff;
	background: #28d52d;
	}

	/* ########################################### */
	/* ############# PREVIEW FEATURE ############# */
	/* ########################################### */

	.coupon-wrapper {
		position: fixed;
		/*padding-left:20px;*/
		max-width: 332px;
	}
	.coupon-realtime {
		/*width:428px;*/
		width: 300px;
		border: 1px solid #ddd;
		box-shadow: 0 1px 3px rgba(0,0,0,0.1),
		0 0 2px rgba(255,255,255,0.1) inset,
		0 1px 2px rgba(255,255,255,0.2) inset;
		background: #ffffff;
		padding: 15px;
	}
	.coupon-realtime .coupon-image {
		/*float: left;*/
		width: 100%;
		/*margin-right:10px;*/
	}
	.coupon-realtime .coupon-content {
		float: left;
		width: 300px;
		padding: 5px;
		margin-top: 10px;
		font-family: Montserrat, 'Open Sans',Helvetica, sans-serif;
	}
	.coupon-realtime .coupon-content h3,
	.coupon-realtime .coupon-content p {
		margin-bottom: 3px;
		margin-top: 0px;
	}

	.row-item.submit-wrapper {
		padding-left: 30%;
	}
	.home-feature-category .marked-category {
		margin-bottom: 0px !important;
	}
	.form .txt {
		width: 270px;
	}
	.form .row-item .lbl {
		float: left;
		padding-top: 12px;
		width: 177px;
		text-align: right;
	}
	input[type="text"].txt {
		/*width: 270px;*/
		width: 100%;
	}
	.dummy-criteria {
		display: none;
	}
	.value-selector:disabled {
		display: none;
	}
	.campaign .btn {
		padding: 5px 16px !important;
	}
	select.txt {
		width: auto !important;
	}

	div.fSized {
		float: left;
		width: 40px !important;
		padding-top: 7px;
	}

	.business .result-icon {
		float: left;
		width: 32px;
		height: 32px;
	}
	.business .result-icon img {
		width: 32px;
		height: 32px;
	}

	/*select {
	padding: 15px !important;
	height: 35px;
	line-height: 35px !important;
	min-width: 158px !important;
	width: auto !important;
	max-width: 97%;
	color: #222;
	background: #fff;
	text-transform: none;
	font-weight: 200;
	font-family: 'Open Sans',sans-serif;
	font-size: 14px;
	border: 1px solid ddd;
	-ms-box-sizing: content-box;
	-moz-box-sizing: content-box;
	-webkit-box-sizing: content-box;
	box-sizing: content-box;
	}*/

	#termsdiv {
		padding-top: 20px;
	}
	#spaceit {
		padding-bottom: 0px;
	}

	/* ###################################################### */
	/* ####### The Switch - the box around the slider ####### */
	/* ###################################################### */

	.switch {
		position: relative;
		display: inline-block;
		width: 60px !important;
		height: 32px;
	}

	/* Hide default HTML checkbox */
	.switch input {
		display: none;
	}

	/* The slider */
	.sliderr {
		position: absolute;
		cursor: pointer;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: #ccc;
		-webkit-transition: .4s;
		transition: .4s;
	}

	.sliderr:before {
		position: absolute;
		content: "";
		height: 28px;
		width: 28px;
		left: 2px;
		bottom: 2px;
		background-color: white;
		-webkit-transition: .4s;
		transition: .4s;
	}

	input:checked + .sliderr {
		background-color: #98cb54;
	}

	input:focus + .sliderr {
		box-shadow: 0 0 1px #98cb54;
	}

	input:checked + .sliderr:before {
		-webkit-transform: translateX(28px);
		-ms-transform: translateX(28px);
		transform: translateX(28px);
	}

	/* Rounded sliders */
	.sliderr.round {
		border-radius: 32px;
		-moz-border-radius: 32px;
		-webkit-border-radius: 32px;
	}

	.sliderr.round:before {
		border-radius: 50%;
		-moz-border-radius: 50%;
		-webkit-border-radius: 50%;

	}
	/* ##################################################### */
	/* ##############     The Switch ENDS     ############## */
	/* ##################################################### */

	.mvl {
		display: none;
	}
	.dvl {
		display: inline;
	}
	
	#sectiondiv {
		padding: 20px 0 20px;
	}

	/* ########################################################## */
	/* #####################     MOBILE     ##################### */
	/* ########################################################## */

	@media (max-width: 600px) {
		.mvl {
			display: inline;
		}
		.dvl {
			display: none;
		}
		.container_12.splitintwo, .container_12.splitintwor {
			width: 96%;
			float: none;
			border-right: 0px solid #ddd;
		}
		.coupon-realtime {
			width: 300px;
		}
		.coupon-wrapper {
			position: relative;
			padding-left: 0px;
		}
		.coupon-realtime .coupon-image {
			float: left;
			width: 80px;
			margin-right: 10px;
		}
		.coupon-realtime .coupon-content {
			float: left;
			width: 160px;
			padding: 5px;
		}
		#map-canvas {
			width: 96%;
		}
		.form .txt {
			width: 150px;
		}
		input[type="text"].txt {
			width: 150px;
		}
		.home-feature-category .marked-category {
			margin-bottom: 0px !important;
		}
		.coupon-realtime {
			margin: auto;
		}
		.form .row-item {
			padding-bottom: 5px;
		}
		.form .row-item .lbl .lblsms {
			display: none;
		}
		.form .row-item .val {
			margin-left: 0px; /* was 193px */
		}
		.form .row-item .lbl {
			float: left;
			padding-top: 12px;
			padding-bottom: 7px;
			width: 100%; /* was 177px */
			text-align: left;
		}
		#descriplabel {
			padding: 0px;
			height: 10px;
		}
		#descriplabel2 {
			display: none;
		}
		.row-item.submit-wrapper {
			padding-left: 0%;
		}
		.form .description-input {
			font-family: 'Open Sans', sans-serif;
			font-weight: 300;
			font-style: italic;
			color: #999;
		}
		#sectiondiv {
			padding: 10px 0 20px;
		}
		#termsdiv {
			padding-top: 0px;
		}
		#spaceit {
			padding-top: 10px;
			padding-bottom: 10px;
		}
		.mtext {
			font-size: 17px;
		}
		/* ############# PREVIEW FEATURE ############# */
		.coupon-realtime .coupon-image {
			float: none;
			display: block;
			width: 100%;
			/* margin-right: 10px; */
		}
		.coupon-realtime .coupon-content {
			float: none;
			width: 100%;
			padding: 0px;
		}
	}
</style>

<script type="text/javascript">
	$(document).ready(function() {
		$(".timepicker").datetimepicker({
			hours12: false,
			format: 'Y-m-d H:i:s',
			formatTime: 'h:i a',
			timepicker: true,
			datepicker: true,
			timepickerScrollbar: true,
			step: 30
		});
		
//		$(".timepicker").datetimepicker({
//			hours12: false,
//			format: 'm-d-Y h:i A',
//			formatTime: 'h:i a',
//			timepicker: true,
//			datepicker: true,
//			timepickerScrollbar: true,
//			step: 30
//		});

		$(".datepicker").datetimepicker({
			hours24: true,
			format: 'm/d/y',
			formatTime: 'H:i',
			datepicker: true,
			timepicker: false,
			timepickerScrollbar: true,
			step: 30
		});
	});
</script>

<?php
if (isset($saved)) {
	echo "<div class='saved' />$saved &nbsp;&nbsp;&nbsp; <a href='/challenge/{$project['id']}/edit'>Ok</a></div>";
}
?>

<form method="post" enctype="multipart/form-data">
	<div class="home-feature-category" style="background:none; border:none;">
		<div class="container_12 splitintwo clearfix">
			<div class="grid_12 marked-category form tab-content active">

				<h1>
					<div style="float:left; text-align:center;
							height:28px; width:24px; text-align:center; line-height:28px; padding-right:4px;
							padding-bottom:1px; background:#000; color:#fff; margin-left:5px; margin-right:6px;
							border-radius:6px; -moz-border-radius:6px; -webkit-border-radius:6px; margin-top:1px">
							<a href="/challenge/<?= $project['id'] ?>" style="color:#fff; display:block">
							<i class="fa fa-angle-left" aria-hidden="true"></i></a></div> Back |
							Edit this Challenge
				</h1>
				
				<div style="padding-left:5px;">
					<!--<span class="mvl">| <a href="/category/all">All</a></span>-->
					<!--<span class="dvl">| <a href="/category/all">All Mobs</a> |</span>-->
					<a href="/challenge/<?= $project['id'] ?>"
						style="font-weight:300; font-size:15px;">View this Challenge <i class="fa fa-angle-right"
					aria-hidden="true"></i></a>
				</div>
				<div class="clear"></div>
				<br />
	
				<?php
				if (isset($_SESSION['user']['is_admin']) && $_SESSION['user']['is_admin'] ==1) {
                ?>
                <?php
                }
                ?>
            
				<input class="txt" type="text" name="project_type_id" value="2"
				class="txt" style="display:none; min-width:250px; max-width:900px;
				font-size:17px; font-weight:300; width:100% !important">
	
				<div class="row-item clearfix">
					<label class="lbl" for="txt_bio">Challenge Type:</label>
					<div class="val">
						<select class="txt" name="type_id" class="txt" style="height:48px;
							line-height:48px; font-size:17px; font-weight:300;
							max-width:390px; width:100% !important">
							<!--<option value="11" title="Deals" selected>Deals</option> -->
							<?php
								foreach ($types as $type) :
								$sel_opt = $type['id'] == $project['type_id'] ? " selected" : "";
							?>
							<option<?= $sel_opt ?> value="<?= $type['id'] ?>"
							>&nbsp;<?= $type['title'] ?></option>
							<?php endforeach; ?>
						</select>
						<p class="rs description-input"></p>
					</div>
				</div>

				<?php
				$categoryModel = new categoryModel();
				$categories = $categoryModel->getList();
				?>
				<div class="row-item clearfix" style="display:nonex;">
					<label class="lbl" for="txt_name1">Category:</label>
					<div class="val">
						<select name="category_id" class="txt" style="height:48px; line-height:48px; font-size:17px;
							font-weight:300; width:100% !important; max-width:390px">
							<option value="">Select a Category</option>

							<?php
							foreach ($categories as $category) :
							$sel = $project['category_id'] == $category['id'] ? ' selected="selected"' : ''; ?>
							<option value="<?= $category['id'] ?>" <?= $sel ?>><?= $category['title'] ?></option>
							<?php endforeach; ?>

						</select>
						<p class="rs description-input"><!--Select a category <?= $project['category_id'] ?>--></p>
					</div>
				</div>

				<div class="row-item clearfix images">
					<label class="lbl" for="txt_name1">Image(s):</label>

					<div class="val">
						<div>
							<div class="fileUpload">
								<span>Upload</span>
								<input type="file" class="upload" data-type="image" />
							</div>
							<span class="maxsize">(max size: 10MB)</span>
							<div style="clear:both"></div>
						</div>
						<?php
						foreach ($project['images'] as $image) {
							echo "<img src='/{$image['file']}' style='margin:5px 0; margin-right:8px; width:200px' />
					<a href='?deleteFile={$image['id']}'><img src='/static/images/icons/delete_icon.png' style='margin:0 2px 3px 0; width:20px' align='absmiddle' /> delete</a><br />";
						}
						?>
					</div>
				</div>

				<input class="txt" type="hidden" name="user_id" value="<?= $project['user_id'] ?>" />
				<br />

				<div class="row-item clearfix">
					<label class="lbl" for="txt_name1">Title:</label>
					<div class="val">
						<input class="txt" type="text" name="title" value="<?= $project['title'] ?>"
						class="txt" style="min-width:250px; max-width:900px;
						font-size:17px; font-weight:300; width:100% !important" data-update-variable="title">
						<p class="rs description-input" style="color:#dd0000;">
							ie. objective
						</p>
					</div>
				</div>

				<div class="row-item clearfix" id="spaceit" style="">
					<label class="lbl" for="txt_name1" id="descriplabel">&nbsp;</label>
					<div class="val" style="font-weight:300;">
						<span style="color:#000; font-weight:500; margin:0px 0 0px; font-weight:300;">
							Description/Info for your Challenge
						</span>
					</div>
				</div>

				<div class="row-item clearfix">
					<label class="lbl" for="txt_name1" id="descriplabel2">&nbsp;</label>
					<div class="val">
						<textarea id="description" name="description" class="ckeditor"
							data-update-variable="description" maxlength="250"
							style="width:80%; min-height:100px; max-height:130px; font-size:17px;
							line-height:27px;"><?= $project['description'] ?></textarea>
						<p class="rs description-input">(Max 250 characters)</p>
					</div>
				</div>
				
				<!-- ########### SWITCH FIELD STARTS HERE ########### -->
				<div class="row-item clearfix" id="sectiondiv" style="border-top:0px solid #03b5ff; margin-top:0px">
					<label class="lbl" for="txt_name1" style="padding-top:6px"></label>
					<div class="val" style="padding-top:0px; font-weight:300;">
						<h2 style="color:#000; font-weight:500; margin-bottom:10px;">
							Tags are coming soon
						</h2>
					</div>
				</div>

				<div class="row-item clearfix">
					<label class="lbl" for="txt_name1">Tags:</label>
					<div class="val">
						<input class="txt" type="text" name="tags" data-update-variable="tags"
						onkeyup="countChar(this)" id="keywords" maxlength="55"
						value="<?= $project['tags'] ?>" style="min-width:250px; max-width:900px;
						font-size:15px; font-weight:300; width:100% !important">
						<p class="rs description-input">ie. entertainment, sciencem, sports, 
						academia, celebs etc.</p>

						<div style="display:inline-block; width:auto; margin-top:5px; min-width:150px;">
							<div id="keywordscount" style="width:40px; text-align:center; 
							background:#EA0000; color:#fff; font-weight:300; display:inline-block;
							border-radius:4px; -moz-border-radius:4px; 
							-webkit-border-radius:4px;">55</div>
							<div style="display:inline-block; font-weight:300;">55 character limit</div>
						</div>
					</div>
				</div>
				
				<div class="row-item clearfix">
					<label class="lbl" for="txt_name1">Prize:</label>
					<div class="val">
						<textarea class="txt" name="prize" maxlength="250" data-update-variable="prize"
							style="width:100%; min-height:100px; max-height:100px; font-size:15px; font-weight:300;
							padding:0 10px 10px; max-width:700px;"><?= $project['prize'] ?></textarea>
						<p class="rs" style="font-weight:300;"></p>
					</div>
				</div>
				
				<div class="row-item clearfix">
					<label class="lbl" for="txt_name1"># Questions:</label>
					<div class="val">
						<input class="txt" type="text" name="opportunity" value="<?= $project['opportunity'] ?>"
						style="min-width:250px; font-size:17px; font-weight:300;" placeholder="1+">
						<p class="rs description-input" style="color:#dd0000;">
							Number of Questions
						</p>
					</div>
				</div>
				
				<div class="row-item clearfix">
					<label class="lbl" for="txt_name1">Entry Fee:</label>
					<div class="val">
						<input class="txt" type="text" name="tamount" value="<?= $project['tamount'] ?>"
						data-update-variable="tamount"
						style="min-width:250px; font-size:17px; font-weight:300;" placeholder="1+">
						<p class="rs description-input" style="color:#dd0000;"><span 
						style="font-weight:600;">Enter in Cents</span> 
						(ie. 25 = $0.25 or 100 = $1) | Fee to Play:
							<span style="font-style:normal; font-weight:600;
							color:#000;">$<?= number_format($project['tamount'],2,'.',',') ?></span>
						</p>
					</div>
				</div>

				<div id="entrysettings">
					<div class="row-item clearfix">
						<label class="lbl" for="txt_name1">Max Players:</label>
						<div class="val">
							<input class="txt" type="text" name="allowed" value="<?= $project['allowed'] ?>"
							style="min-width:250px; font-size:17px; font-weight:300;" placeholder="5+">
							<p class="rs description-input" style="color:#ff0000;">
								Maximum Players Allowed for this Challenge
							</p>
						</div>
					</div>	
				</div>
				
				<div class="row-item clearfix">
					<label class="lbl" for="txt_name1">When (EST)?:</label>
					<div class="val">
						<input class="timepicker txt" type="text" name="timestamp_end" placeholder=""
						value="<?= $project['timestamp_end'] ?>" data-update-variable="timestamp_end"
						style="min-width:250px; max-width:900px;
						font-size:17px; font-weight:300; width:100% !important" /><br />
						<p class="rs description-input" style="color:#ff0000;">
							<span style="color:#000;
							font-style:normal"><?= date('m/d/Y H:i:s a', strtotime($project['timestamp_end'])); ?> 
							| </span> When will your Challenge take place? (in EST)
						</p>
					</div>
				</div>
				
				<div class="row-item clearfix">
					<label class="lbl" for="txt_name1">Terms:</label>
					<div class="val">
						<textarea class="txt" name="terms" maxlength="250" data-update-variable="terms"
							style="width:100%; min-height:100px; max-height:100px; font-size:15px; font-weight:300;
							padding:0 10px 10px; max-width:700px;"><?= $project['terms'] ?></textarea>
						<p class="rs" style="font-weight:300;">(Optional) Terms for your Challenge</p>
					</div>
				</div>
				
				<!-- /////////////////////////////////////////////////////////////// -->
				<!-- //////////////    LOCATION SETTINGS START HERE   ////////////// -->
				<!-- /////////////////////////////////////////////////////////////// -->
				
				<div class="row-item clearfix" id="termsdiv" style="border-top:3px solid #03b5ff; margin-top:20px">
					<label class="lbl" for="txt_name1">&nbsp;</label>
					<div class="val" style="font-weight:300;">
						<h2 style="color:#000; font-weight:500;">
							Real-Time Notification Alerts (Optional)
						</h2>
						<span class="mtext" style="color:#000; font-weight:300; margin:0px 0 10px">
							Get alerts whenever someone joins your Challenge.
							<i>Note: Simply delete email and/or phone to turn off.</i>
						</span>
					</div>
				</div>

				<?php
				if (!empty($project['email'])) {
					$lister_email = $project['email'];
				} elseif(!empty($_SESSION['user']['email'])){
					$lister_email = $_SESSION['user']['email'];
				} else {
					$lister_email = "";
				}
				?>

				<div class="row-item clearfix">
					<label class="lbl" for="txt_name1">Email:</label>
					<div class="val">
						<input class="txt" type="text" name="email" value="<?= $lister_email ?>"
						style="min-width:250px; font-size:17px; font-weight:300" placeholder="youremail@somesite.com">
						<p class="rs description-input" style="color:#ff0000;"></p>
					</div>
				</div>

				<?php
				if (!empty($project['phone'])) {
					$lister_phone = $project['phone'];
				} elseif(!empty($_SESSION['user']['phone'])){
					$lister_phone = $_SESSION['user']['phone'];
				} else {
					$lister_phone = "";
				}
				?>

				<div class="row-item clearfix">
					<label class="lbl" for="txt_name1">Phone:</label>
					<div class="val">
						<input class="txt" type="text" name="phone" value="<?= $lister_phone ?>"
						style="min-width:250px; font-size:17px; font-weight:300" placeholder="###-###-####">
						<p class="rs description-input" style="color:#ff0000;">for receiving SMS
							Text Message Notifications</p>
					</div>
				</div>

				<div class="row-item clearfix" style="padding-bottom: 20px; display:none;">
					<label class="lbl" for="txt_name1">&nbsp;</label>
					<div class="val" style="font-weight:300;">
						<h2 style="color:#000; font-weight:500; margin-bottom:0px;">
							Attachments (Optional)
						</h2>
						<span class="mtext" style="color:#000; font-weight:500; margin:0px 0 10px">
						Attach Important Notes, Documentation, terms, etc.
						</span>
					</div>
				</div>

				<div class="row-item clearfix files" style="display:none;">
					<label class="lbl" for="txt_name1">Attachments:</label>
					<div class="val" style="padding-top:11px;">
						<div>
							<div class="fileUpload">
								<span>Upload</span>
								<input type="file" class="upload" data-type="file" />
							</div>
							<span class="maxsize">(max size: 10MB)</span>
							<div style="clear:both"></div>
						</div>
						<br />
						<?php
						foreach ($project['files'] as $file) {
							echo "{$file['orig_filename']} | <a href='?deleteFile={$file['id']}'>delete</a><br />";
						}
						?>
					</div>
				</div>

				<div class="row-item clearfix" id="sectiondiv" style="border-top:3px solid #03b5ff; margin-top:20px">
					<label class="lbl" for="txt_name1" style="margin-top:7px;">Access:</label>
					<div class="val" style="padding-top:7px;">
						<select name="is_private" class="txt fill-width"
							style="height:48px; line-height:48px; font-size:17px;
							font-weight:300; width:100% !important; max-width:390px">
							<?php
							foreach (['0', '1'] as $val)
								:
							$sel = $project['is_private'] == $val ? " selected='selected'" : "";
							$txt = $val == '0' ? 'Public' : 'Private (Invite Only)'; ?>

							<option value="<?= $val ?>"<?= $sel ?>><?= $txt ?></option>

							<?php endforeach; ?>
						</select>
						
						<p class="rs description-input" style="color:#dd0000; margin-bottom:5px;">
							Coming Soon
						</p>
					</div>
				</div>

				<?php if (isset($_SESSION['user']['is_admin'])) { ?>

				<!-- ########### SWITCH FIELD STARTS HERE ########### -->
				<?php
				$check_featured = $project['is_featured'] ? " checked" : "";
				?>
				<div class="row-item clearfix" style="display:nonex;">
					<label class="lbl" for="txt_name1">Feature (Admin)?:</label>
					<div class="val" style="padding-top:11px;">
						<label class='switch'>
							<input class='' id='' data-toggle='toggle' type='checkbox'
							name="is_featured"<?= $check_featured ?> /><span class='sliderr round'></span>
						</label>
					</div>
				</div>
				<!-- ########### SWITCH FIELD STARTS HERE ########### -->
				<?php } ?>

				<div class="row-item clearfix" style="display:nonex;">
					<label class="lbl" for="txt_name1" style="padding-top:6px">Active?:</label>
					<div class="val" style="padding-top:0px;">
						<?php
						$check_active = $project['is_active'] ? ' checked="checked"' : '';
						?>
						<label class='switch' style="display:inline-block; float:left;">
							<input class='' id='' data-toggle='toggle'  type='checkbox'
							name="is_active"<?= $check_active ?> /><span class='sliderr round'></span>
						</label>
						<div style="display:inline-block; float:left; height:30px; width:120px; line-height:30px;
							 font-weight:300; margin-left:7px;">
							Off = save as Draft
						</div>
					</div>
				</div>
				
			</div><!--end: .marked-category -->
			<div class="clear"></div>
		</div>
		<!-- END OF LEFT COLUMN -->
		
		<!-- //////////////////////////////////////////////////////////////////////////// -->
		<!-- ////////////////////      FIXED COLUMN ON THE RIGHT     //////////////////// -->
		<!-- //////////////////////////////////////////////////////////////////////////// -->

		<div class="container_12 splitintwor clearfix">
			<div class="coupon-wrapper" style="margin:0 auto;">
				<h2>
					<a href="/challenge/<?= $project['id'] ?>" style="font-weight:500;">Preview</a>
					of your Challenge
				</h2>
				<div class="coupon-realtime">

					<?php if ($project['main_img'] != "") : ?>
					<a href="/challenge/<?= $project['id'] ?>">
						<div class="coupon-image"><img
							src="/<?= $project['main_img'] ?>" data-variable="image"
							alt="Challenge Img" style="max-height:300px; width:100%;
							object-fit: cover; overflow:hidden" /></div></a>
					<?php else : ?>
					<a href="/challenge/<?= $project['id'] ?>">
						<div class="coupon-image"><img
							src="/static/images/default_listing_banner.jpg"
							alt="Img" style="height:100px; max-height:300px; width:100%;
							object-fit: cover; overflow:hidden" /></div></a>

					<?php endif; ?>

					<div class="coupon-content"><!-- DARK BLUE 005089 -->
						<div style="width:100%; max-height:88px; overflow:hidden; margin-bottom:7px">
							<span style="font-weight:bold; color:#00A1FE; text-transform: uppercase;
							font-family:Montserrat, 'Open Sans',Helvetica, sans-serif; font-size:17px;"
							data-variable="title"><?= $project['title'] ?></span>
						</div>

						<!--<p data-variable="description"><?= $project['description'] ?></p>-->
						<!--<span>0.00 Miles away</span><br />-->

						<div class="clear"></div>
						<div style="width:100%; max-height:88px; overflow:hidden; margin-bottom:7px">
							<p id="regTitle" style="font-size:16px;" 
							data-variable="prize"><?= substr($project['prize'],0,160); ?></p>
						</div>
						
						<div style="display:none; width:100%; max-height:88px; overflow:hidden; margin-bottom:7px">
							<p id="regTitle" style="font-size:17px !important;">
								<?= substr($project['description'],0,160) . '...'; ?>	
							</p>
						</div>

						<!--<div style="background:none; float:left; width:50px; margin:0; height:25px;
						font-weight:600; text-align:right; padding:0px 10px 0 5px; line-height:25px;">
						WHEN
						</div>-->

						<div style="display:nonex; background:none; position:relative; float: none;
						overflow: hidden; height:25px; line-height:25px;">
							<span style="font-weight:600;">WHEN:</span> 
							<span style="float:right; font-size:15px;"><?= date('g:i a \o\n M d, Y',strtotime('0 hour' ,
							strtotime($project['timestamp_end']))); ?></span>
							<!-- g:i a \o\n m/d/y  -->
						</div>
						<div class="clear"></div>

						<div style="background:none; float:left; width:100px; height:25px;
						font-weight:600; text-align:left; padding:0px 10px 0 0px;
						line-height:25px; margin-top:5px;">
							FEE TO PLAY:
						</div>

						<div style="background:none; position:relative; float: right; overflow: hidden;
							height:25px; line-height:25px; margin-top:5px; text-align:right; font-size:15px;">
							<span style="color:#00C617; font-weight:600; font-size:17px;">$</span>
							<span style="color:#00C617; font-weight:600; font-size:17px;
							font-size:15px;" data-variable="tamount"
							class="numbers"><?= number_format(($project['tamount']/100),2,'.',',') ?></span> per player
						</div>
						<div class="clear"></div>
					</div>
					<div class="clear"></div>
				</div>
			</div>
		</div>

		<div class="clear"></div>

	</div><!--end: .home-feature-category -->
	<div class="home-feature-category" style="background:none; border:none; padding-top:20px;">
		<div class="container_12 splitintwo clearfix"
		style="margin-top:0px;  background:none; border:none; padding-top:0px;">
			<div class="row-item clearfix submit-wrapper"
			style="margin-top:30px; background:none; border:none; padding-top:0px;">
				<!--<label class="lbl" for="txt_name1">&nbsp;</label>-->
				<div class="val">
					<input class="btn btn-black" type="submit"
					style="padding:15px 30px; font-family: 'Open Sans'; font-weight:300;" value="Save Changes" />
					<br /><br />
					<div style="text-align:center; height:24px; overflow:hidden; font-size:15px;
					line-height:24px; background:none;">
						<a class="txt" href="/challenge/<?= $project['id'] ?>?delete=<?= $project['id'] ?>"
							 style="color:#ff0000;"><img src="/static/images/icons/delete_icon_red.png" alt="X"
							style="height:16px; margin-top:-2px;" /> Delete Challenge</a>
					</div>
				</div>
			</div>
		</div>
		<div class="clear"></div>
	</div><!--end: .home-feature-category -->
</form>

<br /><br />

<script type="text/javascript">
	function addLevel()
	{
		$('.levels .dynamicSection').append($('#first_level').html());
	}
	function updateCouponImage(input)
	{
		if (!input.files || !input.files[0])
			return false;

		var reader = new FileReader();
		reader.onload = function(e) {
			$("[data-variable='image']").attr("src", e.target.result);
		}
		reader.readAsDataURL(input.files[0]);
	}
	// CHARACTER COUNTING TOOL FOR TAGS
	function countChar(val)
	{
		var len = val.value.length;
		if (len >= 55) {
			c
		} else {
			$('#keywordscount').text(55 - len);
		}
	};

	$(document).ready(function() {
		// CHARACTER COUNTING TOOL FOR TAGS
		var specialty_text = $('#keywords').val();
		var specialty_text_length = $('#keywords').val().length;

		if (specialty_text_length < 55) {
			$('#keywordscount').text(55 - specialty_text_length);
		}
		// REAL-TIME PREVIEW FEATURE
		$("[data-update-variable!='']").each(function() {
			var elm_input  = $(this);
			elm_input.on("keyup change", function() {
				var variable   = elm_input.attr("data-update-variable");
				var elm_update = $("[data-variable='" + variable + "']");
				var attribute  = elm_update.attr("data-attribute");

				if (! attribute)
					//alert('Text');
				// update HTML
				// .toLocaleString()
				if (variable == "budget") {
					var budg = elm_input.val();
					//alert('Budget: ' + budg);
					var budgy = Number(budg).toLocaleString();
					//alert('Budget: ' + budgy);
					elm_update.html(budgy);
				} else if (variable == "opportunity") {
					var tamt = elm_input.val();
					//alert('T Amt: ' + tamt);
					var tamtf = Number(tamt).toLocaleString();
					//alert('Budget: ' + budgy);
					elm_update.html(tamtf);
				} else {
					elm_update.html(elm_input.val());
				}

				//descrippreview.html(evt.editor.getData());
				//var desc = CKEDITOR.instances.description.getData();
				//alert(desc);
				else
					//alert('Here');
				// update the attribute's data
				elm_update.attr(attribute, elm_input.val());
			});
		});
		//sortinput, totalreqs
		$('#reqinput').blur(function() {
			var reqtext = $(this).val();
			var totalreqs = $("#totalreqs").val(); // Customer ID associated with a phone number

			var thislength = $('#reqinput').val().length;

			if (thislength > 0) {
				$("#sortinput").val(totalreqs);
			} else {
				$("#sortinput").val('');
			}

		});

		/////////////
	});
</script>

<script type="text/javascript">
	//	CKEDITOR.replace( 'ckeditor7' ,{
	//		filebrowserBrowseUrl : '/filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
	//		filebrowserUploadUrl : '/filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
	//		filebrowserImageBrowseUrl : '/filemanager/dialog.php?type=1&editor=ckeditor&fldr='
	//	});
	CKEDITOR.replace( 'ckeditor1' );
	CKEDITOR.replace( 'ckeditor2' );
	var editor = CKEDITOR.replace( 'description' );
	var descripcontent;
	// The "change" event is fired whenever a change is made in the editor.
	editor.on( 'change', function( evt ) {
		// getData() returns CKEditor's HTML content.
		//alert('Yep');
		descripcontent = evt.editor.getData();

		//		var descrip_length = descripcontent.length();
		//		if (descrip_length > 160) {
		//			$("#regTitle").html(descripcontent.substr(0, 160));
		//		} else {
		//			$("#regTitle").html(descripcontent);
		//		}
		// REF
		//$(this).val(text.substr(0, maxlength));
		//alert('D: ' + descripcontent);
		//descrippreview.html(descripcontent);
		// ORIG
		$("#regTitle").html(descripcontent);

		//descrippreview.html(evt.editor.getData());
		//console.log( 'Total bytes: ' + evt.editor.getData().length );
	});
	$(document).ready(function() {

		$("#getDataBtn").click(function() {
			//var editorData= CKEDITOR.instances['description'].getData();
			//alert(" your data is :"+editorData);
			//alert('clicked');
		});
		
		$('#showlocationsettings').click(function () {
			$("#locationsettings").slideToggle();
		});
		$('#showcollab').click(function () {
			$(".collabmore").slideToggle();
		});
		$('#showflipmob').click(function () {
			$("#flipmobsettings").slideToggle();
		});
		$('#showentries').click(function () {
			$("#entrysettings").slideToggle();
		});
	});
</script>

<script src='/static/js/jquery.csv-0.71.js'> </script>