<script language="javascript" type="text/javascript">
  function ck(id) {
    ckStatus = document.getElementById('ck_event_' + id).checked;
	
	document.getElementById('ck_event_' + id).checked = (ckStatus ? false : true);
	document.getElementById('row_event_' + id).style.backgroundColor = (ckStatus ? "#FFFFFF" : "#CFD6E2");
  }
  
  function omov(id, over) {
    ckStatus = document.getElementById('ck_event_' + id).checked;
	document.getElementById('row_event_' + id).style.backgroundColor = (over?(ckStatus?"#CFD6E2":"#F1F3F8"):(ckStatus?"#CFD6E2":"#FFFFFF"));
  }
  
  function checkAll(formID, boolean) {
	var formSet = document.forms[formID].getElementsByTagName('input');
	for (var i=0; i<formSet.length; i++) {
		formSet[i].checked = boolean;
	}
  }
  
</script>
	
<h2>Edit Events</h2>
<p>&nbsp;</p>
		<ZONE editEventHeader disabled>
		<h2>[Success! {315}] </h2>
		<p>Event Listing not found <br />
		    <br />
		      <a href="?L=events.mngevents">Back</a></p>
		<br/><br/>
		</ZONE editEventHeader disabled>
		<ZONE editEventHeader success>
		<h2>[Success! {315}] </h2>
		<p>[Your Event has been added to the events calendar. Would you like to add another event? {6105}] <br />
		    <br />
		      <a href="?L=events.event&amp;id={event.id}">[View event listing {6110}]</a></p>
		<br/><br/>
		</ZONE editEventHeader success>
		
		<ZONE editEventHeader retroDate>
		<h2>[Error {160}] </h2>
		<p>[Sorry, you can not set an event to be attended on a past date. Please start over {6115}] </p>
		<br/><br/>
		</ZONE editEventHeader retroDate>
		
		<ZONE editEventHeader emptyField>
		<h2>[Error {160}] </h2>
		<p>[Either the title or the description field has been left empty, you must set a title and a description {6120}] </p>
		<br/><br/>
		</ZONE editEventHeader emptyField>

<ZONE editEventHeader enabled>
<form metod="get" id="userControlForm">
<input type="hidden" name="L" value="events.mngevents" />
<table width="100%" border="0" cellspacing="3" cellpadding="0">
<tr>
    <td><strong>Search or Event ID:</strong><input name="query" type="text" id="query" value="{query}"></td>
    <td><strong>Order by:    </strong><select name="order" onChange="this.form.submit();">
      <option value="id" {order.ck.id}>ID</option>
      <option value="username" {order.ck.title}>Title</option>
      <option value="active" {order.ck.date}>Date</option>
      </select>
      <select name="direction" onChange="this.form.submit();">
        <option value="ASC" {direction.ck.asc}>Ascending</option>
        <option value="DESC" {direction.ck.desc}>Descending</option>
      </select></td>
    <td><strong>Results per page: </strong><select name="rpp" id="rpp" onChange="this.form.submit();">
      <option value="20" {rpp.ck.10}>10 events per page</option>
      <option value="50" {rpp.ck.20}>20 events per page</option>
      <option value="100" {rpp.ck.50}>50 events per page</option>
    </select></td>
  </tr>
  <tr>
    <td><input name="Submit" type="submit" value="Resample"></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<br>
<br>
<table width="100%" border="0" cellspacing="3" cellpadding="0">
  <tr>
    <td>
	  <ZONE dbUpdate enabled><br /><strong><span style="color:red;">Successfully updated {dbUpdateCount} database row(s)</span></strong></ZONE dbUpdate enabled>
	  </td>
    <td align="right">Page {page.pagenumber} out of {page.totalpages}</td>
  </tr>
