/*------------------------------------------------------------------------------
 Function  : SelectCat1()
 Definition: ´ëºÐ·ù ¼±ÅÃ½Ã ÁßºÐ·ù º¯°æ
 Last Date : 2001.5.4 / Rachel Jung
 Arguments : Object document.form,String "cat1¸Þ½ÃÁö",
			String "cat2¸Þ½ÃÁö"String "cat3¸Þ½ÃÁö",
			boolean "cat3»ç¿ëÀ¯¹«"
 Return    :
 Example   : <select name='cat1' onChange='SelectCat1(this.form,3)'>
------------------------------------------------------------------------------*/
function SelectCat1(form,Msg1,Msg2,Msg3,deptNo,formarg) {
	if ( formarg == null || formarg == "") formarg = "cat";
	var k = 0, selno = eval("form."+formarg+"1.selectedIndex -1");

	if ( Msg1 == "" || Msg1 == null ) Msg1 = "Please select the middle classification.";
	if ( Msg2 == "" || Msg2 == null ) Msg2 = "First select the major division.";
	if ( Msg3 == "" || Msg3 == null ) Msg3 = "First select the middle classification.";

	if ( selno != -1 ) {
		next_select = new Option(Msg1, "", true);
		eval("form."+formarg+"2.options[0] = next_select");
		for(i = 0;i < eval(formarg+"1value[selno].length"); i++) {
			var next_select = new Option(eval(formarg+"1text[selno][i]"), eval(formarg+"1value[selno][i]"), true);
			eval("form."+formarg+"2.options[++k] = next_select");
		}
	} else {
		next_select = new Option(Msg2, "", true);
		eval("form."+formarg+"2.options[0] = next_select");
	}
	eval("form."+formarg+"2.options.length = k+1");

	if ( deptNo != false ) {
		eval("form."+formarg+"3.options[0] = new Option(Msg3, '', true)");
		eval("form."+formarg+"3.options.length = 1");
	}
}
function SelectCat2(form,Msg1,Msg2,Msg3,formarg) {
	if ( formarg == null || formarg == "") formarg = "cat";

	var k = 0;
	selno1 = eval("form."+formarg+"1.selectedIndex -1");
	selno2 = eval("form."+formarg+"2.selectedIndex -1");

	if ( Msg1 == "" || Msg1 == null ) Msg1 = "Select the minor classification.";
	if ( Msg2 == "" || Msg2 == null ) Msg2 = "First select the middle classification.";

	if ( selno2 != -1 ) {
		next_select = new Option(Msg1, "", true);
		eval("form."+formarg+"3.options[0] = next_select");
		if ( eval(formarg+"2value[selno1][selno2]")!=null ) {
			for(i = 0;i < eval(formarg+"2value[selno1][selno2].length"); i++) {
				var next_select = new Option(eval(formarg+"2text[selno1][selno2][i]"), eval(formarg+"2value[selno1][selno2][i]"), true);
				eval("form."+formarg+"3.options[++k] = next_select");
			}
		}
	} else {
		next_select = new Option(Msg2, "", true);
		eval("form."+formarg+"3.options[0] = next_select");
	}
	eval("form."+formarg+"3.options.length = k+1");
}