<%@  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"); %>

<HTML>
<HEAD>
<TITLE>SelectedObjectsTitle</TITLE>
<LINK href="<%= c.getModulesUrl() %>/fw/css/osStyles.css" rel="styleSheet" type="text/css">
<jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
<script>

   // global array of selected objects
   var selectedObjects = new Array();
   var soHashTable = new Array();
   
   function isAnObjectSelected()
   {
      var ret=false;
      for (i=0; i<selectedObjects.length; i++)
      {
         if (selectedObjects[i]!=null)
         {
            //found a selected object
            ret = true;
            break;
         }
      }
      return ret;
   }     
   
   function doDeselectObject(idx)
   {
      if (idx>=0 && idx<selectedObjects.length && selectedObjects[idx]!=null)
      {
         soHashTable[selectedObjects[idx][0]] = null;  // delete hash table entry
         selectedObjects[idx] = null;                  // delete object
         displaySelectedObjects();
      }
   }
   
   function clearAllSelections()
   {
      selectedObjects = new Array();   // clear out global array
      soHashTable = new Array()        // clear out hash table
      displaySelectedObjects();
      top.SelectedObjectsButtons.enableButtons(false);
   }
   
   function getAuxIcon(entry)
   {
      var auxIcon="";
      var sDA=entry[4];
      var bPartition=false;
      var bAlias=false;
      if (sDA!=null && sDA.length==4)
      {
         bPartition=(sDA.charAt(2)=="P");
         bAlias=(sDA.charAt(3)=="A");
      }
      
      if (bPartition && bAlias)  auxIcon = "aliaspart.gif";
      else if (bAlias)           auxIcon = "alias.gif";
      else if (bPartition)       auxIcon = "partition.gif";
      else                       auxIcon = "7px_spacer.gif";
      return auxIcon;
   }
   
   function displaySelectedObjects()
   {
      var imagePath = "<%= c.getModulesUrl() %>";
      var s;
      var numSelected = 0;
      top.SelectedObjects.document.open();
      top.SelectedObjects.document.writeln('<HTML><HEAD><TITLE>SelectedObjects</TITLE>');
      top.SelectedObjects.document.writeln('<LINK href="'+imagePath+'/fw/css/osStyles.css" rel="styleSheet" type="text/css"></HEAD>');
      if (MS55)
         top.SelectedObjects.document.writeln('<BODY bgcolor="#FFFFFF" style="border-style:solid; border-width:1; border-bottom-width:0; border-color:#BFBBB2;" onFocus="top.ensureOpenerValid();" onDragStart="top.iman.cancelEvent(event)">');
      else
         top.SelectedObjects.document.writeln('<BODY bgcolor="#FFFFFF" onFocus="top.ensureOpenerValid();">');
      top.SelectedObjects.document.writeln('<table cellpadding=0 cellspacing=0>');
      for (var i=selectedObjects.length-1; i>=0; i--)
      {
         if (selectedObjects[i] != null)
         {
            numSelected++;
            top.SelectedObjects.document.writeln("<tr>");
            top.SelectedObjects.document.writeln("   <td><nobr>");
            top.SelectedObjects.document.writeln('   <A href="#" onClick="javascript:top.SelectedObjectsTitle.doDeselectObject('+i+');return false"></A><img alt="<%= c.toTag(c.string("OS.Browser.UnselectHint")) %>" title="<%= c.toTag(c.string("OS.Browser.UnselectHint")) %>" src="'+imagePath+'/dev/images/dir/'+selectedObjects[i][2]+'" border=0><img alt="<%= c.toTag(c.string("OS.Browser.UnselectHint")) %>" title="<%= c.toTag(c.string("OS.Browser.UnselectHint")) %>" src="'+imagePath+'/fw/images/'+getAuxIcon(selectedObjects[i])+'" border=0></A>');
            top.SelectedObjects.document.writeln('   <A href="#" title="<%= c.toTag(c.string("OS.Browser.UnselectHint")) %>" onClick="javascript:top.SelectedObjectsTitle.doDeselectObject('+i+');return false"><FONT face="Helvetica,Arial" size=-2>'+toDisplay(selectedObjects[i][0])+'<BR></FONT></A>');
            top.SelectedObjects.document.writeln("   </nobr></td>");
            top.SelectedObjects.document.writeln("</tr>");
         }
      }
      top.SelectedObjects.document.writeln('</table>');
      top.SelectedObjects.document.writeln('</body></html>');
      top.SelectedObjects.document.close();
      
      top.SelectedObjectsButtons.enableButtons(isAnObjectSelected());
      
      document.getElementById("numSelected").innerHTML=" "+numSelected;
   }
   
</script>
</HEAD>

<script>document.writeln('<body bgcolor="'+top.OS_BGCOLOR+'" onLoad="javascript:top.osTitleLoaded=true" onFocus="top.ensureOpenerValid();">');</script>
<div style="width:100%;position:absolute;top:12;">
<table height="100%" width="100%" cellspacing=0 cellpadding=0>
<tr>
<td align=left valign=center>
   <table border=0 cellspacing=0 cellpadding=0>
   <tr>
   <td class=head2 align=left valign=center>
   <nobr><%= c.toDisplay(c.string("OS.Browser.SelectedObjects")) %>&nbsp;<span id=numSelected style="font-size:11">0</span></nobr>
   </td>
   <td class=smalltext  align=left valign=center>
   <nobr>&nbsp;&nbsp;&nbsp;<%= c.toDisplay(c.string("OS.Browser.ClickToUnselect")) %></nobr>
   </td>
   </tr>
   </table>
</td>
</tr>
</table>
</div>
</body>  
</HTML>
