// When Category changes, populate the designations
/*  var v_list = new String("<%=final_info%>");
	var arr_list= v_list.split("*")
*/


function assign_officer()
{
//get the cateogory code
var sel_cat = new String(document.form1.category.value);
var i=0;
var cur_cat;
var off_list;
var j=0;

//Ignore the sub category i.e. 01a or 01b is treated as 01
sel_cat = sel_cat.substr(0,sel_cat.length)

for(i=0;i<5;i++)
{
for(j=3;j<document.form1.addressedto.length;j++)
		{
			//document.form1.addressedto.options[j]=null;
			document.form1.addressedto.remove(j)
		}
}
		
//alert(sel_cat);
for(i=0;i<arr_list.length;i++)
{
	cur_cat=new String(arr_list[i]);
	cur_cat = cur_cat.substring(0,cur_cat.indexOf(";"))
	//alert(cur_cat);
	if(cur_cat==sel_cat)
	 {
		off_list = new String(arr_list[i])
		off_list = off_list.substr(3)
		//alert(off_list)
		
		off_list = off_list.split(",")
//		alert(off_list[0])
		if(off_list[0]!="")
		{		
		for(j=0;j<off_list.length;j++)
		{
			var opt =  new Option(off_list[j])
			document.form1.addressedto.options[j+1] =opt
			
		}
		}	
	return;
	 }
}
 
}


// *****************************************

function clearall()
{
  var i;
          for(i=0;i<document.form1.elements.length;i++)
    { 
     if(document.form1.elements[i].type=="text")
     document.form1.elements[i].value=""
     else if(document.form1.elements[i].type=="select-one")
     document.form1.elements[i].selectedIndex=0
     else if(document.form1.elements[i].type=="textarea")
     document.form1.elements[i].value=""
    }
  }
