{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}";
var id_day_start_time = "{$id_day_start_time}";
var id_day_end_time = "{$id_day_end_time}";
var caller = "";

{literal}

<!-- NATYS -->

function fill_days(obj_day){
var label_i = '';
obj_day.length = 0;
for (i=0;i<31;i++)
	{
	if (i+1<10) label_i = '0'+(i+1);
	else label_i = i+1;	
	obj_day.options[i] = new Option(label_i,label_i);
	}
}

function is_leap_year(year){
    if (((year % 4) == 0 && (year % 100)!=0) || (year % 400)==0)
	return 1;
    else
	return 0;
}

function nb_day(month,year){
var nbday=0;
switch (month)
	{
	case '01':
        nbday = 31;
		break;
		
	case '03':
        nbday = 31;
		break;

	case '05':
        nbday = 31;
		break;

	case '07':
        nbday = 31;
		break;

	case '08':
        nbday = 31;
		break;

	case '10':
        nbday = 31;
		break;

	case '12':
        nbday = 31;
		break;
//-------------------
    case '04':
        nbday = 30;
		break;
		
	case '06':
        nbday = 30;
		break;
	
	case '09':
        nbday = 30;
		break;
	
	case '11':
        nbday = 30;
		break;
	
//-------------------	
    case '02':
		if (is_leap_year(year))
		nbday = 29;
		else
		nbday = 28;
		break;
	}
	return nbday;
}


function keep_nbday_coherence(when){
var obj_day = document.nd.elements[when+'_day'];
var obj_month = document.nd.elements[when+'_month'];
var obj_year = document.nd.elements[when+'_year'];


nbday = nb_day(obj_month.options[obj_month.selectedIndex].value, obj_year.options[obj_year.selectedIndex].value);

//save selected day:
var id_selected_day = obj_day.selectedIndex;

//fill days selectbox:
fill_days(obj_day);
//delete impossible days:
for (i=31;i>=nbday;i--)
	{
	 obj_day.options[i]=null;
	}
//re-select day
//if previous selected day is now impossible -> select the last day
if (id_selected_day+1 > nbday) id_selected_day = nbday-1;
obj_day.selectedIndex = id_selected_day;
	
/*alert(nbday);
alert(obj_month.selectedIndex);
alert(obj_month.options[0].value);
*/
}

function start_day_change(){

id_start_day_selected = document.nd.start_day.selectedIndex;
val_start_day_selected = document.nd.start_day.options[id_start_day_selected].value;

/*
if ( document.nd.serial_end_day.value < document.nd.serial_start_day.value &&
	 document.nd.serial_end_month.value <= document.nd.serial_start_month.value &&
	 document.nd.serial_end_year.value <= document.nd.serial_start_year.value
	)
	document.nd.serial_end_day = document.nd.serial_start_day.value;
*/
{/literal}
{if $appointment_attribute == 0}
document.nd.serial_end_day.selectedIndex = id_start_day_selected;
{/if}
{literal}
}

function start_month_change(){

id_start_month_selected = document.nd.start_month.selectedIndex;
val_start_month_selected = document.nd.start_month.options[id_start_month_selected].value;

/*if ( ddocument.nd.serial_end_month.value < document.nd.serial_start_month.value &&
	 document.nd.serial_end_year.value <= document.nd.serial_start_year.value
	)
	document.nd.serial_end_day = document.nd.serial_start_day.value;
	document.nd.serial_end_month = document.nd.serial_start_month.value;
*/
{/literal}
{if $appointment_attribute == 0}
	document.nd.serial_end_month.selectedIndex = id_start_month_selected;
	keep_nbday_coherence('start');
	keep_nbday_coherence('serial_end');
{else}
	keep_nbday_coherence('start');
{/if}
{literal}
}

function start_year_change(){

id_start_year_selected = document.nd.start_year.selectedIndex;
val_start_year_selected = document.nd.start_year.options[id_start_year_selected].value;

/*if ( document.nd.serial_end_year.value < document.nd.serial_start_year.value
	)
	ocument.nd.serial_end_day = document.nd.serial_start_day.value;
	document.nd.serial_end_month = document.nd.serial_start_month.value;
	document.nd.serial_end_year = document.nd.serial_start_year.value;
*/
{/literal}
{if $appointment_attribute == 0}
	document.nd.serial_end_year.selectedIndex = id_start_year_selected;
	keep_nbday_coherence('start');
	keep_nbday_coherence('serial_end');
{else}
	keep_nbday_coherence('start');
{/if}
{literal}
}

