<?php
/**
* @version 1.0.0
* @package RSEvents! 1.0.0
* @copyright (C) 2009 www.rsjoomla.com
* @license GPL, http://www.gnu.org/copyleft/gpl.html
*/

defined('_JEXEC') or die('Restricted access');
global $mainframe;
JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
$db = JFactory::getDBO();
if(!isset($_GET['page'])) $_GET['page'] = '1';
if($_GET['page'] != 1 && $_GET['page'] != 2 && $_GET['page'] != '' ) $mainframe->redirect(html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=addeditevent'.$this->itemId)));
?>

<?php switch($_GET['page']) { ?>
<?php 
		case '1':  
		default: {  ?>
<script type="text/javascript">
	function validation()
	{
		var form = document.adminForm;
		var ret = true;
		
		if(form.EventName.value=='') { form.EventName.className = 'rserror'; ret=false; } else { form.EventName.className = '';  }	
		if(form.IdCategory.value=='0') { form.IdCategory.className = 'rserror'; ret=false; } else { form.IdCategory.className = '';   }	
		if(form.IdLocation.value=='0') { form.IdLocation.className = 'rserror'; ret=false; } else { form.IdLocation.className = '';  }	
		if(form.EventHost.value=='') { form.EventHost.className = 'rserror'; ret=false; } else { form.EventHost.className = ''; }
		if(form.EventStartDate.value=='') { form.EventStartDate.className = 'rserror'; ret=false; } else { form.EventStartDate.className = '';  }	
		if(form.EventStartDateH.value=='') { form.EventStartDateH.className = 'rserror'; ret=false; } else { form.EventStartDateH.className = ''; }	
		if(form.EventStartDateM.value=='') { form.EventStartDateM.className = 'rserror'; ret=false; } else { form.EventStartDateM.className = '';  }	
		if(form.EventEndDate.value=='') { form.EventEndDate.className = 'rserror'; ret=false; } else { form.EventEndDate.className = '';	 }
		if(form.EventEndDateH.value=='') { form.EventEndDateH.className = 'rserror'; ret=false; } else { form.EventEndDateH.className = '';  }	
		if(form.EventEndDateM.value=='') { form.EventEndDateM.className = 'rserror'; ret=false; } else { form.EventEndDateM.className = '';  }	
		<?php if($this->rseventsConfig['enable.12format'] == 1) { ?>
			if(form.EventStartDateH.value > 12 || form.EventStartDateH.value < 1) { form.EventStartDateH.className = 'rserror'; ret=false; } else { form.EventStartDateH.className = ''; }	
			if(form.EventStartDateM.value > 59 || form.EventStartDateM.value < 0) { form.EventStartDateM.className = 'rserror'; ret=false; } else { form.EventStartDateM.className = '';  }
			if(form.EventEndDateH.value > 12 || form.EventEndDateH.value < 1) { form.EventEndDateH.className = 'rserror'; ret=false; } else { form.EventEndDateH.className = '';  }	
			if(form.EventEndDateM.value > 59 || form.EventEndDateM.value < 0) { form.EventEndDateM.className = 'rserror'; ret=false; } else { form.EventEndDateM.className = '';  }
		<?php } else { ?>
			if(form.EventStartDateH.value > 23 || form.EventStartDateH.value < 0) { form.EventStartDateH.className = 'rserror'; ret=false; } else { form.EventStartDateH.className = ''; }	
			if(form.EventStartDateM.value > 59 || form.EventStartDateM.value < 0) { form.EventStartDateM.className = 'rserror'; ret=false; } else { form.EventStartDateM.className = '';  }
			if(form.EventEndDateH.value > 23 || form.EventEndDateH.value < 0) { form.EventEndDateH.className = 'rserror'; ret=false; } else { form.EventEndDateH.className = '';  }	
			if(form.EventEndDateM.value > 59 || form.EventEndDateM.value < 0) { form.EventEndDateM.className = 'rserror'; ret=false; } else { form.EventEndDateM.className = '';  }
		<?php } ?>
		
		return ret;
	}
	
	
	function rse_doApply()
	{
		document.getElementById('task').value = 'apply';
		return validation();
	}
	
	function rse_doSave()
	{
		document.getElementById('task').value = 'save';
		return validation();
	}
	
</script>
<style>
.rserror 
{
	border:1px solid red;
}
</style>	
<form action="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=addeditevent&cid='.$this->data->IdEvent.$this->itemId)); ?>" method="post" enctype="multipart/form-data" name="adminForm" id="adminForm">
<fieldset class="rsevents">
<legend><?php echo JText::_('RSE_EVENT_INFO'); ?></legend>
				<table>
				<?php if($this->isAdmin) { ?>
					<tr>
						<td>
							<label for="published">
								<?php echo JText::_( 'RSE_PUBLISHED' ).':'; ?>
							</label>
						</td>
						<td>						
							<?php echo JHTML::_('select.booleanlist','published','class="inputbox"',$this->data->published); ?>
						</td>
					</tr>
				<?php } ?>
					<tr>
						<td>
							<label for="eventname">
								<?php echo JText::_( 'RSE_EVENT_NAME' ).':'; ?>
							</label>
						</td>
						<td>						
							<input name="EventName" value="<?php echo $this->data->EventName; ?>" size="50" maxlength="100" /> (*)
						</td>
					</tr>
					<tr>
						<td>
							<label for="eventsubtitle">
								<?php echo JText::_( 'RSE_EVENT_SUBTITLE' ).':'; ?>
							</label>
						</td>
						<td>						
							<input name="EventSubtitle" value="<?php echo $this->data->EventSubtitle; ?>" size="50" maxlength="100" />
						</td>
					</tr>
					<tr>
						<td>
							<label for="hosted">
								<?php echo JText::_( 'RSE_EVENT_HOSTER' ).':'; ?>
							</label>
						</td>
						<td>						
							<input name="EventHost" value="<?php echo $this->data->EventHost; ?>" size="50" maxlength="100" /> (*)
						</td>
					</tr>
					<tr>
						<td>
							<label for="web">
								<?php echo JText::_( 'RSE_EVENT_WEB' ).':'; ?>
							</label>
						</td>
						<td>						
							<input name="EventURL" value="<?php echo $this->data->EventURL; ?>" size="50" maxlength="100" />
						</td>
					</tr>
					<tr>
						<td>
							<label for="phone">
								<?php echo JText::_( 'RSE_EVENT_PHONE' ).':'; ?>
							</label>
						</td>
						<td>						
							<input name="EventPhone" value="<?php echo $this->data->EventPhone; ?>" size="50" maxlength="100" />
						</td>
					</tr>
					<tr>
						<td>
							<label for="email">
								<?php echo JText::_( 'RSE_EVENT_EMAIL' ).':'; ?>
							</label>
						</td>
						<td>						
							<input name="EventEmail" value="<?php echo $this->data->EventEmail; ?>" size="50" maxlength="100" />
						</td>
					</tr>
					<tr><td>&nbsp;</td></tr>
					<!--  GROUP -->
					
					<?php if($this->numCat != 1) { ?>
					<tr>
						<td>
							<label for="category">
								<?php echo JText::_( 'RSE_EVENT_CATEGORY' ).':'; ?>
							</label>
						</td>
						<td>						
							<?php echo $this->lists['categories']; ?> (*)
						</td>
					</tr>
					<?php } ?>
					<tr>
						<td>
							<label for="location">
								<?php echo JText::_( 'RSE_EVENT_LOCATION' ).':'; ?> <img id="rse_hideme" style="display:none;" src="<?php echo JURI::root().'components/com_rsevents/images/loader.gif' ?>">
							</label>
						</td>
						<td>						
						<input type="text" name="lfilter" id="lfilter" value="" size="15" onkeyup="rse_search_locations(this.value);" onkeydown="rse_stop_search_locations();" />	
						<span id="rse_locations"><?php echo $this->lists1['locations']; ?></span>  (*) 
						<?php echo ($this->locationPermission != '0') ? '<a class="modal" href="index.php?option=com_rsevents&view=locations&layout=addeditlocation&tmpl=component'.$this->itemId.'" rel="{handler: \'iframe\', size: {x: 800, y: 600}}">'.JText::_('RSE_EVENT_ADD_LOCATION').'</a>' : ''; ?>
						</td>
					</tr>
					<tr><td>&nbsp;</td></tr>
					<!--  GROUP -->
					<tr>
						<td>
							<label for="StartDate">
								<?php echo JText::_( 'RSE_EVENT_START_DATE' ).':'; ?>
							</label>
						</td>
						<td>						
							<?php echo JHTML::_('calendar', date('Y-m-d',$this->data->EventStartDate), "EventStartDate", "EventStartDate"); ?>						
							<input name="EventStartDateH" style="text-align:center;" value="<?php echo $this->data->EventStartDateH; ?>" size="3" maxlength="2" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" /> : <input name="EventStartDateM"  style="text-align:center;" value="<?php echo $this->data->EventStartDateM; ?>" size="3" maxlength="2" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" /> <?php if($this->rseventsConfig['enable.12format'] == 1) echo JHTML::_('select.booleanlist','EventAmPm1','class="inputbox"',$this->data->EventAmPm1,'pm','am'); ?> (*)
						</td>
					</tr>
					<tr>
						<td>
							<label for="EndDate">
								<?php echo JText::_( 'RSE_EVENT_END_DATE' ).':'; ?>
							</label>
						</td>
						<td>						
							<?php echo JHTML::_('calendar', date('Y-m-d',$this->data->EventEndDate), "EventEndDate", "EventEndDate"); ?>						
							<input name="EventEndDateH" style="text-align:center;" value="<?php echo $this->data->EventEndDateH; ?>" size="3" maxlength="2" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" /> : <input name="EventEndDateM" style="text-align:center;" value="<?php echo $this->data->EventEndDateM; ?>" size="3" maxlength="2" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" /> <?php if($this->rseventsConfig['enable.12format'] == 1) echo JHTML::_('select.booleanlist','EventAmPm2','class="inputbox"',$this->data->EventAmPm2,'pm','am'); ?> (*)
						</td>
					</tr>
					<!--  GROUP -->
					<tr><td>&nbsp;</td></tr>
					<tr>
					<td width="200">
						<label for="access" class="editlinktip hasTip" title="Selecting 'Private' you will get a private link to share with event attendants.">
							<?php echo JText::_( 'RSE_EVENT_OPTION_TYPE' ).':'; ?>
						</label>
					</td>
					<td>
						<?php echo JHTML::_('select.booleanlist','EventType','class="inputbox"',($this->data->IdEvent ? $this->data->EventType:1),JText::_('RSE_PUBLIC'),JText::_('RSE_PRIVATE')); ?>
					</td>
				</tr>
				<?php if($this->data->EventType == '0') { ?>
					<tr>
						<td width="200">
							<label for="provateUrl">
								<?php echo JText::_( 'RSE_EVENT_OPTION_PRIVATE_URL' ).':'; ?>
							</label>
						</td>
						<td>
							<strong><a href="<?php echo JURI::root().'index.php?option=com_rsevents&task=showevent&cid='.$this->data->IdEvent.'&privateUrl='.$this->data->EventPrivateUrl; ?>" target="_blank"><?php echo JURI::root().'index.php?option=com_rsevents&task=showevent&cid='.$this->data->IdEvent.'&privateUrl='.$this->data->EventPrivateUrl; ?></a></strong> - (<a href="index.php?option=com_rsevents&task=generate&cid=<?php echo $this->data->IdEvent; ?>&controller=events"><?php echo JText::_('RSE_EVENT_GENERATE_PRIVATE_URL');?></a>)
						</td>
					</tr>
					<?php } ?>
				<tr>
					<td width="200">
						<label for="registration">
							<?php echo JText::_( 'RSE_EVENT_OPTION_REGISTRATION' ).':'; ?>
						</label>
					</td>
					<td>
						<?php echo JHTML::_('select.booleanlist','EventEnableRegistration','class="inputbox"',$this->data->EventEnableRegistration); ?>
						<?php 
					if($this->data->EventEnableRegistration)
						{
							echo '&nbsp;&nbsp;<a href="'.html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=tickets&cid='.$this->data->IdEvent.':'.JFilterOutput::stringURLSafe($this->data->EventName).$this->itemId)).'">'.JText::_('RSE_EVENT_OPTION_TICKETS').'</a>'; 
						} 
					?>
					</td>
				</tr>
				<tr>
					<td width="200">
						<label for="overbooking">
							<?php echo JText::_( 'RSE_EVENT_OPTION_OVERBOOKING' ).':'; ?>
						</label>
					</td>
					<td>
						<?php echo JHTML::_('select.booleanlist','EventOverbooking','class="inputbox"',$this->data->EventOverbooking); ?>
					</td>
					</tr>
				<tr>
					<td width="200">
						<label for="showGuest">
							<?php echo JText::_( 'RSE_EVENT_OPTION_GUEST' ).':'; ?>
						</label>
					</td>
					<td>
						<?php echo JHTML::_('select.booleanlist','EventShowGuest','class="inputbox"',$this->data->EventShowGuest); ?>
					</td>
				</tr>
				<tr>
					<td width="200">
						<label for="autoaprove" class="editlinktip hasTip" title="<?php echo JText::_('RSE_EVENT_AUTO_APROVE_INFO'); ?>">
							<?php echo JText::_( 'RSE_EVENT_AUTO_APROVE' ).':'; ?>
						</label>
					</td>
					<td>
						<?php echo JHTML::_('select.booleanlist','EventAutoApprove','class="inputbox"',$this->data->EventAutoApprove); ?>
					</td>
				</tr>
				<?php if (defined('RSEVENTS_PAYPAL') && $this->rseventsConfig['paypal.for.users'] == 1) { ?>
					<tr>
						<td width="200">
							<label for="paypal_email">
								<?php echo JText::_( 'RSE_PAYPAL_EMAIL' ).':'; ?>
							</label>
						</td>
						<td>
							<input name="EventPaypalEmail" value="<?php echo $this->data->EventPaypalEmail; ?>" size="50" />
						</td>
					</tr>
					<tr>
					   <td width="200"><label for="returnurl"><?php echo JText::_('RSE_PAYPAL_RETURN_URL') . ' : '; ?></label>
					   <td><input type="text" name="EventReturnUrl" value="<?php echo $this->data->EventReturnUrl; ?>" size="50" /></td>
					</tr>
					<?php } ?>
				<?php if($this->rseventsConfig['events.commenting'] != 0) { ?>
				<tr>
					<td width="200">
						<label for="comments">
							<?php echo JText::_( 'RSE_EVENT_OPTION_COMMENT' ).':'; ?>
						</label>
					</td>
					<td>
						<?php echo JHTML::_('select.booleanlist','EventEnableComments','class="inputbox"',$this->data->EventEnableComments); ?>
					</td>
				</tr>
				<?php } ?>
				<?php if ($this->rseventsConfig['enable.event.icon'] == 1) { ?>
					<tr>
						<td width="200">
							<label for="icon">
								<?php echo JText::_( 'RSE_ICON' ).':'; ?>
							</label>
						</td>
						<td>
							<?php if ($this->data->EventIcon == '') { ?>
								<input type="file" name="icon" size="40"/>
							<?php } else { ?>
								<img style="vertical-align:middle;" src="<?php echo JURI::root(); ?>components/com_rsevents/images/thumbs/<?php echo str_replace('.jpg','_'.$this->rseventsConfig['event.icon.small'].'.jpg',$this->data->EventIcon); ?>" /> <a href="<?php echo JRoute::_('index.php?option=com_rsevents&task=deleteicon&controller=events&cid='.$this->data->IdEvent.$this->itemId,false); ?>"><img src="<?php echo JURI::root().'administrator/components/com_rsevents/images/icons/delete.png'; ?>" /></a>
							<?php } ?>
						</td>
					</tr>
					<?php } ?>
					<tr>
						<td>
							<label for="keywords">
								<?php echo JText::_( 'RSE_EVENT_KEYWORDS' ).':'; ?>
							</label>
						</td>
						<td>						
							<textarea id="EventKeywords" name="EventKeywords" rows="5" cols="50"><?php echo $this->data->EventKeywords; ?></textarea>
						</td>
					</tr>
					<tr>
						<td>
							<label for="keywords">
								<?php echo JText::_( 'RSE_EVENT_METADESCRIPTION' ).':'; ?>
							</label>
						</td>
						<td>						
							<textarea id="EventMetaDescription" name="EventMetaDescription" rows="5" cols="50"><?php echo $this->data->EventMetaDescription; ?></textarea>
						</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td>						
							<button type="button" onclick=<?php if($this->data->IdEvent){ ?> "document.location = '<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=show&cid='.$this->data->IdEvent.':'.JFilterOutput::stringURLSafe($this->data->EventName).$this->itemId)); ?>';" <?php } else { ?> "document.location = '<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events'.$this->itemId));?>';"<?php } ?> style="float:right;"><?php echo JText::_('RSE_CANCEL_BTN'); ?></button>
							<button type="submit" onclick="return rse_doSave();" style="float:right;"><?php echo JText::_('RSE_NEXT_BTN'); ?></button>
							<button type="submit" onclick="return rse_doApply();" style="float:right;"><?php echo JText::_('RSE_APPLY'); ?></button>
						</td>
					</tr>
				</table>
</fieldset>
<?php echo JHTML::_( 'form.token' ); ?>
	<input type="hidden" name="option" value="com_rsevents" />
	<input type="hidden" name="cid" value="<?php echo $this->data->IdEvent; ?>" />
	<input type="hidden" name="IdEvent" value="<?php echo $this->data->IdEvent; ?>" />
	<input type="hidden" name="controller" value="events" />
	<input type="hidden" name="view" value="events" />
	<input type="hidden" name="layout" value="addeditevent" />
	<input type="hidden" id="task" name="task" value="save" />
	<input type="hidden" name="page" value="1" />
	<?php if($this->numCat ==1) { ?>
	<input type="hidden" id="IdCategory" name="IdCategory[]" value="<?php echo $this->idCat; ?>" />
	<?php } ?>
	<input type="hidden" id="IdDesign" name="IdDesign" value="<?php echo ($this->data->IdEvent == '0') ? '1' : $this->data->IdDesign; ?>" />
<?php
//keep session alive while editing
JHTML::_('behavior.keepalive');
?>
</form>
<?php } break; ?>
<?php case '2': { ?>
<script type="text/javascript">
	function newFile()
	{
		document.getElementById('files').innerHTML += '<br/><input type="file" name="files[]" size="40"/>';
	}
	function updateDesign(IdDesign,DesignName)
	{
		document.getElementById('designName').innerHTML = DesignName + ' (<?php echo JText::_('RSE_PLEASE_SAVE'); ?>)'; 
		document.getElementById('IdDesign').value = IdDesign;
		document.getElementById('defImg').src = '<?php echo JURI::root(); ?>components/com_rsevents/designs/' + DesignName + '/' + DesignName +'.png';
		document.getElementById('sbox-window').close();
	}
</script>
<form action="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=addeditevent&cid='.$this->data->IdEvent.'&page=2'.$this->itemId)); ?>" method="post" enctype="multipart/form-data" name="adminForm" id="adminForm">
<h1><?php echo JText::_('RSE_EVENT_LAYOUT'); ?></h1>

<fieldset class="rsevents">
<legend><?php echo JText::_('RSE_DESIGN'); ?></legend>
			<div style="width:150px;text-align:center;">						
				<?php $img_path = JURI::root().'components/com_rsevents/designs/'.$this->data->DesignName.'/'.$this->data->DesignName.'.png'; ?>
					<a href="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=selectdesign&cid='.$this->data->IdDesign.'&tmpl=component')); ?>" class="modal" rel="{size: {x: 700, y: 480}}">
						<img border="1" src="<?php echo $img_path; ?>" id="defImg" width="150" height="100" /><br/>
						<span id="designName"><?php echo $this->data->DesignName; ?></span>
					</a>
			</div>
</fieldset>
<fieldset class="rsevents">
<legend><?php echo JText::_('RSE_EXTRAS'); ?></legend>
<p>
			<?php $links=array();
				if ($this->rseventsConfig['events.extras.youtube']) $links[] = '<a href="'.html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=youtube&cid=0&IdEvent='.$this->data->IdEvent.'&tmpl=component'.$this->itemId)).'" class="modal">'.JText::_('Youtube').'</a>'; 
				if($this->rseventsConfig['events.extras.flash']) $links[] = '<a href="'.html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=flash&cid=0&IdEvent='.$this->data->IdEvent.'&tmpl=component'.$this->itemId)).'" class="modal">'.JText::_('Flash').'</a>';
				if($this->rseventsConfig['events.extras.mp3']) $links[] = '<a href="'.html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=mp3&cid=0&IdEvent='.$this->data->IdEvent.'&tmpl=component'.$this->itemId)).'" class="modal">'.JText::_('MP3').'</a>';
				if($this->rseventsConfig['events.extras.meebo']) $links[] = '<a href="'.html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=chat&cid=0&IdEvent='.$this->data->IdEvent.'&tmpl=component'.$this->itemId)).'" class="modal">'.JText::_('Meebo').'</a>';
				if($this->rseventsConfig['events.extras.flickr']) $links[] = '<a href="'.html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=flickr&cid=0&IdEvent='.$this->data->IdEvent.'&tmpl=component'.$this->itemId)).'" class="modal">'.JText::_('Flickr').'</a>';
				echo implode(' | ',$links);	?>
</p>
			<?php if(!empty($this->extras)) { ?>		
				<table cellpadding="0" cellspacing="0" class="rsevents-table-list">
					<thead>
						<tr>
							<th style="text-align:center;">
								<?php
									echo JText::_( 'RSE_EXTRA_TYPE' ); 
								?>
							</th>
							<th style="text-align:center;">
								<?php
									echo JText::_( 'RSE_EXTRA' ); 
								?>
							</th>
							<th style="text-align:center;">
								<?php
									echo JText::_( 'RSE_EDIT' ); 
								?>
							</th>
							<th style="text-align:center;">
								<?php
									echo JText::_( 'RSE_EXTRAS_DELETE' ); 
								?>
							</th>
						</tr>
					</thead>
					<tbody>
						<?php
						$k = 0;
						for ($i=0,$n=count($this->extras);$i<$n;$i++)
						{		
						$row =& $this->extras[$i];
						if($row->ExtraName=='flash') $row->ExtraValue = '---';
						if($row->ExtraName=='meebo') $row->ExtraValue = '---';
						?>
							<tr class="<?php echo "row$k"; ?>">
								<td align="center"><img src="<?php echo JURI::root().'components/com_rsevents/images/icons/'.$row->ExtraName.'.jpg'; ?>" /></td>
								<td align="center"><a href="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout='.$row->ExtraName.'&cid='.$row->IdExtra.'&IdEvent='.$this->data->IdEvent.'&tmpl=component'.$this->itemId)); ?>" class="modal"><?php echo substr(preg_replace('/\<br(\s*)?\/?\>/i', "\n", $row->ExtraValue),0,50); ?></a></td>
								<td align="center"><a href="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout='.$row->ExtraName.'&cid='.$row->IdExtra.'&IdEvent='.$this->data->IdEvent.'&tmpl=component'.$this->itemId)); ?>" class="modal"><img src="<?php echo JURI::root().'images/M_images/edit.png'; ?>"></a></td>
								<td align="center"><a href="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&task=deleteextra&controller=events&cid='.$row->IdExtra.'&IdEvent='.$this->data->IdEvent.$this->itemId)); ?>"><img src="<?php echo JURI::root().'administrator/components/com_rsevents/images/icons/delete.png'; ?>"></a></td>
							</tr>
						<?php	$k=1-$k;
						}
						?>
					</tbody>
				</table>	
			<?php } ?>
</fieldset>
<fieldset class="rsevents">
<legend><?php echo JText::_('RSE_FILES'); ?></legend>
			<div id="files">
				<input type="file" name="files[]" size="40"/>
			</div>
				<br/><a href="" onclick="newFile();return false;"><?php echo JText::_('RSE_FILE_ADD_FILES'); ?></a>
			<?php if(!empty($this->files)) { ?>				
				<table  class="rsevents-table-list">
					<thead>
						<tr>
							<th align="center">
								<?php
									echo JText::_( 'RSE_FILE_NAME' ); 
								?>
							</th>
							<th align="center">
								<?php
									echo JText::_( 'RSE_FILE_VISIBLE_EVERYONE' ); 
								?>
							</th>
							<th align="center">
								<?php
									echo JText::_( 'RSE_FILE_VISIBLE_REGISTERED' ); 
								?>
							</th>
							<th align="center">
								<?php
									echo JText::_( 'RSE_EDIT' ); 
								?>
							</th>
							<th align="center">
								<?php
									echo JText::_( 'RSE_DELETE_FILE' ); 
								?>
							</th>
						</tr>
					</thead>
					<tbody>
						<?php
						$k = 0;
						for ($i=0,$n=count($this->files);$i<$n;$i++)
						{		
							$row =& $this->files[$i];
						?>
								<tr class="<?php echo "row$k"; ?>">
									<td align="center"><a href="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=files&cid='.$row->IdFile.'&IdEvent='.$this->data->IdEvent.'&tmpl=component'.$this->itemId)); ?>" class="modal"><?php echo $row->FileName; ?></a></td>
									<td align="center"><?php echo JText::_('RSE_FILE_BEFORE').$row->fp0.' '; ?><?php echo JText::_('RSE_FILE_DURING').$row->fp1.' '; ?><?php echo JText::_('RSE_FILE_AFTER').$row->fp2.' '; ?></td>
									<td align="center"><?php echo JText::_('RSE_FILE_BEFORE').$row->fp3.' '; ?><?php echo JText::_('RSE_FILE_DURING').$row->fp4.' '; ?><?php echo JText::_('RSE_FILE_AFTER').$row->fp5.' '; ?></td>
									<td align="center"><a href="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=files&cid='.$row->IdFile.'&IdEvent='.$this->data->IdEvent.'&tmpl=component'.$this->itemId)); ?>" class="modal"><img src="<?php echo JURI::root().'images/M_images/edit.png'; ?>"></a></td>
									<td align="center"><a href="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&task=deletefile&controller=files&cid='.$row->IdFile.'&IdEvent='.$row->IdEvent.$this->itemId)); ?>"><img src="<?php echo JURI::root().'administrator/components/com_rsevents/images/icons/delete.png'; ?>" title="Delete" alt="<?php echo JText::_('RSE_DELETE_FILE'); ?>"></a></td>
								</tr>
						<?php	$k=1-$k;
						}
						?>
					</tbody>
				</table>		
<?php } ?>	
</fieldset>
<fieldset class="rsevents">
<legend><?php echo JText::_('RSE_DESCRIPTION'); ?></legend>
			<?php $editor=& JFactory::getEditor();
				echo $editor->display('EventDescription',$this->data->EventDescription,450,400,50,10);
			?>
			<br/><br/>
			<button type="button" onclick=<?php if($this->data->IdEvent){ ?> "document.location = '<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=show&cid='.$this->data->IdEvent.':'.JFilterOutput:: stringURLSafe($this->data->EventName).$this->itemId)); ?>';" <?php } else { ?> "document.location = '<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events'.$this->itemId));?>';"<?php } ?> style="float:right;"><?php echo JText::_('RSE_CANCEL_BTN'); ?></button>
<button type="submit" style="float:right;"><?php echo JText::_('RSE_SAVE_BTN'); ?></button>
<button type="button" onclick="document.location='<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=addeditevent&cid='.$this->data->IdEvent.'&page=1'.$this->itemId)); ?>'" style="float:right;"><?php echo JText::_('RSE_BACK_BTN'); ?></button>
</fieldset>	
	<?php echo JHTML::_( 'form.token' ); ?>
	<input type="hidden" name="option" value="com_rsevents" />
	<input type="hidden" name="cid" value="<?php echo $this->data->IdEvent; ?>" />
	<input type="hidden" name="IdEvent" value="<?php echo $this->data->IdEvent; ?>" />
	<input type="hidden" name="controller" value="events" />
	<input type="hidden" name="view" value="events" />
	<input type="hidden" name="layout" value="addeditevent" />
	<input type="hidden" name="task" value="save" />
	<input type="hidden" name="page" value="2" />
	<input type="hidden" id="IdDesign" name="IdDesign" value="<?php echo ($this->data->IdEvent == '0') ? '1' : $this->data->IdDesign; ?>" />
</form>
<?php
//keep session alive while editing
JHTML::_('behavior.keepalive');
?>
<?php } break; ?>
<?php } ?>