<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=manufacturer&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}
				Name: {ldelim}required: true{rdelim},
				Homepage: {ldelim}required: true,url: true{rdelim}
			{rdelim}, 
	messages: 
			{ldelim}
			{rdelim}
	{rdelim});
{rdelim});
// -->
</script>

<div class="popbox">
<div class="header">{if $smarty.request.sub=='edit'}{#Manufacturer_edit#}{else}{#Manufacturer_new#}{/if}</div>
<form name="Form" id="Form" action="" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td width="200" class="row_left">{#Global_Name#}</td>
    <td class="row_right"><input class="input" style="width:200px" type="text" name="Name" value="{$res->Name|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#Manufacturer_fullname#}</td>
    <td class="row_right"><input class="input" style="width:200px" type="text" name="NameLang" value="{$res->NameLang|koobispecialchars}"></td>
  </tr>
  {if $res->Bild!=''}
  <tr>
    <td class="row_left">{#Global_imgCurrent#}</td>
    <td class="row_right">
    <img src="../uploads/manufacturer/{$res->Bild}" /><br />
    <label><input type="checkbox" name="NoImg" value="1" /> {#Global_ImgDel#}</label>    </td>
  </tr>
  {/if}
  <tr>
    <td class="row_left">{#Global_imgNew#}</td>
    <td class="row_right">
    <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','130');" value="{#Global_Upload#}" />
    <input type="hidden" name="newImg_1" id="newFile_1" />
    <!-- Uploadform -->    </td>
  </tr>
  <tr>
    <td class="row_left">{#Global_descr#} ({$language_long_1})</td>
    <td class="row_right">{$Beschreibung_1}</td>
  </tr>
  <tr>
    <td class="row_left">{#Global_descr#} ({$language_long_2})</td>
    <td class="row_right">{$Beschreibung_2}</td>
  </tr>
  <tr>
    <td class="row_left">{#Global_descr#} ({$language_long_3})</td>
    <td class="row_right">{$Beschreibung_3}</td>
  </tr>
  <tr>
    <td class="row_left">{#Manufacturer_home#}</td>
    <td class="row_right"><input class="input" style="width:200px" type="text" name="Homepage" value="{$res->Homepage|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#Manufacturer_gr_c#}</td>
    <td class="row_right"><input class="input" style="width:200px" type="text" name="GruendungLand" value="{$res->GruendungLand|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#Manufacturer_gr_year#}</td>
    <td class="row_right"><input class="input" style="width:50px" type="text" name="Gruendung" value="{$res->Gruendung|koobispecialchars}"></td>
  </tr>
   <tr>
    <td class="row_left">{#Manufacturer_worker#}</td>
    <td class="row_right"><input class="input" style="width:50px" type="text" name="Personen" value="{$res->Personen|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#Manufacturer_phone#}</td>
    <td class="row_right"><input class="input" style="width:200px" type="text" name="Telefonkontakt" value="{$res->Telefonkontakt|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#Manufacturer_adress#}</td>
    <td class="row_right"><textarea class="input" style="width:300px; height:100px" name="Adresse" id="Adresse">{$res->Adresse|koobispecialchars}</textarea></td>
  </tr>
</table>

<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" />
</form>
</div>