function init_times(){
	
	// memoriser les selected
	var id_start_sel = document.nd.appointment_start.options.selectedIndex;
	var id_end_sel = document.nd.appointment_end.options.selectedIndex;
	var id_end_sel_reversed = document.nd.appointment_end.length-document.nd.appointment_end.options.selectedIndex;
	//alert("start="+id_start_sel+" end="+id_end_sel+" length="+document.nd.appointment_end.length+" end_reversed="+id_end_sel_reversed);
	
	
	//----- réinitialiser les listes
	document.nd.appointment_start.length = 0;
	document.nd.appointment_start.options[0]=new Option(' ','0');
		
	{/literal}
	{php} $i=1; {/php}
	{section name=hour loop=$appointment_start_list}
	document.nd.appointment_start.options[{php} echo $i++; {/php}]=new Option('{$appointment_start_list[hour].time_label}','{$appointment_start_list[hour].timestamp}');
	{/section}
		
	document.nd.appointment_end.length = 0;
	document.nd.appointment_end.options[0]=new Option(' ','0');
	{php} $i=1; {/php}
	{section name=hour loop=$appointment_end_list}
	document.nd.appointment_end.options[{php} echo $i++; {/php}]=new Option('{$appointment_end_list[hour].time_label}','{$appointment_end_list[hour].timestamp}');
	{/section}
	id_end_sel = document.nd.appointment_end.length-id_end_sel_reversed;
	//alert("new end_sel ="+id_end_sel);
	{literal}

	//blanc:
	for (i=0; i<document.nd.appointment_end.length ; i++)
	{
	 document.nd.appointment_start.options[i].style.backgroundColor='#FFFFFF';
	 document.nd.appointment_end.options[i].style.backgroundColor='#FFFFFF';
	}
	//selectionnables:
	document.nd.appointment_start.disabled=false;
	document.nd.appointment_end.disabled=false;
	//----- fin réinit --
	
	
	//remettre les "selected"
	document.nd.appointment_start.options.selectedIndex = id_start_sel;
	document.nd.appointment_end.options.selectedIndex = id_end_sel;
	
}

function scheduling_time_click(){
	
	init_times();
	keep_appt_end_coherence();
}


function scheduling_morning_click(){
			
		init_times();
	
	var id_middle=parseInt(id_day_start_time) + (id_day_end_time-id_day_start_time)/2 - 1;

		// mettre en gris :
			//premier
			document.nd.appointment_start.options[id_day_start_time].style.backgroundColor='#E0E0E0';
			//dernier
			document.nd.appointment_end.options[id_middle].style.backgroundColor='#E0E0E0';
			
		//selectioner le 1er creneau	
		document.nd.appointment_start.options.selectedIndex=id_day_start_time;
		//selectionner le dernier creneau
		document.nd.appointment_end.options.selectedIndex=id_middle;
		
		//désactiver les selectbox
		document.nd.appointment_start.disabled=true;
		document.nd.appointment_end.disabled=true;
}

function scheduling_afternoon_click(){
		
		init_times();
	
	var id_middle=parseInt(id_day_start_time) + (id_day_end_time-id_day_start_time)/2;
	var id_last=parseInt(id_day_end_time)-1;
	
		// mettre en gris :
			//premier
			document.nd.appointment_start.options[id_middle].style.backgroundColor='#E0E0E0';
			//dernier
			document.nd.appointment_end.options[id_last].style.backgroundColor='#E0E0E0';
			
		//selectioner le 1er creneau	
		document.nd.appointment_start.options.selectedIndex=id_middle;
		//selectionner le dernier creneau
		document.nd.appointment_end.options.selectedIndex=id_last;
		
		//désactiver les selectbox
		document.nd.appointment_start.disabled=true;
		document.nd.appointment_end.disabled=true;
		
}

function scheduling_wholeday_click(){
		
	init_times();
	
	var id_last=parseInt(id_day_end_time)-1;
	
	// mettre en gris :
	//premier
		document.nd.appointment_start.options[id_day_start_time].style.backgroundColor='#E0E0E0';
	//dernier
		document.nd.appointment_end.options[id_last].style.backgroundColor='#E0E0E0';
			
	//selectioner le 1er creneau	
	document.nd.appointment_start.options.selectedIndex=id_day_start_time;
	//selectionner le dernier creneau
	document.nd.appointment_end.options.selectedIndex=id_last;
	
	//désactiver les selectbox
	document.nd.appointment_start.disabled=true;
	document.nd.appointment_end.disabled=true;
}


