<script language="javascript">
function check_eventform(){ldelim}
	if(document.newevent.name.value == ''){ldelim}
		alert('{$lang.calendar_notitle}');
		document.newevent.name.focus();
		return false;
		{rdelim}
		
		if(document.newevent.descr.value == ''){ldelim}
		alert('{$lang.calendar_nodescr}');
		document.newevent.descr.focus();
		return false;
		{rdelim}
	{rdelim}

function check_searchform(){ldelim}
	if(document.sf.qc.value == ''){ldelim}
	alert('{$lang.calendar_search_noinsert}');
	document.sf.qc.focus();
	return false;
	{rdelim}
{rdelim}
</script>
{strip}
<table width="100%"  border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td>
{if ($smarty.request.show=='private' && $ugroup!='2') OR ($ugroup=='1')}
<div class="box_inner" style="padding:2px;width:250px">
<table width="100%"  border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td><img class="absmiddless" src="templates/{$theme}/img/calendar/newevent.gif" alt="" border="0" /></td>
    <td><a onclick="javascript:getElementById('eventform').style.display='';" href="#new">{$lang.calendar_eventnew}</a> </td>
  </tr>
  <tr>
    <td><img class="absmiddless" src="templates/{$theme}/img/calendar/find.gif" alt="" border="0" /></td>
    <td>

<!-- Suche -->

<form name="sf" action="index.php" method="get" onsubmit="return check_searchform();">
   <input type="text" name="qc" />
  <input class="button" type="submit" value="{$lang.search}" />
  <input name="area" type="hidden" value="{$area}" />
  <input name="p" type="hidden" value="calendar" />
  <input name="display" type="hidden" value="search" />
  </form>
<!-- Suche -->
	</td>
  </tr>
</table>
</div>
{/if}
<br />
<img src="templates/{$theme}/img/calendar/importantly.gif" alt="" />&nbsp;{$lang.calendar_important_event}&nbsp;|&nbsp;
<img src="templates/{$theme}/img/calendar/done.gif" alt="" />&nbsp;{$lang.calendar_done_short}&nbsp;|&nbsp;
<img src="templates/{$theme}/img/calendar/period.gif" alt="" />&nbsp;{$lang.calendar_period}
</td>
    <td align="right"><div style="padding:5px">

<form action="index.php" method="get">
  <input type="hidden" name="p" value="calendar" />
  <input type="hidden" name="area" value="{$area}" />
  <strong>{$lang.calendar_jumpmonth}</strong>&nbsp;&nbsp;
  <select name="month">
{foreach from=$months item=month_name}
{assign var=md value=$md+1}
<option value="{$md}" {if $smarty.get.month==$md}selected="selected"{/if}>{$month_name}</option>
{/foreach}
</select>

<select name="year">
{section name=year loop=$end_cal start=$start_cal}
<option value="{$smarty.section.year.index+1}" {if $smarty.section.year.index+1==$ya}selected="selected"{/if}>{$smarty.section.year.index+1}</option>
{/section}
</select>

  <strong><br />
  {$lang.calendar_selectcalendar}</strong> 
  <select name="show">
    <option value="public" {if $smarty.get.show=='public'}selected="selected"{/if}>{$lang.calendar_public}</option>
	{if $ugroup!='2'}
    <option value="private" {if $smarty.get.show=='private'}selected="selected"{/if}>{$lang.calendar_private}</option>
	{/if}
  </select>
  <input class="button" type="submit" value="{$lang.go}" />
</form>

</div></td>
  </tr>
</table>
{assign var=displ value='none'}
<div id="eventform" style="display:{$displ}">
{if $userid < 1 && $ugroup != 1}
<h3>{$lang.calendar_neweventnopermission}</h3>
{else}



<form action="index.php?p=calendar" method="post" name="newevent" id="newevent" onsubmit="return check_eventform();">

<br />
<a name="new" id="new"></a>
<table width="100%"  border="0" cellpadding="4" cellspacing="0">
  <tr>
    <td class="box_innerhead">{$lang.calendar_eventnew}</td>
  </tr>
  <tr>
    <td><table  border="0" cellspacing="2" cellpadding="2">
  <tr>
    <td>{$lang.date}:</td>
    <td nowrap="nowrap"><select name="day">
      
      
    
{section name=day loop=31 start=0}

    
      
      <option value="{$smarty.section.day.index+1}">{if $smarty.section.day.index+1 < 10}0{/if}{$smarty.section.day.index+1}</option>
      
      
    
{/section}

  
    
    </select>
      <select name="month">
        
        
{foreach from=$months item=month_name}
{assign var=md2 value=$md2+1}

        <option value="{$md2}" {if $smarty.get.month==$md}selected="selected"{/if}>{$month_name}</option>
        
