<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},
				Url: {ldelim}required: true, url:true{rdelim}
			{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_add#}</div>
<form method="post" action="" enctype="multipart/form-data"  name="koobiform" id="koobiform">

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

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

<td>
<fieldset>
<legend><label for="url">{#Links_Url#}</label></legend>
<input name="Url" type="text" class="input" id="url" style="width:180px" value="{$res->Url}" /> 
</fieldset>
</td>

<td>
<fieldset>
<legend><label for="c">{#Global_Categ#}</label></legend>
<select class="input" style="width:200px" 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" checked="checked" />{#Global_online#}</label>
<label><input type="radio" name="Aktiv" value="0" />{#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|default:'de'}" maxlength="2" /> 
</fieldset>
</td>
</tr>
</table>


<fieldset>
<legend>{#News_tab_img#}</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>


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


<input 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>
</div>

