<?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');

	$modiid=$_POST['modiid'];
	$dispFunctionName="栏目";
	$functionName=trim($_POST['functionName']);
	$functionName2=trim($_POST['functionName2']);
	$cateName=trim($_POST['cateName']);
	$cateName2=trim($_POST['cateName2']);
	if($_GET['cateName']!="")
	{$cateName=$_GET['cateName'];}
	$typeurl = $_POST['typeurl'];
	$brief=$_POST['brief'];
	$briefmodi=$_POST['briefmodi'.$modiid];
	$suffStr=trim($_POST['suffStr']);
	$hotLines=trim($_POST['hotLines']);
	$hotWords=trim($_POST['hotWords']);
	$oldfunctionName=$_POST['oldfunctionName'];
	$oldcateName=$_POST['oldcateName'];
	
	$selectfunctionName=$_GET['selectfunctionName'];
	$Num=$_POST['Num'];
	
	$newsTitle=trim($_POST['newsTitle']);
	$newsKeywords=trim($_POST['newsKeywords']);
	$newsDescription=trim($_POST['newsDescription']);
	
	if ($_GET['ls_msg']=="")
	{
		$ls_msg=$functionName."管理操作";
	}	
	else
	{
		$ls_msg=$_GET['ls_msg'];	
	}
		$ls=$_GET['ls'];
		$id=$_GET['id'];
	switch ($ls)
	{
	 	case "unenable":
			$unenable_sql="update ls_functioncates set enable=0 where id=".$id." ";
			//echo $unenable_sql;
			$unenable_query=$opendb->query($unenable_sql);
			$ls_msg="不显示操作成功！";
			break;
		case "enable":
			$enable_sql="update ls_functioncates set enable=1 where id=".$id." ";
			//echo $enable_sql;
			$enable_query=$opendb->query($enable_sql);
			$ls_msg="显示操作成功！";
			break;
		case "del":
			$del_sql="delete from ls_functioncates where ID=".$id."";
	   		//echo $del_sql;
	   		$del_query=$opendb->query($del_sql);
	  	 	$ls_msg="删除操作成功！";
			writelog($_SERVER['PHP_SELF'],"delete column(function) ","ID: ".$id);
			break;
			
		case "insert":
			$select_sql2="select * from ls_functioncates  where cateName='".trim($cateName)."' and functionName='".$functionName."' ";
			$select_query2=$opendb->query($select_sql2);
			$select_rows2_num=mysql_num_rows($select_query2); //总数
			if($select_rows2_num==0)
			{
				$insert_sql=sprintf("insert into ls_functioncates (fTitle, fKeywords, fDescription, cateName, brief, suffStr, hotLines, hotWords, functionName, typeurl,Num) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",
						GetSQLValueString($newsTitle,"text"),
						GetSQLValueString($newsKeywords,"text"),
						GetSQLValueString($newsDescription,"text"),
						GetSQLValueString($cateName2,"text"),
						GetSQLValueString($brief,"text"),
						GetSQLValueString($suffStr,"text"),
						GetSQLValueString($hotLines,"text"),
						GetSQLValueString($hotWords,"text"),
						GetSQLValueString($functionName2,"text"),
						GetSQLValueString($typeurl, "text"),
						GetSQLValueString($Num, "int")
						);
				
				//echo $insert_sql; brief suffStr
				$insert_query=$opendb->query($insert_sql);
				writelog($_SERVER['PHP_SELF'],"add column(function) ","cateName: ".$cateName." functionName: ".$functionName);
				$ls_msg="添加操作成功！";
			}
			else
			{$ls_msg="分类已存在！";}
			break;
			
	case "modi":
			
			$modi_sql="update ls_functioncates set  Num='".$Num."',suffStr='".$suffStr."',hotLines='".$hotLines."',hotWords='".$hotWords."',brief='".$briefmodi."',typeurl = '".$typeurl."' where id=".$modiid." ";
			
			$modi_sql=sprintf("update ls_functioncates set fTitle=%s, fKeywords=%s, fDescription=%s, Num=%s, suffStr=%s, hotLines=%s, hotWords=%s, brief=%s, typeurl=%s where id=%s",
						GetSQLValueString($newsTitle,"text"),
						GetSQLValueString($newsKeywords,"text"),
						GetSQLValueString($newsDescription,"text"),
						GetSQLValueString($Num,"int"),
						GetSQLValueString($suffStr,"text"),
						GetSQLValueString($hotLines,"text"),
						GetSQLValueString($hotWords,"text"),
						GetSQLValueString($briefmodi,"text"),
						GetSQLValueString($typeurl,"text"),
						GetSQLValueString($modiid,"int")
						);
			$modi_query=$opendb->query($modi_sql);
			
			//全部分类
			$modi_sql="update ls_functioncates set functionName='".$functionName."'  where functionName='".$oldfunctionName."' ";
			//echo $modi_sql;
			$modi_query=$opendb->query($modi_sql);
			//全部子类
			$modi_sql="update ls_functioncates set cateName='".$cateName."'  where cateName='".$oldcateName."' and functionName='".$functionName."'";
			//		echo $modi_sql_article;
			$modi_query=$opendb->query($modi_sql);
			//文章分类
			$modi_sql_article="update ls_article set functionName='".$functionName."'  where functionName='".$oldfunctionName."' ";
			//		echo $modi_sql_article;
			$modi_query=$opendb->query($modi_sql_article);
			//文章子类			
			$modi_sql_article="update ls_article set  cateName='".$cateName."'  where cateName='".$oldcateName."'  and functionName='".$functionName."'";
			//		echo $modi_sql_article;
			$modi_query=$opendb->query($modi_sql_article);


writelog($_SERVER['PHP_SELF'],"modify column(function) "."cateName: ".$cateName." functionName: ".$functionName,"ID: ".$modiid);
			$ls_msg="修改操作成功！";
			break;
	}
	$title_sql = "select * from ls_config";
	$title_query = $opendb->query($title_sql);
	$title_value = mysql_fetch_assoc($title_query);
