<?
include $_SERVER[DOCUMENT_ROOT] . "/common/conf/config.inc.php";
include $_SERVER[DOCUMENT_ROOT] . "/module/category/category.lib.php";

$cat = $_POST["cat"];
$mode = $_POST["mode"];


switch ($mode) {
	case "getsub":
		if (strlen(trim($cat))) {
			//DB연결
			$dblink = SetConn($_conf_db["main_db"]);

			//카테고리 목록
			$arrList = getCategoryList($cat);

			//DB해제
			SetDisConn($dblink);

			$list = array();

			for($i=0;$i<$arrList["total"];$i++){
				$list[] = $arrList['list'][$i];
			}

			$return = array(
						"success"	=> true,
						"calist"	=> $list,
						);
		} else {
			$return = array(
							"success"	=> false,
							"calist"	=> $list,
							);
		}
		break;
}

echo json_encode($return);
exit;
?>