{include file="$gentemplates/_header.tpl"}

<script type="text/javascript">
var err_no_start = "{$temp_err_no_start}";
var err_no_end = "{$temp_err_no_end}";
var err_end_before = "{$temp_err_end_before}";
var err_no_person = "{$temp_err_no_person}";
var err_no_participant = "{$temp_err_no_participant}";
var err_thema_long = "{$temp_err_thema_long}";
var err_external_long = "{$temp_err_external_long}";

{literal}
function selectItems() {
    var to_form = eval('document.nd.elements[\"participants[]\"]');
    for(i=0; i < to_form.length; i++) {
	to_form.options[i].selected = true;
    }
    if(i==0 && document.nd.i_will.checked == false) {
	alert(err_no_participant);
	return false;
    }
    return true;
}

function check_form() {
    if (document.nd.day.checked == false) {
	if (document.nd.appointment_start.value == 0) {
	    alert (err_no_start);
	    document.nd.appointment_start.focus();
	    return false;
	} else if (document.nd.appointment_end.value == 0) {
	    alert (err_no_end);
	    document.nd.appointment_end.focus();
	    return false;
	} else if (!document.nd.appointment_attribute[0].checked && (document.nd.appointment_end.value < document.nd.appointment_start.value)) {
	    alert (err_end_before);
	    document.nd.appointment_end.focus();
	    return false;
	}
    }

    if (document.nd.external.value.length > 200) {
		alert (err_external_long);
		return false;
    }

    return selectItems();
}
</script>
{/literal}

<form name="nd" action="{$phpself}" method="POST">
<input type="hidden" name="{$SESSIONNAME}" value="{$SESSIONID}">
<input type="hidden" name="date" value="{$date}">