?>
<!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">
        <script language="JavaScript" src="js/jquery.js"></script>
		<script language="JavaScript" src="js/ls.js"></script>
		<title>无标题文档</title>
	</head>
    
<script>
	function caiji(a){
			
	}


</script>
<link rel="stylesheet" href="kindeditor-4.1.10/themes/default/default.css" />
	<link rel="stylesheet" href="kindeditor-4.1.10/plugins/code/prettify.css" />
	<script charset="utf-8" src="kindeditor-4.1.10/kindeditor.js"></script>
	<script charset="utf-8" src="kindeditor-4.1.10/lang/zh_CN.js"></script>
	<script charset="utf-8" src="kindeditor-4.1.10/plugins/code/prettify.js"></script>
	<script>
   // 修改 brief 的 KindEditor 初始化在secBoard
		
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="brief"]', {
				cssPath : 'kindeditor-4.1.10/plugins/code/prettify.css',
				uploadJson : 'kindeditor-4.1.10/php/upload_json.php',
				fileManagerJson : 'kindeditor-4.1.10/php/file_manager_json.php',
				allowFileManager : true,
				afterBlur: function(){
					this.sync();
					if($('#functionName').val().length >= 0){
						$('#newsDescription2').val($('#fText').val().substr(0, 86).replace(/<[^>]+>/g,'').replace(/	/g, '').replace(/\n/g, ''));
					}
				},
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
				}
			});
			prettyPrint();
		});
	</script>
 <body>
	<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6396d6">
