<script language="javascript" type="text/javascript">
<!--
{include file="$incpath/other/validate_js.tpl"}

$.validator.setDefaults({ldelim}
	submitHandler: function() 
	{ldelim}
		document.forms['newsForm'].submit();
		var message = '<h2>{#Global_Wait#}</h2>';
		jQuery.blockUI({ldelim} message: message{rdelim}); 
		setTimeout(jQuery.unblockUI, 2000); 
	{rdelim}
});

$().ready(function() 
{ldelim}
	$("#newsForm").validate({ldelim}
	rules: {ldelim}
				Titel: {ldelim}required: true{rdelim}
				{if $smarty.request.langcode==1}
				,ZeitStart: {ldelim}required: true{rdelim}
				{/if}
			{rdelim}, 
	messages: 
			{ldelim}
			{rdelim}
	{rdelim});
{rdelim});

$(function() {ldelim}
	 $('#container-options ul').tabs({ldelim} {rdelim});
	 $('div.teaser').toggleElements( {ldelim} fxAnimation:'false', fxSpeed:'normal', className:'toggler'{rdelim} );
	  $('div.inline').toggleElements( {ldelim} fxAnimation:'true', fxSpeed:'normal', className:'toggler'{rdelim} );
{rdelim});


// -->
</script>


<div class="popbox">
<div class="header">{#News_new#}</div>
<div class="subheaders">{#News_multiInf#}</div>


<form method="post" action="" enctype="multipart/form-data"  name="newsForm" id="newsForm">

<div id="container-options">
<ul>
<li><a href="#opt-1"><span>{#News_tab_gen#}</span></a></li>
<li><a href="#opt-3"><span>{#News_tab_img#}</span></a></li>
<li><a href="#opt-4"><span>{#News_tab_topnews#}</span></a></li>
<li><a href="#opt-5"><span>{#Global_Inline#}</span></a></li>
<li><a href="#opt-6"><span>{#News_tab_other#}</span></a></li>
</ul>

</div>


<div id="opt-1">
<table width="100%">
<tr>
<td><fieldset>
<legend><label for="t">{#Global_Title#}</label></legend>
<input name="Titel" type="text" class="input" id="t" style="width:200px" value="{$news->Titel}" /> 
</fieldset></td>
<td>


<fieldset>
<legend><label for="c">{#Global_Categ#}</label></legend>
<select  style="width:160px"  class="input" id="c" name="categ">
{foreach from=$newscategs item=dd}
<option value="{$dd->Id}" {if $news->Kategorie==$dd->Id}selected="selected"{/if}>{$dd->visible_title} </option>
{/foreach}
</select>     
</fieldset></td>
<td>
<fieldset>
<legend><label for="ZeitStart">{#Global_PublicDate#}</label></legend>
<input name="ZeitStart" type="text" class="input" id="ZeitStart" style="width:100px" value="{$smarty.now|date_format:'%d.%m.%Y'}" readonly="readonly" />
</fieldset>
</td>
<td>
<fieldset>
<legend><label for="ZeitEnde">{#Global_PublicEndDate#}</label></legend>
<input name="ZeitEnde" type="text" class="input" id="ZeitEnde" style="width:100px" value="{if $news->ZeitEnde!='0'}{$news->ZeitEnde|date_format:'%d.%m.%Y'}{/if}" readonly="readonly" />
</fieldset>
</td>

</tr>
</table>


<table width="100%">
<tr>
<td valign="top">
<fieldset>
<legend>{#News_Status#}</legend>
<label><input type="radio" name="Aktiv" value="1" checked="checked"/>{#Global_online#}</label>
<label><input type="radio" name="Aktiv" value="0" />{#Global_offline#}</label>
</fieldset>
</td>

<td valign="top">
<fieldset>
<legend>{#News_show_allsections#}</legend>
<label><input type="radio" name="AlleSektionen" value="1" />{#Yes#}</label>
<label><input type="radio" name="AlleSektionen" value="0" checked="checked"/>{#No#}</label>
</fieldset>
</td>

<td valign="top">
<fieldset>
<legend>{#News_searchable#}</legend>
<label><input type="radio" name="Suche" value="1" checked="checked"/>{#Yes#}</label>
<label><input type="radio" name="Suche" value="0" />{#No#}</label>
</fieldset>
</td>

<td valign="top">
<fieldset>
<legend>{#News_voteable#}</legend>
<label><input type="radio" name="Bewertung" value="1" checked="checked"/>{#Yes#}</label>
<label><input type="radio" name="Bewertung" value="0" />{#No#}</label>
</fieldset>
</td>

<td valign="top">
<fieldset>
<legend>{#News_commentable#}</legend>
<label><input type="radio" name="Kommentare" value="1" checked="checked"/>{#Yes#}</label>
<label>
<input type="radio" name="Kommentare" value="0" />{#No#}</label>
</fieldset>
</td>
</tr>
</table>


<fieldset>
<legend><span {popup sticky=$config_vars.POPSTICKY  width=450 text=$config_vars.News_tab_teaserInf}> <img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span>&nbsp;{#News_tab_teaser#}</legend>
{$Intro}
</fieldset>


<fieldset>
<legend>{#News_text#}</legend>
{$News}
 <div style="padding:4px">
      <img {popup sticky=$config_vars.POPSTICKY  width=400 text=$config_vars.Global_newInf} class="absmiddle" src="{$imgpath}/help.png" alt="" />
      <a href="javascript:;" onclick="setEditorValue('News','[--NEU--]')">{#Global_newPage#}</a>      
      
   {if $cforms}
 	<select {popup sticky=$config_vars.POPSTICKY  delay=300 text=$config_vars.Contactform_inf} class="input" onchange="eval(this.options[this.selectedIndex].value);selectedIndex=0;">
    <option value="">{#Content_insertContactForms#}</option>
    {foreach from=$cforms item=cf}
    <option value="setEditorValue('News','[CONTACT:{$cf->Id}]')">{$cf->Titel1}</option>
    {/foreach}
    </select>
    {/if}

	{if $ContentLinks}
    <select {popup sticky=$config_vars.POPSTICKY  delay=300 text=$config_vars.Content_insertContentLinksInf}  class="input" onchange="eval(this.options[this.selectedIndex].value);selectedIndex=0;">
    <option value="">{#Content_insertContentLinks#}</option>
    {foreach from=$ContentLinks item=cn}
    <option value="setEditorValue('News',' &lt;a href=&quot;index.php?p=content&amp;id={$cn->Id}&amp;name={$cn->Titel1|seotitle}&amp;area={$cn->Sektion}&quot;&gt;{$cn->Titel1|koobispecialchars}&lt;/a&gt; ')">{$cn->Titel1|koobispecialchars}</option>
    {/foreach}
    </select>
    {/if}
   
   </div>
</fieldset>
</div>



<div id="opt-3">
<fieldset>
<legend>{#Global_imgCurrent#}</legend>
 <div id="Vorschau_1">{if $news->Bild!=''}<img src="{$news->Bild}">{/if}</div>
 <label><input type="checkbox" name="NoImg" value="1" /> {#Global_ImgDel#}</label>
   </fieldset>

<fieldset>
<legend>{#Global_imgNew#}</legend>
<input name="Datei_1" type="hidden" id="Datei_1">
<input name="Bild_1" type="hidden" id="Icon_1" value="{if $news->Bild!=''}{$news->Bild}{/if}">
<input type="button" class="button" style="margin-top:2px" onclick="MediaPool('bild','txtUrl', 1);" value="{#Global_ImgSel#}">
</fieldset>

<fieldset>
<legend>{#Global_imgAlign#}</legend>
<label><input type="radio" name="BildAusrichtung" value="right" {if $news->BildAusrichtung=='right' || $smarty.request.BildAusrichtung=='right' || $news->BildAusrichtung==''}checked="checked"{/if} /> {#Global_ImgRight#}</label>
<label><input type="radio" name="BildAusrichtung" value="left" {if $news->BildAusrichtung=='left'  || $smarty.request.BildAusrichtung=='left'}checked="checked"{/if} /> {#Global_ImgLeft#}</label> 
</fieldset>
</div>

<div id="opt-4">
<fieldset>
<legend>{#News_isTopnews#}</legend>
<label><input type="radio" name="Topnews" value="1" />{#Yes#}</label>
<label><input type="radio" name="Topnews" value="0" checked="checked" />{#No#}</label>
<br />
<br />
{#News_TopnewsInf#}
</fieldset>

<fieldset>
<legend>{#Global_TopnewsimgCurrent#}</legend>
 <div id="Vorschau_2">{if $news->Topnews_Bild!=''}<img src="{$news->Topnews_Bild}">{/if}</div>
 <label><input type="checkbox" name="NoTopnewsImg" value="1" /> {#Global_ImgDel#}</label>
</fieldset>
   
<fieldset>
<legend>{#Global_TopnewsimgNew#}</legend>
<input name="Datei_2" type="hidden" id="Datei_2">
<input name="Bild_2" type="hidden" id="Icon_2" value="{if $news->Topnews_Bild!=''}{$news->Topnews_Bild}{/if}">
<input type="button" class="button" style="margin-top:2px" onclick="MediaPool('bild','txtUrl', 2);" value="{#Global_ImgSel#}">
</fieldset>
</div>

<div id="opt-5">
{assign var='inline_table' value='news'}
{assign var='fieldname' value=$field_inline}
{include file="$incpath/inline/inline_div.tpl"}
</div>


<div id="opt-6">
<fieldset>
<legend>
<span {popup sticky=$config_vars.POPSTICKY  width=450 text=$config_vars.Tag_info}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span>
{#Tags#}
</legend>
<input type="text" class="input" style="width:99%" name="Tags" value="{$news->Tags}" />
</fieldset>


<fieldset>
<legend>
<span {popup sticky=$config_vars.POPSTICKY  width=450 text=$config_vars.Gal_incl_info}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span>
{#Global_mergeGalleries#}</legend>
      <select name="Gallery[]" size="15" multiple  class="input" id="select" style="width:250px">
     {foreach from=$Gallery item=ng}
       <optgroup label="{$ng->CategName}"></optgroup>
       {foreach from=$ng->Gals item=g}
       <option value="{$g->GalId}">{$g->GalName}</option>
        {/foreach}
       {/foreach}
      </select>
</fieldset>
</div>







<input onclick="$('#container-options > ul').tabs('select', 0);" type="submit" class="button big" value="{#Save#}" />
<input type="button" onclick="window.close();" class="button big" value="{#Close#}" />
<input type="hidden" name="save" value="1" />
<input type="hidden" name="langcode" value="{$smarty.request.langcode|default:1}" />
</form>


{literal}
<script>
function getEditorValue( instanceName )
{
	var oEditor = FCKeditorAPI.GetInstance( instanceName ) ;
	return oEditor.GetXHTML( true ) ; // "true" means you want it formatted.
}

function setEditorValue( instanceName, text )
{
	var oEditor = FCKeditorAPI.GetInstance( instanceName ) ;
	oEditor.InsertHtml( text ) ;
}
</script>
{/literal}
</div>





<script language="javascript" src="{$jspath}/calendar.js" type="text/javascript"></script>
<style type="text/css" media="screen,projection">
@import url({$csspath}/calendar.css);
</style>
<script type="text/javascript">
	jQuery(function($){ldelim}
	$.datepicker.setDefaults({ldelim}
	{include file="$incpath/other/calendar.conf.tpl"}

	{rdelim}); 
	$("#ZeitStart").attachDatepicker();
	$("#ZeitEnde").attachDatepicker();
	{rdelim});
</script>