#*
//
//	\bh̃ATCʂ̃ATCc[\
//
//		ύX
//			2004.01.08  VK쐬  ؁@qq
//
//	@\
//
//	Assignments̃c[f[^\܂B
//
*#

#parse ( "/view/xmo/Base/CommonJS.vm" )

<script language="javascript">
<!--
	SelectId='';

	rootidpath='[[idpath]]';
	NS4 = (document.layers) ? 1 : 0;
	IE4 = (document.all) ? 1 : 0;
	DOM = (document.getElementById) ? 1 : 0;
	ver4 = (NS4 || IE4 || DOM) ? 1 : 0;

	if (ver4) {
		with (document) {
			write("<STYLE TYPE='text/css'>");
			if (NS4) {
				write(".parent {position:absolute; visibility:visible}");
				write(".child {position:absolute; visibility:visible}");
				write(".regular {position:absolute; visibility:visible}")
			}
			else {
				write(".child {display:none}")
			}
			write("</STYLE>");
		}
	}

	function select(str)
	{

		SelectId=str;

	}

	function getIndex(el) {
		ind = null;
		for (i=0; i<document.layers.length; i++) {
			whichEl = document.layers[i];
			if (whichEl.id == el) {
				ind = i;
				break;
			}
		}
		return ind;
	}

	function arrange() {
		nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height;
		for (i=firstInd+1; i<document.layers.length; i++) {
			whichEl = document.layers[i];
			if (whichEl.visibility != "hide") {
				whichEl.pageY = nextY;
				nextY += whichEl.document.height;
			}
		}

	}

	function initIt(){
		if (!ver4) return;
		if (NS4) {
			for (i=0; i<document.layers.length; i++) {
				whichEl = document.layers[i];
				if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
			}
			arrange();
		}
		else {
			divColl = document.getElementsByTagName("DIV");
			for (i=0; i<divColl.length; i++) {
				whichEl = divColl.item(i);
				if (whichEl.className == "child") whichEl.style.display = "none";
			}
		}
	}


	function expand(GR) {
		var GRChild=GR+"Child";
		var whichEl = getElement(document, GRChild);

		if (!ver4) return;
		if (!NS4) {
			if (whichEl.style.display == "block") {
				whichEl.style.display = "none";
			}
			else {
				whichEl.style.display = "block";
			}
		}
		else {
			whichEl = eval("document." + el + "Child");
			if (whichEl.visibility == "show") {
				whichEl.visibility = "hide";
			}
			else {
				whichEl.visibility = "show";
			}
			arrange();
		}
	}
	onload = initIt;

	function getSubGroup(GR, parendID)
	{
		var strChild1 = new Array();
		var strReplace = GR;
		var groupinfo;
		var GRChild=GR+"Child";
		var innerstr="";
		var thisObj = getElement(document, GRChild);
		var strImgFile = "";
		var intEndImgNum = "";
		if( getElement(document, "name"+GR) != null ) {
			if (!getElement(document, "name"+GR).src.match(/_o.gif/) && 
			!getElement(document, "name"+GR).src.match(/_h.gif/)){
				return;
			}
			//tH_JĂƂ́Az\ɂB

			// c[C[WɕύXB
			if (getElement(document, "name"+GR).src.match(/_o.gif/)){

				strImgFile = getElement(document, "name"+GR).src;
				intEndImgNum = strImgFile.indexOf("_o.gif");
				strImgFile = strImgFile.substr(0,intEndImgNum);
				strImgFile = strImgFile + "_h.gif";
				getElement(document, "name"+GR).src=strImgFile;
				thisObj.style.display = "none";

				return;
			}
		}
		else{
			return;
		}
		

		var strXML =document.WbtApplet.getChildList(parendID);

		strChild1 = SearchChild(strXML);

		if(strReplace=="/")
		{
			strReplace="";
		}
		for (i=1; i<=strChild1.length; i++)
		{
			groupinfo=strChild1[i-1].split(",");
			innerstr=innerstr+getHtml(strReplace+"/"+groupinfo[0], groupinfo, parendID);
		}
		if( innerstr != '' ) {
			thisObj.innerHTML=innerstr;
		}
		strImgFile = getElement(document, "name"+GR).src;
		intEndImgNum = strImgFile.indexOf("_h.gif");
		strImgFile = strImgFile.substr(0,intEndImgNum);
		strImgFile = strImgFile + "_o.gif";
		getElement(document, "name"+GR).src=strImgFile;
		
		if( innerstr != '' ) {
			expand(GR);
		}
	}
	function getHtml(GR,groupinfo,oyaID)
	{
		var nGR="m"+GR;
		var ss=nGR.split("/");
		var parentID = groupinfo[0];
		var gifwidth=(ss.length-2)* tree_indent01 + indent_assign_group;

		// \ACR̎擾s܂
		var iconGif = getIcon( groupinfo[2], groupinfo[3] );

		var htmlStr = "<table cellspacing = '" + icon_pitch + "'cellpadding = '" + icon_pitch + "'><tr><td>";
		htmlStr = htmlStr + "<IMG src='../../../image/xmo/Base/jpn/SPACER.gif' width=" + gifwidth + " height='5'>";
		htmlStr = htmlStr + "</td><td>";
		htmlStr = htmlStr + "<IMG src='" + tree_gif_icon_path + iconGif + "'name='name" +GR+"' onclick=\"getSubGroup('"+GR+"','"+parentID+"'); return false\" class=\"hand\"></td>";
		htmlStr = htmlStr + "<td>" + icon_space + "<font size='" + font_size + "'>" + groupinfo[1] + "</font></td>";
		htmlStr = htmlStr + "</tr></table>";
		htmlStr = htmlStr + "<DIV class=child id="+GR+"Child ></DIV>";
		return htmlStr;
	}

	function getIcon( icon, type ) {
		var iconGif = "";
		//ނ̃ACR擾iReij
		if( type == '0' || type == 'L0' ){
			iconGif = "icon_lo_type_" + type + "_h.gif"
			return iconGif;
		}
		//ReiO
		else{
			//SCO(WBT)ނ̏ꍇ

				iconGif = "icon_lo_type_" + type + "_f.gif"

			return iconGif;
		}
	}
	
	function SearchChild(xml)
	{
		var strXml = new String(xml);	// Safari΍
		var matches = strXml.match(/<child\s.+/g);
		if (matches == null)
			return new Array();
		
		var parts;
		var strTitle;
		var strIconId;
		var strId;
		var strSex;
		
		var children = new Array();

		for (i = 0; i < matches.length; i++)
		{
			strTitle = "";
			strIconId = "";
			strId = "";
			strSex = "";
			
			parts = matches[i].split(/\"/);
			for (j = 0; j < parts.length; j++)
			{
				if (parts[j].match(/title/))
					strTitle = parts[j+1];

				if (parts[j].match(/iconid/))
					strIconId = parts[j+1];
				
				if (parts[j].match(/id/))
					strId = parts[j+1];
					
				if (parts[j].match(/type/))
					strSex = parts[j+1];
			}
			
			children.push(strId + "," + strTitle + "," + strIconId + "," + strSex);
		}
		
		return children;
	}

	function grouphref()
	{
		var selectid=parent.main.selectId;
		var selecttitle=escape(parent.main.selectTitle);
		var parentid=parent.main.parentId;

		if (selectid!="")
		{
			if (selectid.substring(0,2)=="GR"){

				hrefstr='../minilms/ShowPersonMaterial?cmd=GRGR&parentId='+parentid+'&curId='+selectid;
				parent.main.selectId="";
				parent.main.selectTitle="";
				parent.main.parentId="";
				window.open(hrefstr,'','scrollbars=yes,width=600,height=400');

			}
			if (selectid.substring(0,2)=="PE"){

				hrefstr='../minilms/ShowPersonMaterial?cmd=PEGR&parentId='+parentid+'&curId='+selectid;
				parent.main.selectId="";
				parent.main.selectTitle="";
				parent.main.parentId="";
				window.open(hrefstr,'','scrollbars=yes,width=600,height=400');

			}
			if (selectid.substring(0,2)=="CS"){

				hrefstr='../minilms/ShowPersonMaterial?cmd=CSGR&parentId='+parentid+'&curId='+selectid;
				parent.main.selectId="";
				parent.main.selectTitle="";
				parent.main.parentId="";
				window.open(hrefstr,'','scrollbar=yes,width=600,height=400');

			}

			if (selectid.substring(0,2)=="CU"){

				hrefstr='../minilms/ShowPersonMaterial?cmd=CUGR&parentId='+parentid+'&curId='+selectid;
				parent.main.selectId="";
				parent.main.selectTitle="";
				parent.main.parentId="";
				window.open(hrefstr,'','scrollbar=yes,width=600,height=400');

			}

		}
		else{
			parent.location.replace("../minilms/FrameSet?cmd=group");
		}
	}

	function curriculumhref()
	{
		var selectid=parent.main.selectId;
		var selecttitle=escape(parent.main.selectTitle);
		var parentid=parent.main.parentId;


		if (selectid!="")
		{
			if (selectid.substring(0,2)=="GR"){

				hrefstr='../minilms/ShowPersonMaterial?cmd=GRCU&parentId='+parentid+'&curId='+selectid;
				parent.main.selectId="";
				parent.main.selectTitle="";
				parent.main.parentId="";
				window.open(hrefstr,'','scrollbar=yes,width=600,height=400');

			}
			if (selectid.substring(0,2)=="CU"){

				hrefstr='../minilms/ShowPersonMaterial?cmd=CUCU&parentId='+parentid+'&curId='+selectid;
				parent.main.selectId="";
				parent.main.selectTitle="";
				parent.main.parentId="";
				window.open(hrefstr,'','scrollbar=yes,width=600,height=400');

			}

			if (selectid.substring(0,2)=="PE"){

				hrefstr='../minilms/ShowPersonMaterial?cmd=PECU&parentId='+parentid+'&curId='+selectid;
				parent.main.selectId="";
				parent.main.selectTitle="";
				parent.main.parentId="";
				window.open(hrefstr,'','scrollbar=yes,width=600,height=400');

			}
			if (selectid.substring(0,2)=="CS"){

				hrefstr='../minilms/ListAu?cmd=AU&parentId='+parentid+'&curId='+selectid;
				parent.main.selectId="";
				parent.main.selectTitle="";
				parent.main.parentId="";
				window.open(hrefstr,'','scrollbar=yes,width=600,height=400');

			}

		}
		else{
			parent.location.replace("../minilms/FrameSet?cmd=curriculum");
		}
	}


	function changecolor1(id)
	{

		if (getElement(document, id).style.backgroundColor!= 'c2e8fe'){
			getElement(document, id).style.backgroundColor= 'c2e8fe';
		}
		else{
			getElement(document, id).style.backgroundColor= '';
		}
	}

	function changecolor2(id)
	{

		if (getElement(document, id).style.backgroundColor!= ''){
			getElement(document, id).style.backgroundColor= '';
		}
	}
	
	// |bvAbvj[Xg쐬
	function popupDocument(title,strLearnAuthority, strManageAuthority) {
        if (parent.gisSubmit==false) {
        } else {
            return;
        }
		var strXML = "";
		var strTargetWindow = "Function";				//^[Qbg(̏ꍇWindowOpenȂ̂FunctionƋLq)

		if ( strLearnAuthority == "1" && strManageAuthority == "1" ){
			var strTitle = "wKEǗATC";					//j[^Cg
			var strURL = "javascript:parent.function_List.unassign('1','1')";	//s\bh
		}
		else if ( strLearnAuthority == "1" && strManageAuthority == "0" ){
			var strTitle = "wKATC";					//j[^Cg
			var strURL = "javascript:parent.function_List.unassign('1','0')";	//s\bh
		}
		else if ( strLearnAuthority == "0" && strManageAuthority == "1" ){
			var strTitle = "ǗATC";					//j[^Cg
			var strURL = "javascript:parent.function_List.unassign('0','1')";	//s\bh
		}
		else{
			var strTitle = "ATC";					//j[^Cg
			var strURL = "javascript:parent.function_List.unassign('0','0')";	//s\bh
		}

		// Ńj[f[^쐬
		strXML += strTitle + "$";
		strXML += strURL + "$";
		strXML += strTargetWindow + ";";
// ATCύXj[ǉ
		strXML += "ATCύX$";
		strXML += "javascript:parent.function_List.custom_assign_update()$";
		strXML += strTargetWindow + ";";



		//j[Xg쐬܂B
		if(strXML != null && strXML !="" ){
			makeEmbeddedMenu(title,strXML);
		}
	}
	
// -->
</script>