<tr>
				<td height="18" background="images/admin_bg.gif"><div align="center"><font color="#ffffff"><strong>
				  <?=$dispFunctionName?>
				管理</strong></font></div>
			  </td>
			</tr>
			<tr>
				<td height="213" valign="top" bgcolor="#dee7ff"><br />
				  <table width="98%" border="0" align="center">
				  <tr>
				    <td >提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
			      </tr>
				  </table>
				  <?php
					// 获取当前页数
													if( isset($_GET['page']) ){
													   $page = intval( $_GET['page'] );
													}
													else{
													   $page = 1;
													}
													// 每页数量
													$PageSize = $PageNum;
													
													// 获取总数据量
													/********************************************************************************/
						if($selectfunctionName=="")
						{	$sql="select * from ls_functioncates where functionName!='新闻分类' and functionName!='博客分类' and functionName!='常见问题' ";	}
						else
						{
							$sql="select * from ls_functioncates where functionName='".$selectfunctionName."' and functionName!='新闻分类' and functionName!='博客分类' and functionName!='常见问题' ";	
						}
													
														$result=$opendb->query($sql);
													
													/********************************************************************************/
													// 获取总数据量
													
													$row = mysql_num_rows($result);
													$amount = $row;
													
													// 记算总共有多少页
													if( $amount ){
													   if( $amount < $PageSize ){ $page_count = 1; }			   //如果总数据量小于$PageSize，那么只有一页
													   if( $amount % $PageSize ){								  //取总数据量除以每页数的余数
														   $page_count = (int)($amount / $PageSize) + 1;		   //如果有余数，则页数等于总数据量除以每页数的结果取整再加一
													   }else{
														   $page_count = $amount / $PageSize;					  //如果没有余数，则页数等于总数据量除以每页数的结果
													   }
													}
													else{
													   $page_count = 0;
													}
													
													// 翻页链接
													$page_string = '';
														
													if( $page == 1 ){
													   $page_string .= '首页 | 上一页 |';
													}
													else{
													   $page_string .= '<a href=?page=1&selectfunctionName='.$selectfunctionName.'><u><font color=\"#0000FF\">首页</font></u></a> | <a href=?page='.($page-1).'&selectfunctionName='.$selectfunctionName.'><u><font color=\"#0000FF\">上一页</font></u></a> | ';
													}
													if( ($page == $page_count) || ($page_count == 0) ){
													   $page_string .= ' 下一页 | 尾页';
													}
													else{
													   $page_string .= ' <a href=?page='.($page+1).'&selectfunctionName='.$selectfunctionName.'><u><font color=\"#0000FF\">下一页</font></u></a> | <a href=?page='.$page_count.'&selectfunctionName='.$selectfunctionName.'><u><font color=\"#0000FF\">尾页</font></u></a>';
													}
														 $page_string .= " &nbsp;&nbsp;页次：<font color='#FF0000'><b>".$page."</b></font>/<b>".$page_count."</b>页";
														 $page_string .= " &nbsp;&nbsp;<b>".$PageSize."</b>个每页";
														 
													
					
					?>
					
				
				<table border="0" width="96%" align="center">
<tr>
							<td width="91%">栏目选择：
                       <?php
						$article_sql="SELECT distinct(functionName) FROM ls_functioncates   where functionName!='新闻分类' and functionName!='博客分类' and functionName!='常见问题' and functionName!='singlePages' order by Num";//count the error by searchtype
						$article_query=$opendb->query($article_sql);

                          while($news_rows2=mysql_fetch_assoc($article_query))
		  					{
								if($selectfunctionName==$news_rows2['functionName'])
								{echo "<a href='?selectcate=".$news_rows2['cateName']."&selectfunctionName=".$news_rows2['functionName']."'><span style=\"color:#930\" >".$news_rows2['functionName']."</span></a> | ";}
								else
								{echo "<a href='?selectcate=".$news_rows2['cateName']."&selectfunctionName=".$news_rows2['functionName']."'>".$news_rows2['functionName']."</a> | ";}
								
							}
						  ?>
                          <a href='?selectcate='> 全部 </a>
</td>
							<td width="9%" align="right">共 <b><?php echo $row; ?></b> 个分类</td>
					</tr>
					 </table>
			  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr bgcolor="#B9DAFF">
							<td align="center" height="25" width="31">选中</td>
		  <td align="center" height="25" width="35">ID</td>
		  <td  align="center" width="154" ><?=$dispFunctionName?>分类</td>
		  <td  align="center" width="147" >子<?=$dispFunctionName?>分类</td>
		  <td  align="center" width="122" >链接</td>

		  <td  align="center" width="111" >说明</td>
		  <td  align="center" width="42" >标识</td>
		  <td  align="center" width="48" >热点行数</td>
		  <td  align="center" width="48" >热点字数</td>
		  <td width="49" align="center">采集</td>
		  <td width="22" align="center" >修改</td>
		  <td width="91" align="center" >删除</td>
							
		  <td align="center" width="93">允许</td>
				</tr>
		  <?php
		  
		  $functioncates_sql=$sql."order by  Num asc, ID desc limit ". ($page-1)*$PageSize .",".$PageSize." ";	
		  //echo $functioncates_sql;
		  		$functioncates_query=$opendb->query($functioncates_sql);
		  
		  		  	$i=1;
		  		  	while($functioncates_rows=mysql_fetch_assoc($functioncates_query))
		  			 {
		  		  	 ?>
                     <script>
                     				KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="briefmodi<?=$functioncates_rows['ID']?>"]', {
				cssPath : 'kindeditor-4.1.10/plugins/code/prettify.css',
				uploadJson : 'kindeditor-4.1.10/php/upload_json.php',
				fileManagerJson : 'kindeditor-4.1.10/php/file_manager_json.php',
				allowFileManager : true,
				afterBlur: function(){this.sync();},  //必须加，否则不能同步

				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
				}

			});
			prettyPrint();
		});
