<?php
include_once("../../common.php");
include_once("../common.php");
//include("../../include/security.php");
$t = mysql_query("select * from {$tpre}blog_cats where parentID=0  order by orderNum desc");
$count = mysql_num_rows($t);
echo "var cats = new Array();";
for($i=1;$i<$count+1;$i++){
    $row = mysql_fetch_array($t);
	$title = $row["title"];
	$ID = $row["ID"];
	echo "cats[".$i."]=new Array();";
	echo "cats[".$i."][0]=\"$ID;".$title."\";";
	echo "var temp = new Array();";
	$t1 = mysql_query("select * from {$tpre}blog_cats where parentID=$ID order by orderNum desc");
	$count1 = mysql_num_rows($t1);
	for($j=1;$j<$count1+1;$j++){
		$row1 = mysql_fetch_array($t1);
		$title1 = $row1["title"];
		$ID1 = $row1["ID"];
		echo "temp[".$j."]=\"$ID1;".$title1."\";";		
	}
	echo "cats[".$i."][1]=temp;";
}
?>