<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['koobiform'].submit();
	{rdelim}
});

$().ready(function() 
{ldelim}
	$("#koobiform").validate({ldelim}
	rules: {ldelim}
				Name: {ldelim}required: true{rdelim}
				{if $smarty.request.langcode==1},
				Url: {ldelim}required: true, url:true{rdelim}
				{/if}
			{rdelim}, 
	messages: 
			{ldelim}
				Url: {ldelim}url:'{#InserURL#}'{rdelim}
			{rdelim}
	{rdelim});
{rdelim});

$(function() {ldelim}
	 $('#container-options ul').tabs({ldelim} {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});

	$.ajaxFileUpload
	(
		{ldelim}
			url:'index.php?do=links&sub=iconupload' + updir + '&divid=' + divid + '&resize=' + resize,
			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">{#Links_edit#}</div>
<div class="subheaders">{#News_lang_inf#}</div>
<div class="header_inf">
<form onsubmit="" method="post" action="">
<select class="input" onchange="eval(this.options[this.selectedIndex].value)" name="langcode" id="langcode">
<option id="l_1" value="if(confirm('{#Global_changeLangDoc#}')){ldelim} location.href='index.php?do=links&sub=edit&id={$smarty.request.id}&noframes=1&pop=1&langcode=1';{rdelim}else{ldelim}document.getElementById('l_{$smarty.request.langcode}').selected=true;{rdelim}" {if $smarty.request.langcode=='1'}selected="selected"{/if}>{#Links_edit_in#}  - {$language_long_1|upper} - {#Shop_articles_editinb#}</option>
<option id="l_2" value="if(confirm('{#Global_changeLangDoc#}')){ldelim} location.href='index.php?do=links&sub=edit&id={$smarty.request.id}&noframes=1&pop=1&langcode=2';{rdelim}else{ldelim}document.getElementById('l_{$smarty.request.langcode}').selected=true;{rdelim}" {if $smarty.request.langcode=='2'}selected="selected"{/if}>{#Links_edit_in#}  - {$language_long_2|upper} - {#Shop_articles_editinb#}</option>
<option id="l_3" value="if(confirm('{#Global_changeLangDoc#}')){ldelim} location.href='index.php?do=links&sub=edit&id={$smarty.request.id}&noframes=1&pop=1&langcode=3';{rdelim}else{ldelim}document.getElementById('l_{$smarty.request.langcode}').selected=true;{rdelim}"  {if $smarty.request.langcode=='3'}selected="selected"{/if}>{#Links_edit_in#} - {$language_long_3|upper} - {#Shop_articles_editinb#}</option>
</select>
<img class="absmiddle" src="{$imgpath}/arrow_right.png" alt="" />
</form>
</div>

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

<div id="container-options">
<ul>
<li><a href="#opt-1"><span>{#News_tab_gen#}</span></a></li>
{if $smarty.request.langcode==1}
<li><a href="#opt-2"><span>{#News_tab_img#}</span></a></li>
{if $res->DefektGemeldet}<li><a href="#opt-3"><span>{#Links_broken#}</span></a></li>{/if}
{/if}
</ul>

</div>


<div id="opt-1">
<fieldset>
<legend><label for="t">{#Global_Name#}</label></legend>
<input name="Name" type="text" class="input" id="t" style="width:200px" value="{$res->Name}" /> 
</fieldset>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>

{if $smarty.request.langcode==1}
<td>
<fieldset>
<legend><label for="url">{#Links_Url#}</label></legend>
<input name="Url" type="text" class="input" id="url" style="width:200px" value="{$res->Url}" /> 
</fieldset>
</td>

<td>
<fieldset>
<legend><label for="c">{#Global_Categ#}</label></legend>
<select class="input" style="width:150px" name="Kategorie">
    {foreach from=$Categs item=c}{if $c->Parent_Id==0}<option style="font-weight:bold" value="{$c->Id}" {if $c->Id==$res->Kategorie}selected="selected"{/if}>{$c->Name}</option>{else}<option value="{$c->Id}" {if $c->Id==$res->Kategorie}selected="selected"{/if}>{$c->visible_title}</option>{/if}{/foreach}
    </select>
</fieldset>
</td>
<td>
<fieldset>
<legend>{#News_Status#}</legend>
<label><input type="radio" name="Aktiv" value="1" {if $res->Aktiv=='1'}checked="checked"{/if}/>{#Global_online#}</label>
<label><input type="radio" name="Aktiv" value="0" {if $res->Aktiv=='0'}checked="checked"{/if}/>{#Global_offline#}</label>
</fieldset>
</td>

<td>
<fieldset>
<legend><label for="spr">{#Links_ccode#}</label><span {popup sticky=$config_vars.POPSTICKY  width=400 text=$config_vars.Links_ccodeInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></legend>
<input name="Sprache" type="text" class="input" id="spr" style="width:50px" value="{$res->Sprache}" maxlength="2" /> 
</fieldset>
</td>

{/if}

</tr>
</table>

<fieldset>
<legend>{#Content_text#}</legend>
{$Beschreibung}
</fieldset>
</div>



{if $smarty.request.langcode==1}
<div id="opt-2">
<fieldset>
<legend>{#Global_imgCurrent#}</legend>
 <div id="Vorschau_1">{if $res->Bild!=''}<img src="../uploads/links/{$res->Bild}">{/if}</div>
 <label><input type="checkbox" name="NoImg" value="1" /> {#Global_ImgDel#}</label>
   </fieldset>

<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','200');" value="{#Global_Upload#}" />
       <input type="hidden" name="newImg_1" id="newFile_1" />
       <!-- Uploadform -->  
</fieldset>
</div>


{if $smarty.request.langcode==1}
{if $res->DefektGemeldet}
<div id="opt-3">

<div class="subheaders">{#Links_brokenInf#}</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="150">{#Links_Link#}</td>
    <td><a href="{$res->Url}" target="_blank">{$res->Url}</a></td>
  </tr>
  <tr>
    <td>{#Links_broken_Reason#}</td>
    <td>{$res->DefektGemeldet}</td>
  </tr>
  <tr>
    <td>{#Links_broken_fromuser#}</td>
    <td>{$res->DName|koobispecialchars} ({$res->DEmail})</td>
  </tr>
  <tr>
    <td>{#Links_broken_date#}</td>
    <td>{$res->DDatum|date_format:$config_vars.DateFomat}</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>{#Links_broken_delm#}</td>
    <td>
    <label><input type="checkbox" name="DelDM" value="1" />{#Yes#}</label>
      </td>
  </tr>
</table>

</div>
{/if}
{/if}
{/if}


{if $smarty.request.langcode==1}
<label><input type="checkbox" name="saveAllLang" value="1" /> {#SavDataAllLangs#}</label><br />
{/if}




<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>