<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*"%>
<%@ page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*,com.csc.library.report.ReportUDF"  %>

<jsp:useBean id="AS03" class="com.csc.library.system.Task" scope="page"/>
<%
AS03.setChannel(request,response);
UIManager screen = (UIManager) AS03.process("SingleEntry","AS03");
screen.referLangOff();
CscCalendar cs=new CscCalendar();
ReportUDF rp=new ReportUDF();
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../CSS/TISCO.css" rel="stylesheet" type="text/css">
<script  language="JavaScript" src="../JS/SCREEN.js"></script>

<script type='text/javascript' src='../JS/ICONSMENU.js'></script>
<script language='javascript' src='../JS/HOTKEY.js'></script>
<script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>
 
<script language="javascript">
<!--
function GoSave() { 
		with(document.cscform){		
					__assesslist.value=getMyChildaslist(); 
					__astid.value=getMyastype();
					confirmSave(); 
	 }
}
function GoDelete(){ edelete(); }
function GoSearch(){ search(); }
function GoUpdate(){ 
		with(document.cscform){
					__assesslist.value=getMyChildaslist(); 
					__astid.value=getMyastype();
  				    update();  
			}
		}
function checkCF(){ checkConfirm(); }  
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	 beforeChg();
}

function beforeChg(){
var _astype="";
var fixcon="";
         with(document.cscform){
		      for(i=0;i<astype.length;i++){
			           if(astype[i].checked){
							   setbeforeChange(astype[i].value);
							   _astype=astype[i].value;
							   fixcon="asfid='"+__asfid.value+"'"						   
							   break;
					   }
			  }
		 }
	   var   vframe=document.getElementById("viewframe"); 
	   if(fixcon.length>0){
	       vframe.src="AS03_1.jsp?__fixCon="+fixcon+"&_astype="+_astype; 
		   }else{
			vframe.src="AS03_1.jsp"; 		   
		   }
}

function showHelp(page){
	window.open(page,"Help","left=150,top=150,width=700,height=500,toolbar=no,status=no,scrollbars=yes");
}

