{include file="page_header.htm"}
{insert_scripts files="../js/utils.js"}
<form enctype="multipart/form-data" name="theForm" action="brand.php" method="post" onsubmit="return validate()">
<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="table_form1" >	
{if $language_select|@count>1}
	<tr>
	<td class="label">语言:</td>
	<td>
	<select name="language_id" id="language_id" class="select_input">
	{foreach from=$language_select item=list name=language}
	  <option value="{$list.language_id}" {if $list.language_id == $brand.language_id} selected {/if}>{$list.name}</option>
	{/foreach}		
	</select>
	</td>
	</tr>	  
{/if}

	<tr>
	<td class="label">品牌名称：</td>
	<td>
	<input type="text" name="brand_name" value="{$brand.brand_name|escape:html}" class="FormSmall" size="20" /> <span class="required">&nbsp;</span>
	</td>
	</tr>
	<tr>
	<td class="label">品牌标志:</td>
	<td>
	<input class="upload_image_btn" id="upload_image" name="upload_image" type="file" />
	
	<div id="image_box">
	{if $brand.image neq ""}<br />
	<a href="../{$brand.image}" target="_blank"><img src="../{$brand.image_thumb}" border="0"  /></a>
	<div style="margin-top:5px;text-align:left;margin-bottom:10px;">
	{literal}
	<a href="javascript:;" onclick="if(confirm('您确实要删除该图片吗?')){drop_image();}">删除</a>
	{/literal}
	</div>
	{/if}
	</div>
	<input name="image" type="hidden" value="{$brand.image}" id="image" />
	</td>
	</tr>
	<tr>
	<td class="label">显示顺序：</td>
	<td>
	<input type="text" name="sort_order" value="{$brand.sort_order}" class="FormSmall" size="6"  /> 从小到大排序
	</td>
	</tr>
	<tr>
	<td style="border:none;"></td>
	<td style="border:none;">
		<input type="hidden" name="act" value="{$form_act}" />
		<input type="hidden" name="id" value="{$brand.brand_id}" />
	<input type="submit" value="提交" class="bginput" />
	<input type="reset" value="重置" class="bginput" />
	</td>
	</tr> 
</table>
</form>
<script language="JavaScript">
{literal}
function validate(){
    validator = new Validator("theForm");
    validator.required("brand_name",      "请输入品牌名称");
    return validator.passed();
}

$('.upload_image_btn').uploadify({
	'formData'     : {
		'rand_str' 	: '{/literal}{$rand_str}{literal}',
		'hash'     	: '{/literal}{$hash}{literal}',
		'session_id' : '{/literal}{$session_id}{literal}',
		'thumb_width'  : '100',
		'thumb_height' : '100',
		'img_type'  : 'image'
	},	
	'multi':true,
	'width':'107',
	'height':'25',
	'buttonText':'',
	'buttonImage':'images/add_image.png',
	'swf':'images/uploadify.swf',
	'uploader' : 'uploadify.php',
	'fileTypeDesc' : 'Image Files',
	'fileSizeLimit' : '2048KB',
	'fileTypeExts' : '*.gif; *.jpg; *.png',
	'itemTemplate' : '',
	'onUploadStart' : function(file) {
		//$("#loading").fadeIn("fast");
	},
	'onUploadSuccess' : function(file, data, response) {
		result = $.parseJSON(data);
		if(result.error == 1){
			alert(result.message);
		}else{
			$('#image_box').html("<a href=\"../"+result.image+"\" target=\"_blank\"><img src=\"../"+result.image_thumb+"\" border=\"0\"  /></a><div style=\"margin-top:5px;text-align:left;margin-bottom:10px;\"><a href=\"javascript:;\" onclick=\"if(confirm('您确实要删除该图片吗?')){drop_image();}\">删除</a></div>");
			$('#image').val(result.image);
		}
	 }
});

function drop_image(){
	$('#image_box').html('');
	$('#image').val('');
}

{/literal}
</script>
{insert_scripts files="validator.js"}
{include file="page_footer.htm"}