<script language="javascript" src="js/jupload.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
<!--
{include file="$incpath/other/validate_js.tpl"}
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=products&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}

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

$().ready(function() 
{ldelim}
	$("#Form").validate({ldelim}
	rules: {ldelim}
				Titel: {ldelim}required: true{rdelim}
				{if $smarty.request.langcode==1},Shopurl: {ldelim}url: 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">{#Products_new#}</div>
<br />

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

<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-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%" border="0" cellpadding="1" cellspacing="1">
<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="lgenre">{#Products_genre#}</label></legend>
<select  style="width:150px"  class="input" id="lgenre" name="Genre">
<option value="">-</option>
 {foreach from=$genres item=g}
 <option value="{$g->Id}" {if $content->Genre==$g->Id}selected="selected"{/if}>{$g->Name|koobispecialchars}</option>
 {/foreach}
 </select>
</fieldset>
</td>
<td>
<fieldset>
<legend>{#Products_tops#}</legend>
<label><input type="radio" name="TopProduct" value="1" />{#Yes#}</label>
<label><input type="radio" name="TopProduct" value="0" checked="checked" />{#No#}</label>
</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="lDatum_Veroffentlichung">{#Products_pubdate#}</label></legend>
<input name="Datum_Veroffentlichung" type="text" class="input" id="lDatum_Veroffentlichung" style="width:100px" value="{$content->Datum_Veroffentlichung|date_format:"%d.%m.%Y"}" /> 
</fieldset>
</td>
</tr>
</table>



<table width="100%" border="0" cellpadding="1" cellspacing="1">
<tr>
<td>
<fieldset>
<legend><label for="lHersteller">{#Manufacturer#}</label></legend>
<select  style="width:150px"  class="input" id="lHersteller" name="Hersteller">
<option value="">-</option>
 {foreach from=$mf item=m}
 <option value="{$m->Id}" {if $content->Hersteller==$m->Id}selected="selected"{/if}>{$m->Name|koobispecialchars}</option>
 {/foreach}
 </select>
</fieldset>
</td>
<td>
<fieldset>
<legend><label for="lVertrieb">{#Manufacturer_v#}</label></legend>
<select  style="width:150px"  class="input" id="lVertrieb" name="Vertrieb">
<option value="">-</option>
 {foreach from=$mf item=m}
 <option value="{$m->Id}" {if $content->Vertrieb==$m->Id}selected="selected"{/if}>{$m->Name|koobispecialchars}</option>
 {/foreach}
 </select>
</fieldset>
</td>
<td>
<fieldset>
<legend><label for="lPreis">{#Products_price#}</label></legend>
<input name="Preis" type="text" class="input" id="lPreis" style="width:100px" value="{$content->Preis}" /> 
</fieldset>
</td>

<td>
<fieldset>
<legend><label for="lShopurl">{#Products_shopurl#}</label></legend>
<input name="Shopurl" type="text" class="input" id="lShopurl" style="width:200px" value="{$content->Shopurl}" /> 
</fieldset>
</td>
<td>
<fieldset>
<legend><label for="lShop">{#Products_shopname#}</label></legend>
<input name="Shop" type="text" class="input" id="lShop" style="width:200px" value="{$content->Shop}" /> 
</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>      
 </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="20" 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="newImg_1" id="newFile_1" />
<!-- Uploadform -->    
</fieldset>
</div>


<div id="opt-5">
{assign var='inline_table' value='products'}
{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.Gal_incl_info}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span>
{#Global_mergeGalleries#}</legend>
      <select name="Gallery[]" size="10" 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>

<fieldset>
<legend>{#Products_links#}</legend>
{#Products_links_inf#}
<br />
<br />
<textarea name="Links" style="width:99%; height:77px">{$content->Links}</textarea>
</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}); 
	$("#lDatum_Veroffentlichung").attachDatepicker();

	{rdelim});
</script>