</script>
                       <tbody id='ZH_<?=$functioncates_rows['ID']?>' >	
		  				<tr bgcolor='#f4f4f4'
		  		  onMouseOver=
		  		  	 	this.style.backgroundColor='#CCFFCC' 
		  		  	onMouseOut=
		  		  	 	this.style.backgroundColor='#f4f4f4' 
		  		  	>
		  		  		<td align='center'>
		  		  			<input name='select_id<?=$i?>' type='checkbox' onclick="unselectall()" id="select_id" value='<?=$functioncates_rows['ID']?>'>
		  		  		</td>
		  		  		<td align='center'>
		  		  	<?=$functioncates_rows['ID']?>
		  		  		</td>
		  		    	<td style='padding-left:10px;'>
		  		    <?=$functioncates_rows['functionName']?>
		  		    	</td>
		  		    	<td style='padding-left:10px;'>
		  		    <?=$functioncates_rows['cateName']?>
		  		    	</td>
		  		    	<td style='padding-left:10px;'><?=$functioncates_rows['typeurl']?></td>
		  		    	<td style='padding-left:10px;'>
		  		    <?=$functioncates_rows['brief']?>
		  		    	</td>
		  		    	<td style='padding-left:10px;'>
		  		    <?=$functioncates_rows['suffStr']?>
		  		    	</td>
		  		    	<td style='padding-left:10px;'>
		  		    <?=$functioncates_rows['hotLines']?>
		  		    	</td>
		  		    	<td style='padding-left:10px;'>
		  		    <?=$functioncates_rows['hotWords']?>
		  		    	</td>
		  		    	<td style='padding-left:10px;'>&nbsp;</td>
			<td align='center'>
				<a href='javascript:secBoard(<?=$functioncates_rows['ID']?>);' title='编辑'><img src='images/b_edit.png' border='0'></a>
		  </td>
		  		  		<td align='center'> 
						<?php
							$article_sql="select * from ls_article where functionName='".$functioncates_rows['functionName']."' and cateName='".$functioncates_rows['cateName']."' and subCateName='".$functioncates_rows['subCateName']."'  ";
							$article_query=$opendb->query($article_sql);
							$article_num = @mysql_num_rows($article_query);
							if($article_num == 0){
						?>
		  		  			<a href='?id=<?=$functioncates_rows['ID']?>&ls=del&functionName=<?=$functionName?>&cateName=<?=$cateName?>&selectfunctionName=<?=$selectfunctionName?>' onclick='return ConfirmDelSubCate();' title='删除'><img src='images/b_drop.png' border='0'></a>
						<?php }else{?>
							<img src='images/b_undrop.png' border='0' title='类别下面有文章，&#10请先删除文章。'>
						<?php }?>
		  		  	  </td>
		  		  		<td align='center'>
		  					  <?
		  		  	  if($functioncates_rows['enable']==1)
		  		  		{
		  		  			?>
		  		  			<a href='?id=<?=$functioncates_rows['ID']?>&ls=unenable&selectcate=<?=$selectcate?>&selectfunctionName=<?=$selectfunctionName?>' title='显示'><img src='images/enable.gif' border='0'></a>
		  		  		<? }
		  		  	  if($functioncates_rows['enable']==0)
		  		  	  	{ ?>
		  		  			<a href='?id=<?=$functioncates_rows['ID']?>&ls=enable&selectcate=<?=$selectcate?>&selectfunctionName=<?=$selectfunctionName?>' title='不显示'><img src='images/unenable.gif' border='0'></a>
                            <? } ?>
		  		  		  		
		  		  		</td>
		  		    </tr>
		  		    		</tbody>
		
		<tbody id='Z_<?=$functioncates_rows['ID']?>' style='display:none;'>
		 <form name='fm_menu<?=$functioncates_rows['ID']?>' action='?ls=modi&page=<?=$page?>&functionName=<?=$functionName?>&selectfunctionName=<?=$selectfunctionName?>' method='post'  > 

			<tr bgcolor='#CCCCCC'>
			<td align='center'>&nbsp;
			</td>
			<td align='center'>&nbsp;
			</td>
				<td style='padding-left:5px;'>
				  <input type='text' value='<?=$functioncates_rows['functionName']?>' name='functionName' size='24' >
			<input type='hidden' value='<?=$functioncates_rows['functionName']?>' name='oldfunctionName' > 
		 		</td>
				<td style='padding-left:5px;'>
				  <input type='text' value='<?=$functioncates_rows['cateName']?>' name='cateName' size='24'  >
			<input type='hidden' value='<?=$functioncates_rows['cateName']?>' name='oldcateName' > 
		 		</td>
				<td style='padding-left:5px;'><input type='text' value='<?=$functioncates_rows['typeurl']?>' name='typeurl'  /></td>
				<td style='padding-left:5px;'>&nbsp;</td>
				<td style='padding-left:5px;'>
					<input type='text' value='<?=$functioncates_rows['suffStr']?>' name='suffStr' size='8' class='inp'>
		 		</td>
				<td style='padding-left:5px;'>
					<input type='text' value='<?=$functioncates_rows['hotLines']?>' name='hotLines' size='8' class='inp'>
		 		</td>
				<td style='padding-left:5px;'>
					<input type='text' value='<?=$functioncates_rows['hotWords']?>' name='hotWords' size='8' class='inp'>
		 		</td>
				<td style='padding-left:5px;'>
					
		 		</td>
		  		<td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
			</tr>
			<tr bgcolor='#CCCCCC'>
            	<td colspan="2">说明：</td>
              <td colspan="7" align='center'>
			    <textarea id="briefmodi<?=$functioncates_rows['ID']?>" name="briefmodi<?=$functioncates_rows['ID']?>" cols="14" class="inp" style="width:100%;height:240px;visibility:;"><?=$functioncates_rows['brief']?></textarea>
			  </td>
              <td colspan='4' rowspan="2" align='center' valign="top">
		  			<table border="0" width="100%">
						  <tr>
						    <td>标题 Title</td>
						    <td><input name="newsTitle" id="newsTitle" type="text" value="<?php echo $functioncates_rows['fTitle'];?>" size="24" /></td>
					      </tr>
						  <tr>
						    <td>关键字 Keywords</td>
						    <td><input name="newsKeywords" id="newsKeywords" type="text" value="<?php echo $functioncates_rows['fKeywords'];?>" size="30" /></td>
					      </tr>
						  <tr>
						    <td>描述 Description</td>
						    <td><textarea name="newsDescription" cols="30" rows="8" id="newsDescription"><?php echo $functioncates_rows['fDescription'];?></textarea></td>
					      </tr>
                          <tr>
						    <td colspan="2" align="center"><input value='<?=$functioncates_rows['ID']?>' name='modiid' type='hidden'>
		  			<input type='submit' value='确定'> &nbsp; 
		  			<input type='button' onclick='javascript:secBoard2(<?=$functioncates_rows['ID']?>)' value='放弃'></td>
					      </tr>
					    </table>
		   	</td>
		   </tr>
			<tr bgcolor='#CCCCCC'>
			  <td colspan="14" align='center'>&nbsp;</td>
		   </tr>

		 </form>
		</tbody>

		  		    
		  		   <? $i++;
		  		   }
		  		   ?>
		  		   	<tr bgcolor="#B9DAFF">
		  		    <td colspan='13' align='center' height='25'>
		  		    <?=$page_string?>
		  		    </td>
		  		    </tr>
					</table>
			  <br />
			  <form action="?ls=insert&amp;selectcate=<?=$selectcate?>&amp;functionName=<?=$functionName?>" method="post" name="addcate" id="addcate" onsubmit="return checkSubmitForm('functionName','栏目');">
			    <br />
			    <table width="98%" border="0" align="center" cellpadding="5" cellspacing="0"  style=" background-color:#D9E4EA">
			      <tr>
			        <td width="24%" height="59" align="center" ><?=$dispFunctionName?>
			          ：                    
	                <input name="functionName2" type="text" id="functionName" size="24" style="width:160px;" onblur="if($('#functionName').val().length > 0){
						$('#newsTitle2').val($('#functionName').val()+' - '+'<?=$title_value['companyName']?>'); 
						$('#newsKeywords2').val($('#functionName').val());
                        $('#newsDescription2').val($('#fText').val().substr(0, 86).replace(/<[^>]+>/g,'').replace(/	/g, '').replace(/\n/g, ''));
					}" /></td>
			        <td width="13%" align="center" >子
			          <?=$dispFunctionName?>
