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

<script type="text/javascript">
var err_expire_day = "{$err_expire_day}";
var err_expire_month = "{$err_expire_month}";
var err_expire_year = "{$err_expire_year}";

{literal}

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 checkdate(){
var y=document.f1.expire_year.value;
if (y.length == 1) y='0'+y;
var m=document.f1.expire_month.value;
if (m.length == 1) m='0'+m;
var d=document.f1.expire_day.value;
if (d.length == 1) d='0'+d;
var msg='';
if (y/1000 > 10 || y/1000 < 2) msg+='\n'+err_expire_year;
if (m > 12 || m < 1) msg+='\n'+err_expire_month;
else if (d<=31 && d > nb_day(m,y)) msg+='\n'+err_expire_day;
if (d < 1 || d > 31) msg+='\n'+err_expire_day;
if (msg!='') {
	if (document.f1.archive_mode[0].checked==false) {
		document.f1.expire_year.value='';
		document.f1.expire_month.value='';
		document.f1.expire_day.value='';
		return true;
		}
	else {
		alert(d+'/'+m+'/'+y+' :\n'+msg);
		return false;
		}
	}
else return true;
}

function toggle_date(t){
if(t==false) {
	document.f1.expire_day.onfocus = new Function('this.blur();');
	document.f1.expire_day.style.backgroundColor='#E0E0E0';
	
	document.f1.expire_month.onfocus = new Function('this.blur();');
	document.f1.expire_month.style.backgroundColor='#E0E0E0';
	
	document.f1.expire_year.onfocus = new Function('this.blur();');
	document.f1.expire_year.style.backgroundColor='#E0E0E0';
	}
else {
	document.f1.expire_day.onfocus=null;
	document.f1.expire_day.style.backgroundColor='#FFFFFF';
	
	document.f1.expire_month.onfocus=null;
	document.f1.expire_month.style.backgroundColor='#FFFFFF';
	
	document.f1.expire_year.onfocus=null;
	document.f1.expire_year.style.backgroundColor='#FFFFFF';
	}
}
{/literal}
</script>

<form name="f1" action="index.php" method="post">
<input type="hidden" name="{$SESSIONNAME}" value="{$SESSIONID}">			
<input type="hidden" name="id" value="{$td.id}">			

{if $mode eq "edit"}
{include file="$gentemplates/_navi.tpl"}
{include file="$gentemplates/_contentheader.tpl" title="$editnews"}
{else}
{include file="$gentemplates/_navi.tpl"}
{include file="$gentemplates/_contentheader.tpl" title="$createnews"}
{/if}

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr><td class="lines2" height="2" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="2"></td></tr>						
  <tr align="left">
    <td class="tab" height="20"><img src="{$imgpathmaster}/space.gif" alt="" width="60" height="1"></td>
    <td class="tab">&nbsp;</td>
    <td class="tab">&nbsp;</td>
  </tr>
  
  <tr><td class="lines2" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="60" height="1"></td>
    <td class="formhead">{$channeltext}:</td>
    <td class="formhead">{$channels|smarty:nodefaults}</td>
  </tr>

  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="60" height="1"></td>
    <td class="formhead">{$title}:</td>
    <td class="formhead"><input type="text" name="headline" size="20" maxlength="100" value="{$td.headline|escape:"html"}"></td>
  </tr>
  
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="60" height="1"></td>
    <td class="formhead">{$teaser}:</td>
    <td class="formhead">&nbsp;<br><textarea name="teaser" cols="60" rows="2">{$td.teaser}</textarea><br>&nbsp;</td>
  </tr>
  
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="60" height="1"></td>
    <td class="formhead">{$text}:</td>
    <td class="formhead">&nbsp;<br><textarea name="content" cols="60" rows="5">{$td.content}</textarea><br>&nbsp;</td>
  </tr>
  
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="60" height="1"></td>
    <td class="formhead">{$projecttext}:</td>
    <td class="formhead">{$projects|smarty:nodefaults}</td>
  </tr>
  
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="60" height="1"></td>
    <td class="formhead">{$filing}:</td>
    <td class="formhead">
		<INPUT TYPE="radio" NAME="archive_mode" VALUE="0" {if $archive_mod_0 neq "" or ($archive_mod_1 eq "" and $archive_mod_2 eq "")}CHECKED{/if} ID="arch_0"  ONCLICK="javascript:toggle_date(true);" /><LABEL FOR="arch_0">{$archive_from}&nbsp;:&nbsp;</LABEL><INPUT TYPE="text" NAME="expire_day" SIZE="2" VALUE="{$expire_day}"  />&nbsp;/&nbsp;<INPUT TYPE="text" NAME="expire_month" SIZE="2" VALUE="{$expire_month}" />&nbsp;/&nbsp;<INPUT TYPE="text" NAME="expire_year" SIZE="4" VALUE="{$expire_year}" /><br />
		<INPUT TYPE="radio" NAME="archive_mode" VALUE="1" {if $archive_mod_1 neq ""}CHECKED{/if} ID="arch_1" ONCLICK="javascript:toggle_date(false);" /><LABEL FOR="arch_1">{$keep_active}</LABEL><br />
		<INPUT TYPE="radio" NAME="archive_mode" VALUE="2" {if $archive_mod_2 neq ""}CHECKED{/if} ID="arch_2" ONCLICK="javascript:toggle_date(false);" /><LABEL FOR="arch_2">{$archive}</LABEL><br />
	</td>
  </tr>
  
  
  <INPUT TYPE="hidden" name="old_headline" value="{$td.headline|escape:"html"}" />
  <INPUT TYPE="hidden" name="old_teaser" value="{$td.teaser|escape:"html"}" />
  <INPUT TYPE="hidden" name="old_content" value="{$td.content|escape:"html"}" />
  
  

  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="60" height="1"></td>
    <td class="formhead">{$public}</td>
    <td class="formhead"><input type="radio" name="ispublic" value="1"{$pubcheckedyes}>{$yes}<br><input type="radio" name="ispublic" value="0"{$pubcheckedno}>{$no}</td>
  </tr>
  
  <tr><td class="lines2" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="60" height="1"></td>
    <td class="formhead">&nbsp;</td>
    <td class="formhead"><input type="submit" name="{$suname}" value="{$suvalue}" class="{$suclass}" ONCLICK="javascript:return checkdate();" ></td>
  </tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1"></td></tr>
</table>

</form>

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