<h3><{$mod_name}> - <{$menu_name}></h3>


<{if $categories}>
 <div class="head" style="font-size:130%;"><{$smarty.const._MD_A_LINKS_CAT_LIST}></div>
  <table cellpadding="5" border="1" style="border-collapse:collapse;empty-cells:show; border-color:#666;margin-bottom:16px;">
	<tr>
		<th><{$smarty.const._MD_A_LINKS_CAT_NAME}></th>
		<th><{$smarty.const._MD_A_LINKS_CAT_ORDER}></th>
		<th><{$smarty.const._MD_A_LINKS_CAT_ITEMNUM}></th>
		<th><{$smarty.const._MD_A_LINKS_CAT_IMAGE}></th>
		<th></th>
	</tr>
	<{foreach item=cat from=$categories}>
	  <tr class="<{cycle values='odd,even'}>">
	  	<td><{$cat.prefix}><{$cat.title}></td>
	  	<td><{$cat.corder}></td>
	  	<td><{$cat.itemnum}></td>
	  	<td><{if $cat.imgurl}><img src="<{$xoops_url}>/<{$imgpath}>/<{$cat.imgurl}>" /><{/if}></td>
	  	<td><a href="<{$myurl}>/admin/index.php?c=categories&amp;cid=<{$cat.cid}>"><{$smarty.const._EDIT}></a></td>
	  </tr>
	<{/foreach}>
  </table>
<{/if}>


<div class="head" style="font-size:130%;<{if $editcat}>background:#fcf;<{/if}>"><{$smarty.const._MD_A_LINKS_CAT_NEWEDIT}></div>

		<form id="categoryform" name="categoryform" action="<{$myurl}>/admin/index.php?c=categories&amp;m=post" method="post" style="margin:0;" onsubmit='return submitCheck();'>
<table cellpadding="5" border="1" style="border-collapse:collapse;empty-cells:show; border-color:#666;">
	<tr>
		<td class="head"><{$smarty.const._MD_A_LINKS_CAT_NAME}></td>
		<td class="odd"><input type="text" name="title" id="title" size="50" value="<{$editcat.title}>" /></td>
	<tr>
		<td class="head"><{$smarty.const._MD_A_LINKS_CAT_PARENT}></td>
		<td class="odd">
		<{$pidselector}>
		</td>
	</tr>
	<tr>
		<td class="head"><{$smarty.const._MD_A_LINKS_CAT_ORDER}></td>
		<td class="odd"><input type="text" name="corder" id="corder" value="<{if $editcat.corder}><{$editcat.corder}><{else}>0<{/if}>" /></td>
	</tr>
	<tr>
		<td class="head"><{$smarty.const._MD_A_LINKS_CAT_IMAGE}></td>
		<td class="odd">
			<select name="imgurl" id="imgurl" onchange='showImgSelected("categoryimage", "imgurl", "", "", "<{$xoops_url}>/<{$imgpath}>")'>
				<option value="">----</option>
				<{foreach item=imgfile from=$imgfiles}>
					<option value="<{$imgfile}>" <{if $editcat.imgurl==$imgfile}>selected="SELECTED"<{/if}> ><{$imgfile}></option>
				<{/foreach}>
			</select>
			<span style="display:block;margin:5px;">
			  <{if $editcat.imgurl}>
			    <img src="<{$xoops_url}>/<{$imgpath}>/<{$editcat.imgurl}>" name="categoryimage" id="categoryimage" alt="" />
			  <{else}>
			    <img src="<{$xoops_url}>/images/blank.gif" name="categoryimage" id="categoryimage" alt="" />
			  <{/if}>
			</span>
		</td>
	<tr>
		<td class="foot" colspan="2">
				<input type="submit" name="edit" id="edit" value="<{$smarty.const._SUBMIT}>" />
				<input type="hidden" name="cid" value="<{if $editcat.cid}><{$editcat.cid}><{else}>0<{/if}>" id="cid" />
				<{$gticket}>
			</form>
		</td>
	</tr>

<{if $editcat}>
	<tr class="foot">
		<td colspan="2" align="right">
			<form id="category_del_form" name="category_del_form" action="<{$myurl}>/admin/index.php?c=categories&amp;m=delete" method="post">
				<input type="button" value="<{$smarty.const._DELETE}>" onclick='if(document.category_del_form.cid.value!=0)if(confirm("<{$smarty.const._MD_A_LINKS_CAT_DEL_MSG}>")){document.category_del_form.CP.value="";submit();}else{return false;}' />
				<input type="hidden" name="cid" value="<{if $editcat.cid}><{$editcat.cid}><{else}>0<{/if}>" id="cid" />
				<{$gticket}>
				<input type="hidden" name="CP" value="1" />
			</form>
		</td>
	</tr>
<{/if}>

</table>



<script type='text/javascript'>
<!--//
function submitCheck() {
	//PARENT CATEGRY check
	var cid = document.getElementById('cid');
	if( cid.value > 0 ){
		var pid = document.getElementById('pid');
		if( cid.value == pid.value ){
			alert( "<{$smarty.const._MD_CID_EQUAL_PID}>" );
			return false ;
		}
	}
	//TITLE
	var title = document.getElementById('title');
	if (title.value == '') {
		alert("<{$smarty.const._MD_A_LINKS_CAT_NO_TITLE}>");
		return false;
	}
	return true ;
}
//-->
</script>