<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="edit">
	<h3 style="position:relative;left:-185px;"><?php echo 'MY CONTESTS'; ?></h3>
	<hr style="margin-left:-190px;">
	
  
	   <div id="tabs" class="htabs">
			<a href="#tab-activecontests">ACTIVE CONTESTS</a>
			<a href="#tab-mycontests">MY CONTESTS</a>
			<a href="#tab-allcontests">ALL CONTESTS</a>
	  </div><span style="float: right;width: 8px;top: -46px;right: 137px;position: relative;"><a onclick="image_upload123('designs', 'thumb');">  <img width="150px" height="50px;" src="catalog/view/theme/default/image/newimage/addnewdesigns.png" /></a> </span>
<br>
    <div class="content" id="tab-activecontests">
		  
	<div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:25px;">Contest Id</span>
   </div>
   <div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:215px;float:left;">
		<span style="position: relative; top: 8px; left:18px;">Description</span>
   </div>
   <div style="	border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:22px;">Prize Money</span>
   </div>
   <div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:34px;">Status</span>
   </div>
   <div style="	border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:34px;">Entries</span>
   </div>
   <div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:11px;">Participate Now</span>
   </div>
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   
   <div class="image">  <input type="hidden" value="" id="designs" /></div>
     <?php if ($activecontests) { ?>
            <?php foreach ($activecontests as $contest) { ?>
			<br>
   	<div style="margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:56px;margin-left:-14px;">#<?php echo $contest['contest_id']; ?></span>
   </div>
	<div style="margin-bottom: 5px;width:215px;float:left;">
		<span style="position: relative; top: 8px;left:18px;"><a style="color:#0000FF;margin-bottom:10px;" href="http://www.tresorjewellery.com.au/index.php?route=desaccount/overall&cid=<?php echo $contest['contest_id']; ?>"><?php echo $contest['description']; ?></a></span>
   </div>
	<div style="margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:44px;"><?php echo $contest['code']; ?> <?php echo $contest['prize_amount']; ?></span>
   </div>
	<div style="margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:19px;"><?php echo $contest['status']; ?></span>
   </div>
	<div style="margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:56px;"><?php echo $contest['entry']; ?></span>
   </div>
	<div style="margin-bottom: 5px;width:105px;float:left;margin-top:-20px;">
		<span style="position: relative; top: 8px;left:6px;"><a onclick="image_upload('designs', 'thumb','<?php echo $contest['contest_id']; ?>','<?php echo $this->designer->getId(); ?>');" id="<?php echo $contest['contest_id']; ?>" class="<?php echo $this->designer->getId(); ?>"> <img width="116px" height="30px" src="catalog/view/theme/default/image/newimage/submitdesign.png" /></a><br>
		<a href="JavaScript:newPopup('http://www.tresorjewellery.com.au/message/sendmessage.php?designer=<?php echo $desin; ?>&cst=<?php echo $contest['customer_id']; ?>');"><img width="116px" height="30px" src="catalog/view/theme/default/image/newimage/sendmessage.png" /></a></span>
   </div> <i style="font-size:10px;">Submitted Designs</i>: <br><br> 
   <div style=" width:757px;float:left;margin-top:-17px;"> 
    <?php foreach ($contest['image'] as $designer_detail) {  ?>
			 <img style="border:1px solid grey;width:50px;height:50px;" src="<?php echo 'image/'.$designer_detail['image']; ?>" />  
			<?php } ?>
			</div> <br><br><br>  <hr style="border-bottom: 0.1px solid #DDDDDD;margin-top: -10px;">
    <?php } ?> 
            <?php } else { ?>
            <tr>
              <td class="center" colspan="9">No results</td>
            </tr>
            <?php } ?>

			
   
  </div>  
  
  
    <div class="content" id="tab-mycontests">
  
  	<div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:25px;">Contest Id</span>
   </div>
    <div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:215px;float:left;">
		<span style="position: relative; top: 8px; left:18px;">Description</span>
   </div>
    <div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:22px;">Prize Money</span>
   </div>
    <div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:34px;">Status</span>
   </div>
    <div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:27px;">My Entries</span>
   </div>
    <div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:11px;">Participate Now</span>
   </div>
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   
    <?php if ($mycontests) { ?>
            <?php foreach ($mycontests as $contest) { ?>
   
      	<div style="margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:56px;margin-left:-15px;">#<?php echo $contest['contest_id']; ?></span>
   </div>
	<div style="margin-bottom: 5px;width:215px;float:left;">
		<span style="position: relative; top: 8px;left:28px;"><?php echo $contest['description']; ?></span>
   </div>
	<div style="margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:44px;"><?php echo $contest['code']; ?> <?php echo $contest['prize_amount']; ?></span>
   </div>
	<div style="margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:20px;"><?php echo $contest['status']; ?></span>
   </div>
	<div style="margin-bottom: 5px;width:105px;float:left;">
		<span style="position: relative; top: 8px;left:56px;"><?php echo $contest['entry']; ?></span>
   </div>
	<div style="margin-bottom: 30px;width:105px;float:left;margin-top:-20px;">
		<span style="position: relative; top: 8px;left:6px;"><a onclick="image_upload('designs', 'thumb','<?php echo $contest['contest_id']; ?>','<?php echo $this->designer->getId(); ?>');" id="<?php echo $contest['contest_id']; ?>" class="<?php echo $this->designer->getId(); ?>"><img width="116px" height="30px" src="catalog/view/theme/default/image/newimage/submitdesign.png" /></a><br>
		</span>
   </div>
   
    <?php } ?>
            <?php } else { ?>
            <tr>
              <td class="center" colspan="9">No results</td>
            </tr>
            <?php } ?>
   
  
  </div>  
  
  
  
  
  <div class="content" id="tab-allcontests">
 
	<div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:125px;float:left;">
		<span style="position: relative; top: 8px;left:30px;">Contest Id</span>
   </div>
   <div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:250px;float:left;">
		<span style="position: relative; top: 8px; left:18px;">Description</span>
   </div>
   <div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:125px;float:left;">
		<span style="position: relative; top: 8px;left:40px;">Status</span>
   </div>
   <div style="	border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:125px;float:left;">
		<span style="position: relative; top: 8px;left:40px;">Entries</span>
   </div>
   <div style="border:1px solid #EDEDED;height: 30px;border-radius:3px;box-shadow: -2px 8px 11px -8px grey;margin-bottom: 5px;width:125px;float:left;">
		<span style="position: relative; top: 8px;left:30px;">Feedback</span>
   </div>

   
   
      <?php if ($contests) { ?>
            <?php foreach ($contests as $contest) { ?>
   
	<div style="height: 30px;border-radius:3px;margin-bottom: 5px;width:125px;float:left;">
		<span style="position: relative; top: 8px;left:45px;">#<?php echo $contest['contest_id']; ?></span>
   </div>
   <div style="height: 30px;border-radius:3px;margin-bottom: 5px;width:250px;float:left;">
		<span style="position: relative; top: 8px; left:18px;"><?php echo $contest['description']; ?></span>
   </div>
   <div style="height: 30px;border-radius:3px;margin-bottom: 5px;width:125px;float:left;">
		<span style="position: relative; top: 8px;left:23px;"><?php echo $contest['status']; ?></span>
   </div>
   <div style="height: 30px;border-radius:3px;margin-bottom: 5px;width:125px;float:left;">
		<span style="position: relative; top: 8px;left:40px;"><?php echo $contest['entry']; ?></span>
   </div>
   <div style="height: 30px;border-radius:3px;margin-bottom: 5px;width:125px;float:left;">
		<span style="position: relative; top: 8px;left:30px;"><?php echo $contest['feedback']; ?></span>
   </div>
     <?php } ?>
            <?php } else { ?>
            <tr>
              <td class="center" colspan="9">No results</td>
            </tr>
            <?php } ?>

  
  </div>
  
			 <!--<?php foreach ($designer_details as $designer_detail) {  ?>
			 <img style="border:1px solid grey;width:50px;height:50px;" src="<?php echo $designer_detail['image']; ?>" />  
			<?php } ?> --->


   
  </form>
  <?php echo $content_bottom; ?></div>