</table>
<br>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="40">&nbsp;</td>
    <td><strong>ID</strong></td>
    <td><strong>Title</strong></td>
    <td><strong>Location</strong></td>
    <td><strong>Date</strong></td>
    <td><strong>Mainpicture</strong></td>
  </tr>
  <tr>
    <td height="1" colspan="10" bgcolor="#CCCCCC"><img src="{themePath}/images/frame/spacer.gif" alt="Spacer" height="1" /></td>
  </tr>
  <LOOP eventsList>
  <tr id="row_event_{event.id}" onClick="ck('{event.id}');">
    <td onMouseOver="omov('{event.id}', 1);" onMouseOut="omov('{event.id}', 0);"><input type="checkbox" name="ck[]" id="ck_event_{event.id}" value="{event.id}" onClick="ck('{event.id}');"></td>
    <td onMouseOver="omov('{event.id}', 1);" onMouseOut="omov('{event.id}', 0);">{event.id}</td>
    <td onMouseOver="omov('{event.id}', 1);" onMouseOut="omov('{event.id}', 0);">{event.title}</td>
    <td onMouseOver="omov('{event.id}', 1);" onMouseOut="omov('{event.id}', 0);">{event.location}</td>
    <td onMouseOver="omov('{event.id}', 1);" onMouseOut="omov('{event.id}', 0);">{event.date}</td>
    <td onMouseOver="omov('{event.id}', 1);" onMouseOut="omov('{event.id}', 0);"><img src="system/cache/pictures/{event.mainpicture}" width="50" height="50"></td>
    <td onMouseOver="omov('{event.id}', 1);" onMouseOut="omov('{event.id}', 0);"><a href="?L=events.mngevents&e={event.id}">Edit</a></td>
  </tr>
  <tr>
    <td height="1" colspan="10" bgcolor="#CCCCCC"><img src="{themePath}/images/frame/spacer.gif" alt="Spacer" height="1" /></td>
  </tr>
  </LOOP eventsList>
  <tr>
    <td height="30" colspan="10" nowrap bgcolor="#CCCCCC" style="padding-left:5px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><select name="action" id="action">
          <option selected>With selected events...</option>
          <option value="delete">Delete selected events</option>
        </select>
          <input name="Act" type="submit" id="Act" value="Submit"></td>
        <td align="right" style="padding-right:10px;">
		 <ZONE paginationBlock enabled>
        <ZONE pagination.back disabled>&laquo; Back</ZONE pagination.back disabled>
        <ZONE pagination.back linked><a href="{pagination.back.link}">&laquo; Back</a></ZONE pagination.back linked>
        
        <ZONE pagination.first disabled></ZONE pagination.first disabled>
        <ZONE pagination.first linked><a href="{pagination.first.link}">1...</a> </ZONE pagination.first linked>
        
        <OBJ pagination.unlinked.page><strong>{pagination.page.pageNumber}</strong></OBJ pagination.unlinked.page>
        <OBJ pagination.linked.page> <a href="{pagination.page.link}">{pagination.page.pageNumber}</a> </OBJ pagination.linked.page>
        
        {pagination.pages}
        
        <ZONE pagination.last disabled></ZONE pagination.last disabled>
        <ZONE pagination.last linked><a href="{pagination.last.link}">...{pagination.last.pageNumber}</a> </ZONE pagination.last linked>
        
        <ZONE pagination.next disabled>Next &raquo;</ZONE pagination.next disabled>
        <ZONE pagination.next linked><a href="{pagination.next.link}">Next &raquo;</a></ZONE pagination.next linked>
        </ZONE paginationBlock enabled>

      <ZONE paginationBlock disabled>      </ZONE paginationBlock disabled>		</td>
      </tr>
    </table>

</td>
  </tr>
</table>
</form>
</ZONE editEventHeader enabled>
		<ZONE editEventHeader edit>
          <form method="post" enctype="multipart/form-data">
		  <table width="500" border="0" cellspacing="3" cellpadding="0">
            <tr>
              <td valign="top">[Event Title: {6130}] </td>
              <td><input name="title" type="text" class="fullwidth" id="title" value="{event.title}"></td>
            </tr>
            <tr>
              <td valign="top">[Description: {6135}] </td>
              <td><textarea name="body" rows="8" class="fullwidth" id="body">{event.body}</textarea></td>
            </tr>
            <tr>
              <td valign="top">[Show to: {6140}] </td>
              <td>
			    <label><input name="display" type="radio" value="private" {event.v}> 
			    [Me {6145}] </label>
			    <label><br>
			    <input name="display" type="radio" value="shared" {event.c}>
			    [My Contacts {6150}] </label>
			    <br>
                <label><input name="display" type="radio" value="public" {event.p}>
                [All the users {6155}] </label></td>
            </tr>
            <tr>
              <td valign="top"><strong>[Date: {6160}]</strong></td>
              <td><select name="date_m" id="date_m">
                {date.month}
              </select>
                <select name="date_d" id="date_d">
                  {date.day}
                </select>
                <select name="date_y" id="date_y">
                  {date.year}
                      </select></td>
            </tr>
            <tr>
              <td valign="top"><strong>[Starts at: {6165}]</strong></td>
              <td><select name="date_h" id="date_h">
				{date.hour}
              </select>
			        <select name="date_i" class="style2" id="date_i">
					{date.min}
            </select>			  </td>
            </tr>
            <tr>
              <td valign="top"><strong>Active</strong></td>
              <td><select name="active" id="active">
				<option value="0" {active_n}>No</option>
				<option value="1" {active_y}>Yes</option>
              </select>
			</td>
            </tr>
            <tr>
              <td valign="top">[Location: {6170}] </td>
              <td><input name="location" type="text" class="fullwidth" id="location" value="{event.location}"></td>
            </tr>
            <tr>
              <td valign="top">Event Picture:</td>
              <td><img src="system/cache/pictures/{event.mainpicture}" width="150" height="150">
			</td>
            </tr>
            <tr>
              <td valign="top">Delete Picture:</td>
              <td><input type="checkbox" name="del" id="del" value="1">
			</td>
            </tr>
            <tr>
              <td valign="top">[Upload Photo: {480}] </td>
              <td><input type="file" name="file"></td>
            </tr>
            <tr>
              <td valign="top">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td valign="top">&nbsp;</td>
              <td><input type="hidden" name="e" value="{event.id}"><input type="submit" name="Submit" value="[Submit {295}]" class="submit"></td>
            </tr>
          </table> 
		  </form>
		  </ZONE editEventHeader edit>