function keep_appt_end_coherence(){
	var j=0;
		
	//initialiser tout en blanc:
	init_times();
	
	//eliminer tous les horaires de fin impossibles:
	id_start_sel = document.nd.appointment_start.options.selectedIndex;
	val_start_sel= document.nd.appointment_start.options[id_start_sel].value;
	

	//identifier l'indice de fin (j):
	for (i=0; i<document.nd.appointment_end.length ; i++)
	{
	 if (document.nd.appointment_end.options[i].value == val_start_sel) 
	 	{
		j=i;
		break;
		}
	}

	//éliminer les indices de 1 à j :
	d=1;
	for (i=1; i<=j ; i++)
	{
	//document.nd.appointment_end.options[i].style.backgroundColor='#000000';
	document.nd.appointment_end.options[d]=null;
	}
	
	//SI indice actuel est 0 ->  selectionner l'indice 1 :
	if (document.nd.appointment_end.options.selectedIndex==0)
		document.nd.appointment_end.options.selectedIndex=1;
	
}


function update_telephone_field(id_radio){
	if (id_radio == 1){ // available
		document.nd.telephone.style.backgroundColor='#FFFFFF'; 
		document.nd.telephone.disabled = false;
		}
	else{ // not available
		document.nd.telephone.style.backgroundColor='#E0E0E0';
		document.nd.telephone.disabled=true;
		}
}

<!-- --->

function selectItems() {
    var to_form = eval('document.nd.elements[\"participants[]\"]');
    to_form.disabled=false;
	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;
    }

	//enable all fields :
	document.nd.appointment_start.disabled=false;	
	document.nd.appointment_end.disabled=false;
	document.nd.scheduling.disabled=false;

	for (var b = 0; b < document.nd.scheduling.length; b++)
          document.nd.scheduling[b].disabled = false;

	document.nd.start_day.disabled=false;
	document.nd.start_month.disabled=false;
	document.nd.start_year.disabled=false;
	//submit
    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}">
<input type="hidden" NAME="newtype" value="{$newtype}">
 