：
<label>
  <input name="cateName2" type="text" id="cateName" size="6" onblur="if($('#functionName').val().length > 0 && $('#cateName').val().length > 0){
						$('#newsTitle2').val($('#cateName').val()+', '+$('#functionName').val()+' - '+'<?=$title_value['companyName']?>'); 
						$('#newsKeywords2').val($('#cateName').val()+', '+$('#functionName').val());
                        $('#newsDescription2').val($('#fText').val().substr(0, 86).replace(/<[^>]+>/g,'').replace(/	/g, '').replace(/\n/g, ''));
					}" />
</label></td>
			        <td width="23%"  >链接：<label>
                        <input name="typeurl" type="text" value="list.php" size="30" />
                    </label></td>
			        <td width="40%" rowspan="2" align="center" >
                    	<table width="90%" border="0" cellpadding="2">
						  <tr>
						    <td width="33%">标题 Title</td>
						    <td width="67%"><input name="newsTitle" id="newsTitle2" type="text" value="" style="width:100%;" /></td>
					      </tr>
						  <tr>
						    <td>关键字 Keywords</td>
						    <td><input name="newsKeywords" id="newsKeywords2" type="text" value="" style="width:100%;" /></td>
					      </tr>
						  <tr>
						    <td>描述 Description</td>
						    <td><textarea name="newsDescription" rows="3" id="newsDescription2" style="width:100%;"></textarea></td>
					      </tr>
					    </table>
                    </td>
		          </tr>
			      <tr>
			        <td width="24%" height="33" align="center" ><span style="padding-left:0px;">
			          <?=$dispFunctionName?>
			          ：
                      <select name="select2" id="select2" style="width:160px;"  onchange="document.addcate.functionName.value=this.options[this.selectedIndex].text;document.addcate.Num.value=this.value;" >
                        <option value="0">请选择栏目：</option>
                        <?
			$news_sql="SELECT distinct functionName FROM ls_functioncates where  functionName!='新闻分类' and functionName!='博客分类' and functionName!='常见问题' and functionName!='singlePages'   order by Num";//count the error by searchtype
			$news_query=$opendb->query($news_sql);
			while($news_rows2=mysql_fetch_assoc($news_query))
		  	{
				$select_sql2="select * from ls_functioncates where functionName='".$news_rows2['functionName']."' ";
				//echo $select_sql2;
				$select_query2=$opendb->query($select_sql2);
				$select_rows2_num=mysql_num_rows($select_query2); //总数
				echo "<option value=".(($select_rows2_num+1)*5).">".$news_rows2['functionName']."</option>";
			}

			?>
                      </select>
			        </span></td>
			        <td align="center" >标识串 
			          ：
                    <input name="suffStr" type="text" id="suffStr" value="_" size="6" /></td>
			        <td >序号：<?
						  	if($selectfunctionName==''){$select_sql2="select * from ls_functioncates ";}
							else
							{$select_sql2="select * from ls_functioncates where functionName='".$selectfunctionName."' ";}
							//echo $select_sql2;
							$select_query2=$opendb->query($select_sql2);
							$select_rows2_num=mysql_num_rows($select_query2); //总数

						?>
                      <input name="Num" id="Num" type="text"  value="<?=($select_rows2_num+1)*5?>" size="1" maxlength="6" />
