<?php
	session_start(); 
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/check.php');
	$opendb=new mydb();
	require_once('inc/char_set.php');
	
	if ($_GET['ls_msg']==""){
		$ls_msg="产品类别管理操作";
	}else{
		$ls_msg=$_GET['ls_msg'];	
	}

	$ls=$_GET['ls'];
	$id=$_GET['id'];
	$submit=$_POST['submit'];
	$nownum=$_GET['Num'];
	$whichcate=$_GET['whichcate'];
	
	if ($submit=="保存")
	{
		$skype3=str_replace("'","''",$_POST['skype3']);
		$config_update="update ls_config set skype3= '$skype3' ";
		$config_query=$opendb->query($config_update);
		writelog($_SERVER['PHP_SELF'],"Product Brief: <br/>".$skype3,"ID: ".$id);
		
	}

	$config_sql="select * from ls_config ";
	$config_query=$opendb->query($config_sql);
	$config_rows=mysql_fetch_assoc($config_query);

	
	
	$opendb=new mydb();
	require_once('inc/char_set.php');
	
	
	/**************** 更新添加连接的状态 ****************/
	switch($_GET['ls']){
		case 'addProLink':
			$id = $_GET['id'];
			$add_prolink_sql = 'UPDATE `ls_products` SET `addProLink`=NULL where 1';
			if($opendb->query($add_prolink_sql)){
				$add_prolink_sql = 'UPDATE `ls_products` SET `addProLink`=1 WHERE `ID`='.$id;
				if($opendb->query($add_prolink_sql)){//exit;
				}
			}
			break;
		case 'delProLink':
			$del_prolink_sql = 'UPDATE `ls_products` SET `addProLink`=NULL';
			if($opendb->query($del_prolink_sql)){//exit;
			}
			break;
		case 'addNewProLink':
			$id = $_GET['id'];
			$add_prolink_sql = 'UPDATE `ls_products` SET `addNewProLink`=NULL';
			if($opendb->query($add_prolink_sql)){
				$add_prolink_sql = 'UPDATE `ls_products` SET `addNewProLink`=1 WHERE `ID`='.$id;
				if($opendb->query($add_prolink_sql)){//exit;
				}
			}
			break;
		case 'delNewProLink':
			$del_newprolink_sql = 'UPDATE `ls_products` SET `addNewProLink`=NULL';
			if($opendb->query($del_newprolink_sql)){//exit;
			}
			break;
	}
	/************************************************************************/
	switch ($ls)
	{
		case  "sort":
			$operationId=$_GET['opid'];
			$targetId=$_GET['tgid'];
			
			$operationSql="select ID,Num from ls_products where ID=".$operationId;
			$targetSql="select ID,Num from ls_products where ID=".$targetId;
			$operationQuery=$opendb->query($operationSql);
			$targetQuery=$opendb->query($targetSql);
			$operationArray=mysql_fetch_assoc($operationQuery);
			$targetArray=mysql_fetch_assoc($targetQuery);
			$operationNum=$targetArray['Num'];
			$targetNum=$operationArray['Num'];
			$operationUpdateSql="update ls_products set Num=".$operationNum." where ID=".$operationId;
			$targetUpdateSql="update ls_products set Num=".$targetNum." where ID=".$targetId;
			$updateQuery=$opendb->query($operationUpdateSql);
			$updateQuery=$opendb->query($targetUpdateSql);
			
			$ls_msg="排序操作成功！";
			break;
	 	case "unenable":
			$unenable_sql="update ls_products set enable=0 where id=".$id." ";
			//echo $unenable_sql;
			$unenable_query=$opendb->query($unenable_sql);
			$ls_msg="不显示操作成功！";
			break;
		case "enable":
			$enable_sql="update ls_products set enable=1 where id=".$id." ";
			//echo $enable_sql;
			$enable_query=$opendb->query($enable_sql);
			$ls_msg="显示操作成功！";
			break;
		case 'scan':
			scancates();
			$ls_msg="扫描与修复完成！";
			break;
	}
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="css/admin.css" rel="stylesheet" type="text/css">
<?php
	/**************** 创建添加连接脚本用到的JS变量 ****************/
	$add_prolink_sql = 'SELECT `ID` FROM `ls_products` WHERE `addProLink`=1';
	$add_prolink=$opendb->query($add_prolink_sql);
	if(mysql_num_rows($add_prolink)>0){
		if($add_prolink=mysql_fetch_array($add_prolink)){
			echo '<script type="text/javascript">';
			echo 'var add_prolink_ID='.$add_prolink['ID'];
			echo '</script>';
		}
	}
	$add_newprolink_sql = 'SELECT `ID` FROM `ls_products` WHERE `addNewProLink`=1';
	$add_newprolink=$opendb->query($add_newprolink_sql);
	if(mysql_num_rows($add_newprolink)>0){
		if($add_newprolink=mysql_fetch_array($add_newprolink)){
			echo '<script type="text/javascript">';
			echo 'var add_newprolink_ID='.$add_newprolink['ID'];
			echo '</script>';
		}
	}
	/************************************************************************/