{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>
  
  <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|smarty:nodefaults}&nbsp;&nbsp;{$gentemp_month}&nbsp;{$serial_start_month|smarty:nodefaults}&nbsp;&nbsp;{$gentemp_year}&nbsp;{$serial_start_year|smarty:nodefaults}</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" ONCHANGE="keep_appt_end_coherence();" {if $newtype=="meeting"} disabled {/if}>
	<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" {if $newtype=="meeting"} disabled {/if}>
	<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="10" height="1" />
		<!--- NATYS : onclick ---->
      {section name=scheduling_type loop=$scheduling_list}
		<INPUT TYPE="radio" NAME="scheduling" {if $newtype=="meeting"} disabled {/if} VALUE="{$scheduling_list[scheduling_type].id}" {$scheduling_list[scheduling_type].chk} id="scheduling_{$scheduling_list[scheduling_type].type}" ONCLICK="scheduling_{$scheduling_list[scheduling_type].type}_click();" > <label for="scheduling_{$scheduling_list[scheduling_type].type}">{$scheduling_list[scheduling_type].text}</label>&nbsp;&nbsp;&nbsp;
	    {if $scheduling_list[scheduling_type].chk != ""}
			{assign var="sched_type" value=$scheduling_list[scheduling_type].type}
			{* variable sched_type is used at the bottom of this file *}
		{/if}
	  {/section}
	  	  	  
    </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_appt_type|capitalize},&nbsp;{$temp_loc|lower},&nbsp;{$temp_availability|lower}</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">
   {* type de rdv *}
    <td class="tab" height="60"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></td>
    <td class="formhead">{$temp_appt_type}</td>
    <td class="tab">
	
	<select name="id_appt_type" size="1" >
	  {section name=type loop=$appointment_type}
	<option value="{$appointment_type[type].id}" {$appointment_type[type].sel} >{$appointment_type[type].type}</option>	
	  {/section}	    
      </select>
  
    <SCRIPT LANGUAGE="javascript">
		//declare and describe colorisation function :
		{$script_appt_type_color.script_code}
		
		//execute colorisation :
		{$script_appt_type_color.script_name}(document.nd.id_appt_type);		
	
	</SCRIPT>
	{* ********** *}
	&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="checkbox" name="private"{$prsel} id="private_chk"><label for="private_chk">{$gentemp_private}</label>
	
	{if $class.text !=""}
	<img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" />
	<font STYLE="background-color:{$class.color};">{$class.text}</font>
	{/if}
	</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_loc}</td>
    <td class="tab">
	{* location type *}
	<select name="id_location_type" size="1" >
	  {section name=type loop=$appointment_location_type}
	<option value="{$appointment_location_type[type].id}" {$appointment_location_type[type].sel} >{$appointment_location_type[type].type}</option>	
	  {/section}	    
      </select>
	{* ****** *}  
	&nbsp;&nbsp;=>&nbsp;&nbsp;<input class="form" style="width:300px;" 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>
  {* availability *}
  <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_availability}</td>
    <td class="tab">
      
      {* <img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /> *}
		
      {section name=availability_type loop=$availability_list}
		<INPUT TYPE="radio" NAME="availability" VALUE="{$availability_list[availability_type].id}" {$availability_list[availability_type].chk} id="avail_{$availability_list[availability_type].id}" ONFOCUS="update_telephone_field({$availability_list[availability_type].id})"> <label for="avail_{$availability_list[availability_type].id}"> {$availability_list[availability_type].text}</label>
	    {* telephone : *}
		{if $availability_list[availability_type].id == 1} &nbsp;&nbsp;=>&nbsp;&nbsp;{$gentemp_telephone}:&nbsp; <input class="form" style="width:120px;" type="text" value="{$telephone|escape:"html"}" name="telephone" maxlength="14" size="50">
		{/if}
		<BR>		
	  {/section}
	  
		<SCRIPT LANGUAGE="javascript">
			for(i=0;i<document.nd.availability.length;i++)
				if (document.nd.availability[i].checked) update_telephone_field(i);
		</SCRIPT>
		  
    </td>
  </tr>
  
  {* en-tête description *}
  <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_subject}</td>
    <td class="category">&nbsp;</td>
  </tr>
   
  {* résumé *}
  <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_summarized}</td>
    <td class="tab">
		<INPUT class="form" style="width:480px;" type="text" value="{$subject_summ|escape:"html"}" name="subject_summ" maxlength="100" size="50">
	</td>
  </tr>
  
  {* description détaillée *}
  <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_detailed}</td>
    <td class="tab"><textarea class="formtextarea" style="width:480px; height:150px;" name="thema" rows="4" cols="80">{$thema}</textarea></td>
  </tr>
  
  
  {* participants *}
  <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>
  <!-- 
  {if $newtype!="meeting"}
  <tr 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|smarty:nodefaults eq "true"} checked{/if}> {$temp_i_will}</td>
  </tr>
  {/if}
  -->
  <tr class="tab" align="left">
    <td class="tab" height="10" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="60" height="1" /></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>
	  {if $newtype!="meeting"}
	  <td class="formhead" valign="top" width="270">
	  	  {$imposable_people|smarty:nodefaults}<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>
	  {/if}
	  
	  {if $newtype=="meeting"}
		<td>
		<table border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td class="formhead" WIDTH="150">{$temp_selparticipants}</td>
			<td WIDTH="1" CLASS="lines2"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td class="formhead" WIDTH="40">&nbsp;{$to_impose}&nbsp;</td>
			<td WIDTH="1" CLASS="lines2"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td class="formhead" WIDTH="40">&nbsp;{$to_subject}&nbsp;</td>
		</tr>
		<tr height="2">
			<td WIDTH="150"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td WIDTH="1" CLASS="lines2"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td WIDTH="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td WIDTH="1" CLASS="lines2"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td WIDTH="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
		</tr>
		<tr><td COLSPAN="5" WIDTH="230" height="1" CLASS="lines2"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
		<tr height="10">
			<td WIDTH="150"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td WIDTH="1" CLASS="lines2"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td WIDTH="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td WIDTH="1" CLASS="lines2"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td WIDTH="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
		</tr>
		{section name=part_mode loop=$spartie}
		<tr>
		<td class="tab" WIDTH="150" height="18">{$spartie[part_mode].name}</td>
		<td WIDTH="1" CLASS="lines2"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
		{if $spartie[part_mode].userid!=$id_current_user}
			<td WIDTH="40" ALIGN="center">
				{if $spartie[part_mode].can_be_imposed=="1"}
				&nbsp;&nbsp;<INPUT TYPE="radio" NAME="part_{$spartie[part_mode].userid}" VALUE="I" {$spartie[part_mode].I_chk}>
				{else}
				<img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" />
				{/if}
			</td>
			<td WIDTH="1" CLASS="lines2"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td WIDTH="40" ALIGN="center">&nbsp;&nbsp;<INPUT TYPE="radio" NAME="part_{$spartie[part_mode].userid}" VALUE="S" {$spartie[part_mode].S_chk}></td>
		{else}
			<td WIDTH="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td WIDTH="1" CLASS="lines2"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
			<td WIDTH="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td>
		{/if}
		</tr>
	   {/section}
		</table>
		</td>	  
	  {/if}
	  <td class="formhead" valign="top" width="270">
	    {if $newtype!="meeting"}
			{$temp_selparticipants|smarty:nodefaults}
		    <br>
	    {/if}
		<select {if $newtype=="meeting"} style='display:none;' {/if} class="select" multiple  size="4" name="participants[]" {if $newtype=="meeting"} disabled{/if}>
	      {section name=spt loop=$spartie}
	      <option value="{$spartie[spt].userid}">{$spartie[spt].name}</option>
		{/section}	
	    </select>
	    {if $newtype!="meeting"}
			<br>
			<input class="submit" onclick="MoveOption('participants','tn');" type="button" value="{$removebutton}" name="Remove">
		{/if}
	  </td>
		<td class="formhead" align="left" width="200">&nbsp;</td>
	</tr>
	<tr>
	  <td class="formhead" colspan=3>&nbsp;</td>
	</tr>
	{if $newtype!="meeting"}
	<tr>
		<td class="formhead" align="left" colspan="3">
	    <I>{$how_to_subject_appt|smarty:nodefaults}</I><BR><BR>
	  	</td>
	  <!-- 
	  <td class="formhead" align="left">&nbsp;</td>
	  <td class="formhead" align="left" colspan="2">
	    {$how_to_subject_appt}
	    <input class="submit" onclick="testAvail('{$sname}');" type="button" value="{$temp_avail_text}" name="AvailTest"><br /><br />
	  </td>
	  -->
	</tr>
    {/if}
	  </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:350px; height:80px;">{$external}</textarea>
    </td>
  </tr>
  {if $appointment_attribute == 0 and $newtype!="meeting"}
  <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 class="tab"><input type="radio" name="appointment_attribute"{if $appointment_attribute==0} checked{/if} value="0">{$gentemp_repeater_0}</td>
	  <td class="tab"><input type="radio" name="appointment_attribute"{if $appointment_attribute==4} checked{/if} value="4">{$gentemp_repeater_4}</td>
	  <td class="tab"><input type="radio" name="appointment_attribute"{if $appointment_attribute==1} checked{/if} value="1">{$gentemp_repeater_1}</td>
	  <td class="tab"><input type="radio" name="appointment_attribute"{if $appointment_attribute==2} checked{/if} value="2">{$gentemp_repeater_2}</td>
	  <td class="tab"><input type="radio" name="appointment_attribute"{if $appointment_attribute==3} checked{/if} value="3">{$gentemp_repeater_3}</td>
	  <td class="tab"><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|smarty:nodefaults}&nbsp;&nbsp;{$gentemp_month}&nbsp;{$serial_end_month|smarty:nodefaults}&nbsp;&nbsp;{$gentemp_year}&nbsp;{$serial_end_year|smarty:nodefaults}</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}">

{if $newtype=="meeting"}
<input type="hidden" name="appointment_attribute" value="0"> 
{/if}

</form>
<SCRIPT langage="javascript">
keep_nbday_coherence('start');
{if $appointment_attribute == 0 and $newtype!="meeting" }
keep_nbday_coherence('serial_end');
{/if}
{if $newtype!="meeting"}
keep_appt_end_coherence();
{/if}
{if $sched_type != "" and $sched_type != "time" and $newtype!="meeting"}
	scheduling_{$sched_type}_click();
{/if}
</SCRIPT>


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