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


$.validator.setDefaults({ldelim}
	submitHandler: function() 
	{ldelim}
		document.forms['newsForm'].submit();
	{rdelim}
});

$().ready(function() 
{ldelim}
	$("#newsForm").validate({ldelim}
	rules: {ldelim}
				Titel: {ldelim}required: true{rdelim}
			{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});


function ajaxFileUpload(updir,divid,resize)
{ldelim}
	$("#loading_" + divid)
	.ajaxStart(function(){ldelim}
		$(this).show();
		document.getElementById('buttonUpload_' + divid).value = '{#Global_Wait#}';
		document.getElementById('buttonUpload_' + divid).disabled = true;
		
	{rdelim})
	.ajaxComplete(function(){ldelim}
		$(this).hide();
		document.getElementById('buttonUpload_' + divid).value = '{#Global_Upload#}';
		document.getElementById('buttonUpload_' + divid).disabled = false;
	{rdelim});

	var up = 'index.php?do=content&sub=iconupload' + updir + '&divid=' + divid + '&resize=' + resize;
			
	
	$.ajaxFileUpload
	(
		{ldelim}
			url: up,
			secureuri:false,
			fileElementId:'fileToUpload_' + divid,
			dataType: 'json',
			success: function (data, status)
			{ldelim}
				if(typeof(data.error) != 'undefined')
				{ldelim}
					if(data.error != '')
					{ldelim}
						document.getElementById('UpInf_' + divid).innerHTML  = data.error;
					}else
					{ldelim}
						document.getElementById('UpInf_' + divid).innerHTML = data.msg;
						document.getElementById('newFile_' + divid).value =  data.html;
						
					{rdelim}
				{rdelim}
			{rdelim},
			error: function (data, status, e)
			{ldelim}
				document.getElementById('UpInf_' + divid).innerHTML = e;
			{rdelim}
		{rdelim})
	return false;
{rdelim}
// -->
</script>


<div class="popbox">
<div class="header">{#Content_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>{#Content_Topcontent#}</span></a></li>
<li><a href="#opt-4a"><span>{#Docs_AllowedGroups#}</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="{$content->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 $content->Kategorie==$dd->Id}selected="selected"{/if}>{$dd->Name|koobispecialchars} </option>
{/foreach}
</select>     
</fieldset>
</td>

<td>
<fieldset>
<legend><label for="k">{#User_Pass#}</label> <span {popup sticky=$config_vars.POPSTICKY  width=400 text=$config_vars.Global_DocPass}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></legend>
<input name="Kennwort" type="text" class="input" id="k" style="width:200px" value="{$content->Kennwort}" /> 
</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_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" />{#Yes#}</label>
<label><input type="radio" name="Bewertung" value="0" checked="checked"/>{#No#}</label>
</fieldset>
</td>

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





<fieldset>
<legend>{#Content_text#}</legend>
{$Content}
 <div style="padding:4px">
      <span {popup sticky=$config_vars.POPSTICKY  width=400 text=$config_vars.Global_newInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span>
      <a href="javascript:;" onclick="setEditorValue('Content','[--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('Content','[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('Content',' &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_imgNew#}</legend>
<div id="UpInf_1"></div><div id="loading_1" align="center"  style="display:none;"><img style="margin-bottom:15px" src="{$imgpath}/loading.gif" alt="" /></div>
<input id="fileToUpload_1" type="file" size="30" name="fileToUpload_1" class="input" />
<input type="button" class="button" id="buttonUpload_1" onclick="return ajaxFileUpload('','1','{#Content_maxwidth_img#}');" value="{#Global_Upload#}" />
<input type="hidden" name="Bild_1" id="newFile_1" />
 
</fieldset>

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

</fieldset>
</div>

<div id="opt-4">

<fieldset>
<legend>{#Content_isTop#}</legend>
<label><input type="radio" name="Topcontent" value="1" />{#Yes#}</label>
<label><input type="radio" name="Topcontent" value="0" checked="checked"/>{#No#}</label>
<br />
<br />
{#Content_TopcontentInf#}
</fieldset>
   
<fieldset>
<legend>{#Content_newTopImg#}</legend>
<div id="UpInf_2"></div><div id="loading_2" align="center"  style="display:none;"><img style="margin-bottom:15px" src="{$imgpath}/loading.gif" alt="" /></div>
<input id="fileToUpload_2" type="file" size="30" name="fileToUpload_2" class="input" />
<input type="button" class="button" id="buttonUpload_2" onclick="return ajaxFileUpload('','2','0');" value="{#Global_Upload#}" />
<input type="hidden" name="Bild_2" id="newFile_2" />
</fieldset>
</div>

<div id="opt-4a">
<fieldset>
<legend>{#Docs_AllowedGroups#}</legend>
<em>
{#Docs_AllowedGroupsInf#}
</em><br />
<br />
<select name="Gruppen[]" size="10" multiple="multiple" class="input" style="width:250px">
{foreach from=$UserGroups item=group}
<option value="{$group->Id}" {if $group->Id==1}disabled="disabled" {/if}>{$group->Name_Intern}</option>
{/foreach}
</select>
</fieldset>
</div>

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


<div id="opt-6">

<fieldset>
<legend>{#Content_toN#} <span {popup sticky=$config_vars.POPSTICKY  width=400 text=$config_vars.Content_toNinf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></legend>
<label><input type="checkbox" name="ToNavi" value="1" {if $content->inNavi}checked="checked" disabled="disabled"{/if}/>{#Yes#}</label> 
{if !$content->inNavi} / {#Global_Position#} <input class="input" style="width:20px" type="text" name="PosN" value="1" />
<select style="display:none" name="Groups[]" size="1" multiple="multiple" class="input">
{foreach from=$UserGroups item=group}
<option value="{$group->Id}" selected="selected">{$group->Name_Intern}</option>
{/foreach}
</select>   
 / {#Content_toNNav#}
 
<select name="NaviCat2" class="input" style="width:155px" >
{foreach from=$Navis item=n}
<option style="font-weight:bold" value="{$n->Id}|0">{$n->Name_1}</option>
{foreach from=$n->Items item=i}
<option value="{$n->Id}|{$i->Id}">- {$i->Titel_1}</option>
{/foreach}
{/foreach}
</select> 

{else}
<em>{#Content_isInQN#}</em>
{/if}
 
</fieldset>

<fieldset>
<legend>{#Content_toQN#} <span {popup sticky=$config_vars.POPSTICKY  width=400 text=$config_vars.Content_toQNinf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></legend>
<label><input type="checkbox" name="ToQuickNavi" value="1" {if $content->inQuicknavi}checked="checked"  disabled="disabled"{/if} />{#Yes#}</label>
{if !$content->inQuicknavi} / {#Global_Position#} <input class="input" style="width:20px" type="text" name="PosQN" value="1" />{/if}
{if $content->inQuicknavi}
<em>{#Content_isInQN#}</em>
{/if}
</fieldset>

<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="{$content->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>