function showHelp1(page){
    var fixcon="asfid='"+document.cscform.__asfid.value+"'";
	window.open(page+"?__fixCon="+fixcon,"Help","left=150,top=150,width=700,height=500,toolbar=no,status=yes,scrollbars=yes");
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

//------------------------ link to iframe

function getMyChildaslist(){
           return viewframe.setMyaslist(getMyChildoption());
}

function addOption(objOption) 
{
   viewframe.addToOption(objOption,getMyChildoption()) ;
} // End of addOption()

function getMyChildoption(){
		return viewframe.document.forms[0].__asgrouplist;
}

function findKey(objOption,myList){
			return  viewframe.findKey(objOption,myList);
}

function delteOption(){
     viewframe.delteOption(viewframe.document.cscform.__asgrouplist);
}
//-----------------------------------------

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function getMyastype(){
		with(document.cscform){
		       for(i=0;i<astype.length;i++){
			    		if(astype[i].checked){
						      return astype[i].value;
							  break;
						}
			   }
		}
}

function onMychange(obj){
	   var fixcon="";
	        viewframe.document.cscform.__fixCon.value="asfid='"+obj.value+"'"
			viewframe.document.cscform._astype.value=obj.value;
			if(( viewframe.document.cscform.__asgrouplist.options.length)>0){
					bCon=confirm("ต้องการเปลี่ยนประเภทคำตอบหรือไม่?\nคำเตือน !!!!! ข้อมูลทะเบียนแบบฟอร์มประเมินผล อาจสูญหายได้");
					if(bCon){
					setbeforeChange(obj.value);
					viewframe.document.cscform.submit();
					}else{
						with(document.cscform){
										astype[__beforechg.value].checked=true; 
						 }
					}
			}
}

function setbeforeChange(objVal){
            document.cscform.__beforechg.value=objVal;
}

//-->
</script>

</head>
<body leftmargin="0" topmargin="0" onLoad="MM_preloadImages('../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif')">
<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
<script language="javascript">initToolTips();</script>
  <form name="cscform" method="post">
 

<!----------BEGIN CSC INITIAL ZONE ------------------------>

<%=screen.InitialVariable()%>

<!----------END CSC INITIAL ZONE -------------------------->

    <script language="JavaScript">checkCF();</script>
   <input type="hidden"name="__screen"  value="AS03">
  <input type="hidden" name="__help" value="">
  <input type="hidden" name="__cmd"  value="">
   <input type="hidden" name="__language" value ="<%=screen.getUProfile().get("lang")%>"> 
  <input type="hidden" name="__fixCon" value="">
  <input type="hidden" name="__astid" value="<%=screen.getDataLabel("astid")%>">
  <input name="__notNull" type="hidden" value="<%=screen.getRequire()%>">
  <input name="__companyid" type="hidden" value="<%=screen.getUProfile().get("companyid")%>">
  <input type="hidden" name="__ascreateby" value="<%=screen.getUProfile().get("user")%>" >
  <input type="hidden" name="__ascreatedate" value="<%=cs.getDDMMYYYY()%>">
  <input type="hidden" name="__assesslist" value="">
  <input type="hidden" name="__beforechg" value="">

  <script language="JavaScript">document.write(Icons());</script>  
  <br>
  <div align="center">
    <table  cellpadding="0"  cellspacing="0">
      <tr > 
        <td  class="header">AS03,
          <script language="javascript">swapLang('Asform Table Table');</script>
        &nbsp;</td></tr>
      <tr > 
        <td  colspan="2"> 
          <div align="center">
            <table class="largest" width="98%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="87">&nbsp;</td>
                <td width="540">&nbsp;</td>
              </tr>
              <tr> 
                <td class="columnlabel_baseline"><div align="right"><%=screen.getLabel("asfid")%>&nbsp;</div></td>
                <td><%=screen.getInput("asfid")%>
                </td>
              </tr>
              <tr> 
                <td class="columnlabel_baseline"><div align="right"><%=screen.getLabel("tdesc")%>&nbsp;</div></td>
                <td><%=screen.getInput("tdesc")%></td>
              </tr>
              <tr> 
                <td class="columnlabel_baseline"><div align="right"><%=screen.getLabel("edesc")%>&nbsp;</div></td>
                <td><%=screen.getInput("edesc")%></td>
              </tr>
              <tr> 
                <td class="columnlabel_baseline"><div align="right"><%=screen.getLabel("astid")%>&nbsp;</div></td>
                <td nowrap class="columnlabel_baseline_left"> <input name="astype" type="radio" value="0"  onClick="onMychange(this);"  <% if(screen.getDataLabel("astid").equals("0")) out.print("checked");%>>  
                  <%=rp.getSystemCode("Asstype",screen.getUProfile().get("lang"),"0")%> 
                  <input type="radio" name="astype" value="1" onClick="onMychange(this);"   <% if(screen.getDataLabel("astid").equals("1")) out.print("checked");%>> <%=rp.getSystemCode("Asstype",screen.getUProfile().get("lang"),"1")%> 
                  <input type="radio" name="astype" value="2" onClick="onMychange(this);"   <% if(screen.getDataLabel("astid").equals("2")) out.print("checked");%>> <%=rp.getSystemCode("Asstype",screen.getUProfile().get("lang"),"2")%> 
                  <input type="radio" name="astype" value="3" onClick="onMychange(this);"  <% if(screen.getDataLabel("astid").equals("3")) out.print("checked");%>> <%=rp.getSystemCode("Asstype",screen.getUProfile().get("lang"),"3")%></td>
              </tr>
              <tr> 
                <td class="columnlabel_baseline"><div align="right"><%=screen.getLabel("asfmemo")%>&nbsp;</div></td>
                <td><%=screen.getInput("asfmemo")%></td>
              </tr>
              <tr> 
                <td colspan="2"  class="blankspace">&nbsp;</td>
              </tr>
              <tr> 
                <td colspan="2" >&nbsp;&nbsp; <script language="javascript">swapLang('Asform Group Table Table');</script> 
                  <a href="javascript:showHelp('AS03HELP_2.jsp');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image43','','../IMAGES/BUTTON/SWAP/NEW_SWAP20.gif',1)"><img SRC="../IMAGES/BUTTON/MAIN/NEW20.gif" alt="เพิ่มกลุ่มหัวข้อประเมินผล" width="20" height="20" border="0" align="absmiddle" id="Image43"></a><a href="javascript:delteOption();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image442','','../IMAGES/BUTTON/SWAP/DEL_SWAP20.gif',1)"><img SRC="../IMAGES/BUTTON/MAIN/DEL20.gif" alt="ลบกลุ่มหัวข้อประเมินผล" width="20" height="20" border="0" align="absmiddle" id="Image442"></a><a href="javascript:showHelp1('AS03HELP_4.jsp');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4443','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img SRC="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="รายการหัวข้อประเมินผลที่เลือก" width="20" height="20" border="0" align="absmiddle" id="Image4443"></a></td>
              </tr>
              <tr> 
                <td colspan="2"><iframe id="viewframe" width="100%"  height="230" align="center" src=""></iframe></td>
              </tr>
              <tr> 
                <td colspan="2" class="blankspace">&nbsp;</td>
              </tr>
              <tr> 
                <td colspan="2"><div align="center"></div></td>
              </tr>
              <tr> 
                <td colspan="2"  class="blankspace">&nbsp;</td>
              </tr>
            </table>
          </div></td>
      </tr>
      <tr bordercolor="0069B3"> 
        <td  class="bottom"></td>
      </tr>
    </table>
  </div>


<!----------BEGIN CSC ENDING ZONE ------------------------>

<%=screen.endJSP()%>

<!----------END CSC ENDING ZONE -------------------------->

</form>
</body>
</html>
