<?php
include_once("../../common.php");
include_once("../common.php");
$a1 = mysql_query("select * from {$tpre}blog_cats where parentID=0 order by orderNum desc,title asc");
$searchCount1 = mysql_num_rows($a1);
$opStr = "";
$opCode = "<? \$op_arr = array(";
$catCode = "<? \$cat_arr = array(";
for($i=0;$i<$searchCount1;$i++){
	$row1=mysql_fetch_array($a1);
	$title1 = $row1["title"];
	$ID1 = $row1["ID"];
	if($i!=0){
		$opCode .= ",'$ID1;$title1'=>'$title1'";
		$catCode .= ",'$ID1'=>'$title1'";
	}	
	else{
		$opCode .= "'$ID1;$title1'=>'$title1'";
		$catCode .= "'$ID1'=>'$title1'";
	}		
	$index = $i+1;
	$opStr .= "<option value='blank'>".$index.")  $title1       </option>";
	$opStr .=  "<option value='blank'>---------------------------------------</option>";
	$a2 = mysql_query("select * from {$tpre}blog_cats where parentID=$ID1 order by orderNum desc,title asc");
	$searchCount2 = mysql_num_rows($a2);
	for($j=0;$j<$searchCount2;$j++){
		$row2=mysql_fetch_array($a2);
		$title2 = $row2["title"];
		$ID2 = $row2["ID"];
		$opCode .= ",'$ID2;$title2'=>'$title2'";
		$opStr .=  "<option value='$ID2;$title2'>$title2</option>";
		$catCode .= ",'$ID2'=>'$title2'";
	}
	$opStr .=  "<option value='blank'></option><option value='blank'></option>";
}
$opCode .= ");?>";
$catCode .= ");?>";
echo $opCode.$catCode;	
?>