<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit2, com.novell.emframe.dev.eMFrameUtils" %>
<%   JSPConduit2 c = JSPConduit2.getJSPConduit(request); 
     c.stringTable("DevResources"); 
     c.stringTable("FwResources"); %>
<jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
<jsp:include page='<%= c.getPath("dev/MvSel_inc.jsp") %>' flush="true" />

<html>
<head><title>AdvSelCriterion</title>
<style type= "text/css" media="screen">
	#title  {background: #458ab9; position: relative; z-index: 1; width: 100%; visibility: visible }
	.titletext {color:white; font-size: 16px; font-weight: bold; font-family: "Trebuchet MS", Arial, Helvetica, Geneva, Swiss, SunSans-Regular;}
	.bodytext  {color:black; font-size: 12px; font-family: "Trebuchet MS", Arial, Helvetica, Geneva, Swiss, SunSans-Regular; }
</style>
<script>
   var m_htMvsels = Array();
</script>

<script>
   
   
   function launchHelp(helpFile)
   {
      var slashIndex = helpFile.indexOf("/");
      if (slashIndex == -1 || slashIndex == helpFile.length - 1)
      {
         return;
      }
      var module = helpFile.substring(0, slashIndex);
      var page = helpFile.substring(slashIndex + 1, helpFile.length);
      var w=window.open('webacc?taskId=fw.HelpRedirect&merge=fw.GoUrl&module=' + urlEncode(module) + '&page=' + urlEncode(page), "<%= c.string("Help.WindowName") %>", 'toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,width=<%= c.string("Help.WindowWidth") %>,height=<%= c.string("Help.WindowHeight") %>');
      //var w=window.open('webacc?taskId=fw.HelpRedirect&merge=fw.GoUrl&module=' + urlEncode(module) + '&page=' + urlEncode(page));
      if(w != null)
      {
         w.focus();
      }
   }
   
   function showHelpWindow()
   {
      //start off with gui help for as dialog
      launchHelp("fw/advselhelp.html");
   }
   
   //get name of directory-specific help info
   function getDirHelpFileName()
   {
      return (parent.helpFileNameParam);
   }
   
   function changeAuxClasses(mvselName)  
   {
      //get selected aux types and put them in criterion
      var auxTypes = getSelectedItems(mvselName);
      parent.criterion.setAuxTypes(auxTypes);
      
      //rebuild the initialCriterion
      var initialCriterion = parent.buildCriterion();
      
      //recall the AS
      var urlParms = "&AS.InitialCriterion="+urlEncode(initialCriterion);
      urlParms +=    "&AS.Control="+urlEncode(parent.controlParm);
      urlParms +=    "&AS.ControlCallBack="+parent.controlCallBackParm;
      urlParms +=    "&AS.TypeInfoCallBack="+parent.typeInfoCallBackParm;
      urlParms +=    "&AS.HelpFile="+urlEncode(parent.helpFileNameParm);
      var url = 'webacc?taskId=fw.AdvancedSelection&merge=fw.AdvSel&error=dev.GenErr&nextState=initialState&onComplete=close'+urlParms;
      //alert("url = "+url);
      parent.location = url;
   }
</script>

</head>
<body bgcolor="#DFDDD5" onLoad="javascript:top.headerLoaded=true">

<div>
<table class=bodytext style="width:100%" cellspacing=0 cellpadding=0 border=0>
<tr>
   <td style="width:100%">
      <table class=bodytext style="width:100%" cellspacing=0 cellpadding=0 border=0>
      <tr>
         <td><b><nobr><%= c.toDisplay(c.string("AS.Browser.Types")) %>&nbsp;&nbsp;</nobr></b></td>
         <script>
            document.write('<td colspan=2 style="padding-left:4px">');
            for (var i=0; i<parent.m_typeDisplayNames.length; i++)
            {
               document.write(((i>0)?", ":"")+toScript(toTag(parent.m_typeDisplayNames[i])));
            }
            document.writeln('</td>');
         </script>
      </tr>
      <tr>
         <td><b><nobr><%= c.toDisplay(c.string("AS.Browser.AuxTypes")) %>&nbsp;&nbsp;</b></nobr></td>
<%       String mvselImageName = c.getModulesUrl() + "/dev/images/drop_down.gif"; %>
         <td style="width:100%">
            <input style="width:100%; padding-left:3px; background-color:#EFEEE9" type=text id="mvsel1" name="mvsel1" value="" class="bodytext" onKeyDown="mvselReadOnly('mvsel1',event)">
         </td>
         <td style="padding-top:5px">
            <a href="#" onKeyDown="mvselKeyDown('mvsel1',event);" onClick="onListActivation('mvsel1')"><img id="mvsel1btn" src="<%= mvselImageName %>" border=0></a>
            <script>
               m_htMvsels["mvsel1"] = new Array();
               m_htMvsels["mvsel1"][0] = parent.m_allAuxTypeIds;              //vector of all defined aux class ids
               m_htMvsels["mvsel1"][1] = parent.m_auxTypeIds;                 //array of all selected aux class ids
               m_htMvsels["mvsel1"][2] = parent.m_allAuxTypeDisplayNames;     //hashtable of display names
               setupMvsel("mvsel1", (m_htMvsels["mvsel1"][0]), (m_htMvsels["mvsel1"][1]), (m_htMvsels["mvsel1"][2]),"changeAuxClasses");
            </script>
         </td>
      </tr>
      </table>
   </td>
   <td align=right>
      <table class=bodytext style="width:100%; margin-left:10px" cellspacing=0 cellpadding=0 border=0>
      <tr>
         <td>
            <a href="javascript:top.returnCriterion()"><img alt="<%= c.toTag(c.string("Button.OK.alt")) %>" title="<%= c.toTag(c.string("Button.OK.alt")) %>" src="<%= c.getModulesUrl() %>/dev/images/<%= c.toTag(c.string("Button.OK.image")) %>" border=0> </a>
         </td>
      </tr>
      <tr>
         <td>
            <a href="#" onClick="javascript:showHelpWindow();"><img alt="<%= c.toTag(c.string("Button.Help.alt")) %>" title="<%= c.toTag(c.string("Button.Help.alt")) %>" src="<%= c.getModulesUrl() %>/dev/images/<%= c.toTag(c.string("Button.Help.image")) %>" border=0> </a>
         </td>
      </tr>
      </table>
   </td>
</tr>
</table>
</div> 
</body>
</html>