首页：<input name="hotLines" type="text" id="hotLines" size="1" value="8" />
字数：<input name="hotWords" type="text" id="hotWords" size="1" value="20" /></td>
		          </tr>
			      <tr>
			        <td colspan="4" align="left" style="padding-left:30px" >简介：</td>
		          </tr>
			      <tr>
			        <td colspan="4" align="center" ><label>
			          <textarea name="brief" id='fText' cols="30" style="width:96%;height:300px;visibility:;"></textarea>
			        </label></td>
		          </tr>
                  <tr>
                  <td colspan="4" rowspan="4" align="center" >
			          <input type="submit" name="button" id="button" value="确定" onClick="if($('#functionName').val().length > 0){
						$('#newsTitle2').val($('#cateName').val()+', '+$('#functionName').val()+' - '+'<?=$title_value['companyName']?>'); 
						$('#newsKeywords2').val($('#cateName').val()+', '+$('#functionName').val());
                        $('#newsDescription2').val($('#fText').val().substr(0, 86).replace(/<[^>]+>/g,'').replace(/	/g, '').replace(/\n/g, ''));
					}"  /> &nbsp; 
<input type="reset" name="button2" id="button2" value="重置" />
			          </a></td>
                    </tr>
		        </table>
			    <br />
			    </form>
<br /></td>
			</tr>
	</table>
	<br />
</body>
</html>