<?php echo $footer; ?>

<script type="text/javascript"><!--
function image_upload123(field, thumb) {
	$('#dialog').remove();
	$('.image').prepend('<div id="dialog" style="padding: 3px 0px 0px 0px;"><iframe src="index.php?route=common/filemanager1&field=' + encodeURIComponent(field) + '" style="padding:0; margin: 0; display: block; width: 100%; height: 100%;" frameborder="no" scrolling="auto"></iframe></div>');
	var img ='no_image.jpg';
	//alert(img);
	$('#dialog').dialog({
		title: 'Your Designs',
		close: function (event, ui) {
		//	if ($('#' + field).attr('value')) {
		//	var imag = $('#' + field).attr('value');
		//	var imag1 =imag.substr(6);
				$.ajax({
					url: 'index.php?route=common/filemanager1/image&image=' + img,
					dataType: 'text',
					success: function(data) {
						location.reload();
						//$('#' + thumb).replaceWith('<img src="' + data + '" alt="" id="' + thumb + '" />');
					}
				});
			//}
		},	
		bgiframe: false,
		width: 800,
		height: 400,
		resizable: false,
		modal: false
	});
};
//--></script> 
<script type="text/javascript"><!--
function image_upload(field, thumb,contestid,designerid) {
	$('#dialog').remove();
	$('.image').prepend('<div id="dialog" style="padding: 3px 0px 0px 0px;"><iframe src="index.php?route=common/filemanager2&field=' + encodeURIComponent(field) + '" style="padding:0; margin: 0; display: block; width: 100%; height: 100%;" frameborder="no" scrolling="auto"></iframe></div>');
	var img ='no_image.jpg';
	//alert(img);
	$('#dialog').dialog({
		title: 'Your Designs',
		close: function (event, ui) {
			if ($('#' + field).attr('value')) {
			var imag = $('#' + field).attr('value');
			var imag1 =imag.substr(6);
			//var datavalue='index.php?route=common/filemanager1/image&contestid=' + contestid ;
				$.ajax({
					url: 'index.php?route=common/filemanager/insert&image=' + imag1 + '&contestid=' + contestid + '&designerid=' + designerid,
					dataType: 'text',
					success: function(data) {
					alert('Your Design has been Submitted Successfully.');
						//$('#' + thumb).replaceWith('<img src="' + data + '" alt="" id="' + thumb + '" />');
					}
				});
			}
		},	
		bgiframe: false,
		width: 800,
		height: 400,
		resizable: false,
		modal: false
	});
};
//--></script> 
<script type="text/javascript"><!--
$('#tabs a').tabs();
//--></script> 
<script type="text/javascript">
// Popup window code
function newPopup(url) {
	popupWindow = window.open(
		url,'popUpWindow','height=300,width=500,left=260,top=160,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>