<?
include_once("./_common.php");
include_once("$g4[path]/head.sub.php");

//cart config
$cart_order = "g4_cart_order";
$m_table = "g4_write_shopping";
$cart_table[cart_category] = "g4_cart_category";


$mct        = " ne_1 = '$m_data' ";
$sql        = " select * from {$cart_table[cart_category]} where $mct order by ne_8, wr_id ";
$result     = sql_fetch($sql);

$reply_len = strlen($result[wr_reply]) + 1;

$mct          = " wr_num = '$result[wr_num]' ";
$mct         .= " and length(wr_reply) = '$reply_len' ";

if($sub == '1'){//3차분류값
$mct         .= " and wr_reply LIKE '$result[wr_reply]%' ";
}

$h_sql        = " select * from {$cart_table[cart_category]} where $mct order by ne_8, wr_id ";
$h_result     = sql_query($h_sql);

$total        = mysql_num_rows($h_result);



if($sub == '1'){//3차분류값
?>
<script>
parent.fwrite.wr_23.length = <?=($total)?>;
<?
$i = 0;
while ($gr_row= sql_fetch_array($h_result)){
    ?>
    parent.fwrite.wr_23.options[<?=($i)?>].text =  '<?=$gr_row[wr_subject]?>';
    parent.fwrite.wr_23.options[<?=($i)?>].value = '<?=$gr_row[ne_1]?>';
    <?
    $i++;

}


?>

</script>

<?
}
else{ //2차 분류값
?>

<script>
	//하위분류 리로드
parent.fwrite.wr_22.length = 1;
parent.fwrite.wr_22.options[0].text =  '';
parent.fwrite.wr_22.options[0].value = '';
parent.fwrite.wr_23.length = 1;
parent.fwrite.wr_23.options[0].text =  '';
parent.fwrite.wr_23.options[0].value = '';

parent.fwrite.wr_22.length = <?=($total+1)?>;
parent.fwrite.wr_22.options[0].text =  '선택하세요';
parent.fwrite.wr_22.options[0].value = '';
<?

$i = 1;

while ($gr_row= sql_fetch_array($h_result)){

    ?>
    parent.fwrite.wr_22.options[<?=($i)?>].text =  '<?=$gr_row[wr_subject]?>';
    parent.fwrite.wr_22.options[<?=($i)?>].value = '<?=$gr_row[ne_1]?>';
    <?

    $i++;


}
?>

</script>

<?
}





?>



