function drawTree()
{
	
	var filePath = "/site/topics/tree.asp?cu_no=" + document.all.cu_no.value ;
	var target_template;
	var target_template_parent = "1";
	var current_Item_No = 0;
	var current_Version = 0;
	var flag;

	if( document.all.temp_type )
	{
		var temp_type = document.all.temp_type.value;
		switch (temp_type)
		{
			case "44" : flag = 'h';
						target_template = document.all.target_template.value ;
						break;
			case "41" : flag = 'c';
						target_template = document.all.target_template.value ;
						target_template_parent = document.all.target_template.value ;
						break;
			case "42" : flag = 's';
						target_template = document.all.target_template.value ;
						target_template_parent = document.all.target_template_parent.value;
						break;
			default	  :
						if ((document.all.item_no) && (document.all.version))
						{
							current_Item_No = document.all.item_no.value;
							current_Version = document.all.version.value;
							flag	= 'd';	
							target_template = document.all.target_template.value ;
							target_template_parent = document.all.target_template_parent.value;
						}
						else
							return ;	
		}
	}
	else if ((document.all.item_no) && (document.all.version))
	{
		current_Item_No = document.all.item_no.value;
		current_Version = document.all.version.value;
		flag	= 'd';	
		target_template = document.all.target_template.value ;
		target_template_parent = document.all.target_template_parent.value;
	}
	else
		return ;

	filePath += "&flag=" + flag;
	filePath += "&template_id=" + target_template;
	filePath += "&item_no=" + current_Item_No + "&version=" + current_Version; 	
	
	// send an HTTPRequest to save the data on an ASP page
	var objHTTPRequest = new ActiveXObject("MSXML2.XMLHTTP") ;
		objHTTPRequest.open("GET",filePath,false) ; 
	try
	{
			      
		// send the request
		objHTTPRequest.send() ;		
	}
	catch(e)
	{
		alert(e.description);
		return false ;
	}								
	// draw tree html
	if(document.all.relatedTree){
		document.all.relatedTree.innerHTML = objHTTPRequest.responseText ;
		if(document.all.treeRaw)document.all.treeRaw.className = "";
	}
	
}