?>
<script type="text/javascript" src="scripts/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/ls.js"></script>
<!--<script type="text/javascript" src="js/add_prolink.js"></script>
--><title>无标题文档</title>
<link rel="stylesheet" href="css/style2.css" />
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" >
	<tr>
<td height="18" style="border-bottom:2px solid #00c0ef; padding-bottom:5px;"><div align="center"><font color="#3c8dbc" style="font-size:16px;">产品类别管理</font></div></td>
	</tr>
	<tr>
		<td height="213" valign="top"><br>
		  <table border="0" width="98%" align="center">
				<tr>
					<td width="32%">提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
					<td align="right" width="30%"><img src="images/shao.gif"><a href="cate.php?ls=scan"><u>重新排序</u></a></td>
					<td align="right" width="16%"><img src="images/shao.gif">&nbsp;<a href="addcate.php"><u>添加大类</u></a></td>
					<td align="right" width="22%"><button  type="button" style="cursor:hand;color:#fff;" value="产品页生成" onclick="location='temp_index.php?ls=products&productsall=ok'">产品页生成</button> <button  type="button" style="cursor:hand;color:#fff;" value="产品页生成" onclick="location='autobatchadd.php'">导入类别</button></td>
				</tr>
			</table>
			<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1"  bgcolor="#f0f0ee" >
				<tr height="37">
					<td align="center" height="25" width="25">ID</td>
					<td align="center" width="47">菜单</td>
					<td align="center" width="48">新品</td>
					<td align="center" width="50">类级</td>
					<td align="center" height="25" width="424">类别名称</td>
					<td width="76" align="center"  >日期</td>
					<td align="center" colspan="2">排序</td>
					<td align="center" colspan="3">操作</td>
					<td align="center" width="28">批量导</td>
					<td align="center" width="35">显示</td
						>
				</tr>
				<?php
						$i=1;
							$cate_sql="select * from ls_products where subcateName is null and subcateFolders is null and subcateID is null and productPic is null and productItemNo is null and productName is null and midcateName is null and productSpecification is null and productID is null order by Num asc";
							$cate_query=$opendb->query($cate_sql);
							$cate_myrows=mysql_num_rows($cate_query); 
							
							//缓存一个用于指示排序参数的数组
							if($cate_myrows!=0){
								$topSign=0;
								$cateNumArray=array();
								while($cateArray=mysql_fetch_assoc($cate_query)){
									if($topSign==0){
										$prevNumId=$cateArray['ID'];
										$topSign++;
										continue;
									}
									$cateNumArray[$prevNumId]['down']=$cateArray['ID'];
									$cateNumArray[$cateArray['ID']]['up']=$prevNumId;
									$prevNumId=$cateArray['ID'];
									$topSign++;
								}
								mysql_data_seek($cate_query,0);		//缓存结束，重置指针
							}
							
							while($cate_rows=mysql_fetch_assoc($cate_query))
							 { ?>
							 <tr bgcolor='#f9f9f9' height='37'
							onMouseOver=
								 	this.style.backgroundColor='#e5e5e5' 
								onMouseOut=
								 	this.style.backgroundColor='#f9f9f9' 
								>
							  	<td  align=center title="<?=$cate_rows['ID']?>"><?=$cate_rows['ID']?></td>
							  	<td align="center" rel={$cate_rows[ID]}><?	  if($cate_rows['addProLink']==1)
									{   ?>
                                  <a href='?id=<?=$cate_rows['ID']?>&ls=delProLink' title='解绑 Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                  <?		}
								  if($cate_rows['addProLink']==0)
								  	{   ?>
                                  <a href='?id=<?=$cate_rows['ID']?>&ls=addProLink' title='本类绑定 Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                <?		}   ?></td>
							  	<td align="center" rel={$cate_rows[ID]}><?	  if($cate_rows['addNewProLink']==1)
									{   ?>
                                  <a href='?id=<?=$cate_rows['ID']?>&ls=delNewProLink' title='解绑 New Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                  <?		}
								  if($cate_rows['addNewProLink']==0)
								  	{   ?>
                                  <a href='?id=<?=$cate_rows['ID']?>&ls=addNewProLink' title='本类绑定 New Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                <?		}   ?></td>
							  	<td align="center" rel={$cate_rows[ID]}  ><?= "B-".$cate_rows['Num']; ?></td>
							  	<td rel={$cate_rows[ID]}  >
							  		<img src='images/tree_cate.gif'>
						   <?  $cateName = str_replace("''","'",$cate_rows['cateName']);
							  echo 			$cateName; ?></td>
							   	<td  align=center>
							 <?=substr( $cate_rows['date'],2,8); ?>
							  	</td>
							   	<td width="34" align='center'> 
							   	  <?  if($i!=1)
							  { ?>
							   	  <a href='?ls=sort&opid=<?=$cate_rows['ID']?>&tgid=<?=$cateNumArray[$cate_rows['ID']]['up']?>' title='向上移动'><img src='images/up.gif' border='0'></a>
							   	  <?	} ?>						   	    </td>
							  	<td width="29" align='center'> 
							<?	if($i!=$cate_myrows)
							  { ?>
								  <a href='?ls=sort&opid=<?=$cate_rows['ID']?>&tgid=<?=$cateNumArray[$cate_rows['ID']]['down']?>' title='向下移动'><img src='images/down.gif' border='0'></a>
							<?	} 
								
								$i++; ?>
								  </td>
									<td width="37" align='center'> 
							<?	$mid_sql = "select * from ls_products where productID=".$cate_rows['ID'];
								$mid_query = $opendb->query($mid_sql);
								$mid_myrows = mysql_num_rows($mid_query);
								if($cate_rows['enable']==0 || $mid_myrows != 0)
								{ ?>
										<img src='images/b_unadd.gif' border='0'>
							<?	}else if($cate_rows['enable']==1)
								{ ?>
										<a href='addmidcate.php?id=<?=$cate_rows['ID']?> ' title='添加产品中类'><img src='images/b_add.gif' border='0'></a>
							<?	} ?>
								  </td>
									<td width="30" align='center'> 
										<a href='modicate.php?id=<?=$cate_rows['ID']?>' title='编辑'><img src='images/b_edit.png' border='0'></a>
								  </td>
									<td width="41" align='center'> 
								
							<?	$midcate_sql="select * from ls_products where cateName is null and cateFolders is null and subcateName is null and subcateFolders is null and subcateID is null and productPic is null and productItemNo is null  and productName is null and productSpecification is null and productID is null and midcateID=".$cate_rows['ID']." order by Num asc";
								$midcate_query=$opendb->query($midcate_sql);
								$midcate_myrows=mysql_num_rows($midcate_query); 
								if($midcate_myrows==0)
								{
									$midcate2_sql="select * from ls_products where productID=".$cate_rows['ID']." order by Num desc";
									$midcate2_query=$opendb->query($midcate2_sql);
									$midcate2_myrows2=mysql_num_rows($midcate2_query);
									if($midcate2_myrows2==0)
									{ ?>
											<a href='savecate.php?id=<?=$cate_rows['ID']?>&ls=del' onclick='return ConfirmDelCate();' title='删除'><img src='images/b_drop.png' border='0'></a>
							 <?		}
									else
									{ ?>
											<img src='images/b_undrop.png' border='0' alt='大类下面有产品。&#10请先删除产品。'>
							<?		}
								}
								else
								{  ?>
										<img src='images/b_undrop.png' border='0' alt='大类下面还有中类。&#10请先删除中类。'>
							<?	}  ?>
								
								  </td>
									<td align='center'>
						  
							<?	  if($midcate_myrows==0)
									{  ?>
										 <a href=batchadd.php?id=<?=$cate_rows['ID']?>&name=<?=urlencode($cate_rows['cateName'])?>&ls=batchadd title='导入'><=</a>
							<?		}   ?>
															
									</td>
									<td align='center'>
						  
							<?	  if($cate_rows['enable']==1)
									{   ?>
										<a href='?id=<?=$cate_rows['ID']?>&ls=unenable' title='显示'><img src='images/enable.gif' border='0'></a>
							<?		}
								  if($cate_rows['enable']==0)
								  	{   ?>
										<a href='?id=<?=$cate_rows['ID']?>&ls=enable' title='不显示'><img src='images/unenable.gif' border='0'></a>
							<?		}   ?>
															
									</td>
							  </tr>
							  
							  
							<?  if($cate_rows['enable']==1)
									{
													$j=1;
													
													//缓存一个中类的用于指示排序参数的数组
													if($midcate_myrows!=0){
														$topSignMid=0;
														$midCateNumArray=array();
														while($midCateArray=mysql_fetch_assoc($midcate_query)){
															if($topSignMid==0){
																$prevNumIdMid=$midCateArray['ID'];
																$topSignMid++;
																continue;
															}
															$midCateNumArray[$prevNumIdMid]['down']=$midCateArray['ID'];
															$midCateNumArray[$midCateArray['ID']]['up']=$prevNumIdMid;
															$prevNumIdMid=$midCateArray['ID'];
															$topSignMid++;
														}
														mysql_data_seek($midcate_query,0);		//缓存结束，重置指针
													}
									
										  			while($midcate_rows=mysql_fetch_assoc($midcate_query))
													  {  ?>
															  <tr bgcolor='#f4f4f4'
															onMouseOver=
																 	this.style.backgroundColor='#e5e5e5' 
																onMouseOut=
																 	this.style.backgroundColor='#f4f4f4' 
																>
							 										<td  align=center><?=$cate_rows['ID']?></td>
							 										<td align="center"   rel={$midcate_rows[ID]}><?	  if($midcate_rows['addProLink']==1)
																{  ?>
                                                                      <a href='?id=<?=$midcate_rows['id']?>&ls=delProLink' title='解绑 Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                                                      <?		}   
															  if($midcate_rows['addProLink']==0)
															  	{	?>
                                                                      <a href='?id=<?=$midcate_rows['id']?>&ls=addProLink' title='本类绑定 Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                                                    <?	} ?></td>
							 										<td align="center"   rel={$midcate_rows[ID]}><?	  if($midcate_rows['addNewProLink']==1)
																{  ?>
                                                                      <a href='?id=<?=$midcate_rows['id=']?>&ls=delNewProLink' title='解绑 New Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                                                      <?		}   
															  if($midcate_rows['addNewProLink']==0)
															  	{	?>
                                                                      <a href='?id=<?=$midcate_rows['id=']?>&ls=addNewProLink' title='本类绑定 New Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                                                    <?	} ?></td>
							 										<td align="center" style='' rel={$midcate_rows[ID]}><?=" M-".$midcate_rows['Num']?></td>
															  	<td style='padding-left:25px;' rel={$midcate_rows[ID]}>
															  		<img src='images/tree_cate.gif'>
															<?  $midcateName = str_replace("''","'",$midcate_rows['midcateName']);
															  echo 			$midcateName; ?>
															  	</td>
															   	<td  align=center>
															  <?=substr( $midcate_rows['date'],2,8); ?>
															  	</td>
															   	<td align='center'> 
															   	  <?	  if($j!=1)
															  {  ?>
															   	  <a href='?ls=sort&opid=<?=$midcate_rows['ID']?>&tgid=<?=$midCateNumArray[$midcate_rows['ID']]['up']?>' title='向上移动'><img src='images/up.gif' border='0'></a>
															   	  <?	}  ?>														   	    </td>
															  	<td align='center'> 
														<?	if($j!=$midcate_myrows)
															  {  ?>
																  <a href='?ls=sort&opid=<?=$midcate_rows['ID']?>&tgid=<?=$midCateNumArray[$midcate_rows['ID']]['down']?>' title='向下移动'><img src='images/down.gif' border='0'></a>
														<?		}
																$j++;  ?>

																  </td>
																	<td align='center'> 
															<?	$sub_sql = "select * from ls_products where productID=".$midcate_rows['ID'];
																$sub_query = $opendb->query($sub_sql);
																$sub_myrows = mysql_num_rows($sub_query);
																if($sub_myrows != 0){  ?>
																	<img src='images/b_unadd.gif' border='0'>
															<?	}else{   ?>
																			<a href='addsubcate.php?id=<?=$midcate_rows['ID']?> ' title='添加产品小类'><img src='images/b_add.gif' border='0'></a>
															<?	}  ?>
																  </td>
																	<td align='center'> 
																		<a href='modimidcate.php?id=<?=$midcate_rows['ID']?>' title='编辑'><img src='images/b_edit.png' border='0'></a>
																  </td>
																	<td align='center'> 
																
														<?		$subcate_sql="select * from ls_products where cateName is null and cateFolders is null and midcateName is null and midcateID is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and subcateID=".$midcate_rows['ID']." order by Num asc";
																$subcate_query=$opendb->query($subcate_sql);
																$subcate_myrows=mysql_num_rows($subcate_query); 
																 
																
						
																if($subcate_myrows==0)
																{
																	$subcate2_sql="select * from ls_products where productID=".$midcate_rows['ID']." order by Num desc";
																	$subcate2_query=$opendb->query($subcate2_sql);
																	$subcate_myrows2=mysql_num_rows($subcate2_query);
																	if($subcate_myrows2==0)
																	{  ?>
																			<a href='savemidcate.php?id=<?=$midcate_rows['ID']?>&ls=del' onclick='return ConfirmDelCate();' title='删除'><img src='images/b_drop.png' border='0'></a>
															<?		}
																	else
																	{  ?>
																			<img src='images/b_undrop.png' border='0' alt='中类下面有产品。&#10请先删除产品。'>
															<?		}
																}
																else
																{  ?>
																		<img src='images/b_undrop.png' border='0' alt='中类下面还有小类。&#10请先删除小类。'>
															<?	}  ?>

																  </td>
									<td align='center'>
						  
							<?	  if($subcate_myrows==0)
									{	?>
										<a href=batchadd.php?id=<?=$midcate_rows['ID']?>&name=<?=urlencode($midcate_rows['midcateName'])?>&ls=batchadd title='导入'><=</a>
							<?		}   ?>
															
									</td>
																	<td align='center'>

														<?	  if($midcate_rows['enable']==1)
																{  ?>
																<a href='?id=<?=$midcate_rows['ID']?>&ls=unenable' title='显示'><img src='images/enable.gif' border='0'></a>
														<?		}   
															  if($midcate_rows['enable']==0)
															  	{	?>
																<a href='?id=<?=$midcate_rows['ID']?>&ls=enable' title='不显示'><img src='images/unenable.gif' border='0'></a>
															<?	} ?>
															
																	</td>
																  </tr>
								
															  

															<?	if($cate_rows['enable']==1)
																{
																	$k=1;
																	
																	//缓存一个小类的用于指示排序参数的数组
																	
																	if($subcate_myrows!=0){
																		$topSignSub=0;
																		$subCateNumArray=array();
																		while($subCateArray=mysql_fetch_assoc($subcate_query)){
																			if($topSignSub==0){
																			   $prevNumIdSub=$subCateArray['ID'];
																			   $topSignSub++;
																			   continue;
																			}
																			
																			$subCateNumArray[$prevNumIdSub]['down']=$subCateArray['ID'];
																			$subCateNumArray[$subCateArray['ID']]['up']=$prevNumIdSub;
																			$prevNumIdSub=$subCateArray['ID'];
																			$topSignSub++;
																		}
																		mysql_data_seek($subcate_query,0);		//缓存结束，重置指针
																	}
																	
														  			while($subcate_rows=mysql_fetch_assoc($subcate_query))
																	  {	?>
																		  <tr bgcolor='#f4f4f4'
																		onMouseOver=
																		 	this.style.backgroundColor='#e5e5e5' 
																		onMouseOut=
																		 	this.style.backgroundColor='#f4f4f4' 
																		>
							  												<td  align=center>&nbsp;</td>
							  												<td align="center"   rel={$subcate_rows[ID]}><?	  if($subcate_rows['addProLink']==1)
																			{	?>
                                                                              <a href='?id=<?=$subcate_rows['id=']?>&ls=delProLink' title='解绑 Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                                                              <?	}	
																		  if($subcate_rows['addProLink']==0)
																		  	{	?>
                                                                              <a href="?id=<?=$subcate_rows['ID']?>&ls=addProLink" title='本类绑定 Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                                                            <?	} ?></td>
							  												<td align="center"   rel={$subcate_rows[ID]}><?	  if($subcate_rows['addNewProLink']==1)
																			{	?>
                                                                              <a href='?id=<?=$subcate_rows['ID']?>&ls=delNewProLink' title='解绑 New Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                                                              <?	}	
																		  if($subcate_rows['addNewProLink']==0)
																		  	{	?>
                                                                              <a href="?id=<?=$subcate_rows['ID']?>&amp;ls=addNewProLink" title='本类绑定 New Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                                                            <?	} ?></td>
							  												<td align="center" style='' rel={$subcate_rows[ID]}><?=	"S-".$subcate_rows['Num'];?></td>
																		  	<td style='padding-left:35px;' rel={$subcate_rows[ID]}>
																		  		&nbsp; <img src='images/tree_cate.gif'>
																		<?  $subcateName = str_replace("''","'",$subcate_rows['subcateName']);
																		  echo 			$subcateName; ?>
																		  	</td>
																		   	<td  align=center>
							  												<?= substr( $subcate_rows['date'],2,8);?>
																		  	</td>
																		   	<td align='center'> 
																		   	  <?   if($k!=1)
															 				 {  ?>
																		   	  <a href='?ls=sort&opid=<?=$subcate_rows['ID']?>&tgid=<?=$subCateNumArray[$subcate_rows['ID']]['up']?>' title='向上移动'><img src='images/up.gif' border='0'></a>
																		   	  <?	}	?>																	   	    </td>
																		  	<td align='center'> 
																		<?	if($k!=$subcate_myrows)
															 				 {	?>
																			  <a href='?ls=sort&opid=<?=$subcate_rows['ID']?>&tgid=<?=$subCateNumArray[$subcate_rows['ID']]['down']?>' title='向下移动'><img src='images/down.gif' border='0'></a>
																		<?	}
																			
																			$k++;  ?>
																			  </td>
																				<td align='center'> 
																			
																			  </td>
																				<td align='center'> 
																					<a href='modisubcate.php?id=<?=$subcate_rows['ID']?>' title='编辑'><img src='images/b_edit.png' border='0'></a>
																			  </td>
																				<td align='center'> 
																
																	
																	<?		$products_sql="select * from ls_products where cateName is null and cateFolders is null and subcateName is null and subcateFolders is null and subcateID is null and midcateName is null and midcateID is null and productID=".$subcate_rows['ID']." order by Num desc ";													
																			$products_query=$opendb->query($products_sql);
																			$products_num=mysql_num_rows($products_query);
																			if($products_num!=0)
																			{	?>
																						<img src='images/b_undrop.png' border='0' alt='小类下面还有产品。&#10请先删除产品。'>
																		<?	}
																			else
																			{
																			  ?>		 <a href='savesubcate.php?id=<?=$subcate_rows['ID']?>&ls=del' onclick='return ConfirmDelSubCate();' title='删除'><img src='images/b_drop.png' border='0'></a>
																		<?	} ?>
																			  </td>
									<td align='center'>
										<a href=batchadd.php?id=<?=urlencode($subcate_rows['ID'])?>&ls=batchadd title='导入'><=</a>
									</td>
																				<td align='center'>
																		<?	  if($subcate_rows['enable']==1)
																			{	?>
																			<a href='?id=<?=$subcate_rows['ID']?>&ls=unenable' title='显示'><img src='images/enable.gif' border='0'></a>
																		<?	}	
																		  if($subcate_rows['enable']==0)
																		  	{	?>
																			<a href=batchadd?id=<?=$subcate_rows['ID']?>&name=<?=$subcate_rows['subcateName']?>&ls=enable title='不显示'><img src='images/unenable.gif' border='0'></a>
																		<?	} ?>
																				</td>
																		  </tr>
															  
											<?		}
						
						
						
									}
															  
															  
															  
							}
			}
							
							  
							  
} ?>
			</table></td>
	</tr>
</table>
                       <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
                       <tr>
                        <td colspan="2" height="24" align="center">&nbsp;</td>
                      </tr>
                       </table>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1"  style="background-color: #f0f0ee;">
  <tr bgcolor="#f0f0ee">
    <td height="37" align="center" ><form name="fmconfig" method="post" enctype="multipart/form-data"  action="cate.php">
<fieldset class="lsconeditorsfield"  >
							<legend>产品综述</legend><div class="lsconeditorarea">
							<div  align="center" style="padding-left:30px;">  
							  <p>
							    <textarea name="skype3"  rows="5"   style=" width:96%;"><?php echo $config_rows['skype3'];?></textarea>
						      </p>
							  <p><button name="submit" type="submit" value="保存" class="submitbuttonsf4">保存</button></p>
</div>
						</fieldset>
                        </form>
                        </td>
  </tr>
	<tr>
		<td valign="top"><br>
			<table border="0" width="98%" align="center">
				<tr>
					<td><ul>
							<li> <img src="images/b_add.gif"> 添加小类 <img src="images/b_unadd.gif"> 不能添加小类 </li>
							<li> <img src="images/b_edit.png"> 修改/编辑 </li>
							<li> <img src="images/b_drop.png"> 删除 <img src="images/b_undrop.png"> 不能删除 </li>
							<li> &lt;=  &nbsp;批量导入产品图 </li>
							<li> <img src="images/enable.gif"> 显示<br>
								<img src="images/unenable.gif"> 不显示 大类不显示后，大类下小类及产品都不显示。 </li>
							<li> 扫描并纠正错误将重置类别顺序。可以在扫描完成后重新调整顺序。 </li>
						</ul></td>
				</tr>
			</table>
			<br></td>
	</tr>
</table>
</body>
</html>