{include file="$gentemplates/_navi.tpl" submenu="$submenu"}
{include file="$gentemplates/_contentheader.tpl" title="$temp_title"}

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr align="left">
    <td class="category" height="20" width="10">&nbsp;</td>
    <td class="category" width="130">{$temp_dateandtime}</td>
    <td class="category" width="70%">&nbsp;</td>
  </tr>
  <!--- NATYS --->
	<tr>
		<td COLSPAN="3" class="category">
		{$natys}
		</td>
	</tr>  
  <!--- --->
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr class="tab" align="left">
    <td class="tab" height="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></td>
    <td class="formhead">{$gentemp_date}</td>
    <td class="formhead">{$gentemp_day}&nbsp;{$serial_start_day}&nbsp;&nbsp;{$gentemp_month}&nbsp;{$serial_start_month}&nbsp;&nbsp;{$gentemp_year}&nbsp;{$serial_start_year}</td>
  </tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr class="tab" align="left">
    <td class="tab" height="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></td>
    <td class="formhead">{$temp_fromto}</td>
    <td class="tab">
      <select name="appointment_start" size="1">
	<option value="0">&nbsp;</option>	
	  {section name=hour loop=$appointment_start_list}
	<option value="{$appointment_start_list[hour].timestamp}"{$appointment_start_list[hour].sel}>{$appointment_start_list[hour].time_label}</option>	
	  {/section}	    
      </select>	
      -
      <select name="appointment_end" size="1">
	<option value="0">&nbsp;</option>	
	  {section name=hour loop=$appointment_end_list}
	<option value="{$appointment_end_list[hour].timestamp}"{$appointment_end_list[hour].sel}>{$appointment_end_list[hour].time_label}</option>	
	  {/section}	    
      </select>
      <img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" />
      <input type="checkbox" name="day"{$daysel}>{$gentemp_wholeday}<img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" />
      <input type="checkbox" name="holiday"{$holisel}>{$gentemp_vacation}<img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" />
      <input type="checkbox" name="private"{$prsel}>{$gentemp_private}
    </td>
  </tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>						
  <tr align="left">
    <td class="category" height="20"><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
    <td class="category" width="130">{$temp_locationandsubject}</td>
    <td class="category">&nbsp;</td>
  </tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr class="tab" align="left">
    <td class="tab" height="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></td>
    <td class="formhead">{$temp_city}</td>
    <td class="tab"><input class="form" style="width:70ex;" type="text" value="{$location|escape:"html"}" name="location" maxlength="100" size="80"></td>
  </tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr class="tab" align="left">
    <td class="tab" height="60"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></td>
    <td class="formhead">{$temp_subject}</td>
    <td class="tab"><textarea class="formtextarea" style="width:70ex; height:6em;" name="thema" rows="4" cols="80">{$thema}</textarea></td>
  </tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>						
  <tr align="left">
    <td class="category" height="20"><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
    <td class="category" width="130">{$temp_participants}</td>
    <td class="category">&nbsp;</td>
  </tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr class="tab" align="left">
    <td class="tab" height="60"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></td>
    <td class="formhead">&nbsp;</td>
    <td class="tab"><input type="checkbox" name="i_will"{if $temp_will_selected eq "true"} checked{/if}> {$temp_i_will}</td>
  </tr>
  <tr class="tab" align="left">
    <td class="tab" height="80"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></td>
    <td class="formhead">{$temp_participants}</td>
    <td class="formhead" >
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
	<tr>
	  <td class="formhead" valign="top" width="270">{$availableparticipants}<br>
	    <select class="available" name="tn[]" multiple size="4">
	      {section name=pt loop=$partie}
	      <option value="{$partie[pt].userid}">{$partie[pt].name}</option>
		{/section}	    
	    </select>
	    <br>
	    <input class="submit" onclick="MoveOption('tn','participants');" type="button" value="{$addbutton}" name="Add">			    
	    <img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" />
	  </td>
	  <td class="formhead" valign="top">
	    {$temp_selparticipants}
	    <br>
	    <select class="select" multiple  name="participants[]">
	      {section name=spt loop=$spartie}
	      <option value="{$spartie[spt].userid}">{$spartie[spt].name}</option>
		{/section}	
	    </select>
	    <br>
	    <input class="submit" onclick="MoveOption('participants','tn');" type="button" value="{$removebutton}" name="Remove">
	  </td>
	  <td class="formhead" align="left" width="200">&nbsp;</td>
	</tr>
	<tr>
	  <td class="formhead" colspan=3>&nbsp;</td>
	</tr>
	<tr>
	  <td class="formhead" align="left">&nbsp;</td>
	  <td class="formhead" align="left" colspan="2">
	    <input class="submit" onclick="testAvail('{$sname}');" type="button" value="{$temp_avail_text}" name="AvailTest"><br /><br />
	  </td>
	</tr>
      </table>
    </td>
  </tr>
  <tr><td class="lines"  height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr class="tab" align="left">
    <td class="tab" height="60"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></td>
    <td class="formhead">{$temp_extparticipants}</td>
    <td class="formhead">
      <textarea class="formtextarea" name="external" rows="4" cols="80" style="width:70ex; height:4em;">{$external}</textarea>
    </td>
  </tr>
  {if $appointment_attribute == 0}
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>						
  <tr align="left">
    <td class="category" height="20"><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
    <td class="category" width="130">{$temp_repititions}</td>
    <td class="category">&nbsp;</td>
  </tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr class="tab" align="left">
    <td class="tab" height="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></td>
    <td class="formhead">{$temp_appointmentrepeat}</td>
    <td class="formhead">
      <table border="0" cellpadding="0" cellspacing="6">
	<tr class="tab">
	  <td><input type="radio" name="appointment_attribute"{if $appointment_attribute==0} checked{/if} value="0">{$gentemp_repeater_0}</td>
	  <td><input type="radio" name="appointment_attribute"{if $appointment_attribute==4} checked{/if} value="4">{$gentemp_repeater_4}</td>
	  <td><input type="radio" name="appointment_attribute"{if $appointment_attribute==1} checked{/if} value="1">{$gentemp_repeater_1}</td>
	  <td><input type="radio" name="appointment_attribute"{if $appointment_attribute==2} checked{/if} value="2">{$gentemp_repeater_2}</td>
	  <td><input type="radio" name="appointment_attribute"{if $appointment_attribute==3} checked{/if} value="3">{$gentemp_repeater_3}</td>
	  <td><input type="radio" name="appointment_attribute"{if $appointment_attribute==5} checked{/if} value="5">{$gentemp_repeater_5}</td>
	</tr>
      </table>
    </td>
  </tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr class="tab" align="left">
    <td class="tab" height="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></td>
    <td class="formhead">{$temp_timeframe|default:"&nbsp;"}</td>
    <td class="formhead">&nbsp;{$gentemp_day}&nbsp;{$serial_end_day}&nbsp;&nbsp;{$gentemp_month}&nbsp;{$serial_end_month}&nbsp;&nbsp;{$gentemp_year}&nbsp;{$serial_end_year}</td>
  </tr>
  {/if}
  <tr><td class="lines2" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr class="tab" align="left">
    <td class="tab" height="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></td>
    <td class="formhead"><a class="edit" href="{$back}">{$gentemp_abort}</a>&nbsp;</td>
    <td class="formhead"><input class="submit" type="submit" name="{$sname}" value="{$suvalue}" onclick="return check_form();"></td>
  </tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
</table>
<input type="hidden" name="id" value="{$id}">
</form>

{include file="$gentemplates/_footer.tpl" aktUser=$username}