{/foreach}

      
      </select>
      <select name="year">
        
        
{section name=year loop=$end_cal start=$start_cal}

        <option value="{$smarty.section.year.index+1}" {if $smarty.section.year.index+1==$ya}selected="selected"{/if}>{$smarty.section.year.index+1}</option>
        
{/section}

      
      </select></td>
  </tr>
  <tr>
    <td>{$lang.calendar_eventstart}</td>
    <td nowrap="nowrap">

<select name="s_std">
<option value="0">00</option>
{section name=std loop=23 start=0 step=1}
<option value="{$smarty.section.std.index+1}" {if $smarty.section.std.index+1=='8'}selected="selected"{/if}>{if $smarty.section.std.index+1 < 10}0{/if}{$smarty.section.std.index+1}</option>
{/section}
</select>
:

<select name="s_min">
<option value="0">00</option>
{section name=min loop=59 start=0 step=1}
<option value="{$smarty.section.min.index+1}">{if $smarty.section.min.index+1 < 10}0{/if}{$smarty.section.min.index+1}</option>
{/section}
</select>

</td>
    </tr>
  <tr>
    <td>{$lang.calendar_eventend}</td>
    <td nowrap="nowrap">

<select name="e_std">
<option value="0">00</option>
{section name=estd loop=23 start=0 step=1}
<option value="{$smarty.section.estd.index+1}" {if $smarty.section.estd.index+1=='15'}selected="selected"{/if}>{if $smarty.section.estd.index+1 < 10}0{/if}{$smarty.section.estd.index+1}</option>
{/section}
</select>
:

<select name="e_min">
<option value="0">00</option>
{section name=emin loop=59 start=0 step=1}
<option value="{$smarty.section.emin.index+1}">{if $smarty.section.emin.index+1 < 10}0{/if}{$smarty.section.emin.index+1}</option>
{/section}
</select>

</td>
    </tr>
  <tr>
    <td>{$lang.calendar_eventor}</td>
    <td nowrap="nowrap"><input name="s_wday" type="checkbox" id="s_wday" value="1" />
      {$lang.calendar_eventwholeday}</td>
    </tr>
  <tr>
    <td>{$lang.calendar_eventmdays}</td>
    <td nowrap="nowrap"><select name="days" id="days">
      <option value="0" selected="selected">{$lang.no}</option>
	  {section name=days loop=21 start=1}
	  <option value="{$smarty.section.days.index+1}">{$smarty.section.days.index+1} {$lang.calendar_eventdays}</option>
	  {/section}
      
    </select></td>
  </tr>
</table>
      <br />
      <table  border="0" cellspacing="1" cellpadding="3">
        <tr>
          <td><strong>{$lang.title}</strong></td>
          </tr>
        <tr>
          <td><input name="name" type="text" id="name" size="40" /></td>
          </tr>
        <tr>
          <td><strong>{$lang.description}</strong></td>
          </tr>
        <tr>
          <td><textarea name="descr" cols="80" rows="5" id="descr"></textarea></td>
          </tr>
        <tr>
          <td><small>{$lang.calendar_allowedhtml}&lt;br&gt;, &lt;small&gt;, &lt;pre&gt;, &lt;b&gt;, &lt;strong&gt;, &lt;em&gt;, &lt;i&gt;, &lt;span&gt;, &lt;div&gt;</small></td>
          </tr>
        <tr>
          <td><strong>{$lang.calendar_eventweight}</strong></td>
        </tr>
        <tr>
          <td><select name="weight" id="weight">
            
			  {foreach from=$weight item=we}
			  {assign var=plus value=$plus+1}
                
            <option value="{$plus}" {if $plus==3}selected="selected"{/if}>{$we} </option>
            
				{/foreach}
              
          </select></td>
        </tr>
        <tr>
          <td><input name="autobr" type="checkbox" id="autobr" value="1" />
            {$lang.calendar_autobr} </td>
          </tr>
        <tr>
          <td><input name="Submit" type="submit" class="button" value="{$lang.f_btn_save}" />
            <input name="newevent" type="hidden" id="newevent" value="1" />
            <input name="area" type="hidden" id="area" value="{$area}" />
			
			{if ($smarty.request.show=='public' or $smarty.request.show=='') && ($ugroup=='1')}
			<input name="show" type="hidden" id="show" value="public" />
			{else}
            <input name="show" type="hidden" id="show" value="private" />
			{/if}
			</td>
          </tr>
        <tr>
          <td>&nbsp;</td>
          </tr>
        <tr>
          <td>&nbsp;</td>
          </tr>
      </table></td>
  </tr>
</table>

</form>
{/if}
</div>
{/strip}