<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit, com.novell.emframe.dev.eMFrameUtils" %>
<%   JSPConduit c = JSPConduit.getJSPConduit(request);
   c.stringTable("DevResources"); %>

<HTML>
<HEAD>
   <TITLE><%= c.string("ProductName") %></TITLE>
   <jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
   <jsp:include page='<%= c.getPath("dev/HelpScripts_inc.jsp") %>' flush="true" />

   <SCRIPT>
      var oldButtons = null;

      window.nextButton   = 1;
      window.backButton   = 2;
      window.cancelButton = 4;
      window.finishButton = 8;
      window.closeButton = 16;

      window.nextDisabledButton   = 32;
      window.backDisabledButton   = 64;
      window.cancelDisabledButton = 128;
      window.finishDisabledButton = 256;
      window.closeDisabledButton = 512;

      function setHeader(title, subtitle, helpfile)
      {
         <%/*------------------------------------------------------- */
           /*-- Timing issue: make sure the wizard footer frame   -- */
           /*-- is loaded before we try to set header text        -- */
           /*------------------------------------------------------- */%>
         if(!wizardHeader.document.getElementById("title"))
         {
            var str = "setHeader(\"" + title + "\", \"" + subtitle + "\", \"" + helpfile + "\");";
            //setTimeout(setHeader, 200, title, subtitle, helpfile);
            setTimeout(str, 200);
            return;
         }

         window.helpfile = helpfile;
         wizardHeader.document.getElementById("title").innerHTML = title;
         wizardHeader.document.getElementById("subtitle").innerHTML = subtitle;
         wizardHeader.document.getElementById("helpimage").style.display = (helpfile?"inline":"none");
      }

      function setFooterButtons(buttons)
      {
         <%/*------------------------------------------------------- */
           /*-- Timing issue: make sure the wizard footer frame   -- */
           /*-- is loaded before we try to enable/disable buttons -- */
           /*------------------------------------------------------- */%>
         if(!wizardFooter.document.getElementById("backButton"))
         {
            setTimeout("setFooterButtons(" + buttons + ")", 200);
            return;
         }

         if(oldButtons!=buttons)
         {
            setButton("backButton", buttons&backButton );
            setButton("nextButton", buttons&nextButton );
            setButton("cancelButton", buttons&cancelButton );
            setButton("finishButton", buttons&finishButton );
            setButton("closeButton", buttons&closeButton );

            setButton("backDisabledButton", buttons&backDisabledButton );
            setButton("nextDisabledButton", buttons&nextDisabledButton );
            setButton("cancelDisabledButton", buttons&cancelDisabledButton );
            setButton("finishDisabledButton", buttons&finishDisabledButton );
            setButton("closeDisabledButton", buttons&closeDisabledButton );

            oldButtons = buttons;
         }
      }

      function setButton(buttonName,bDisplay)
      {
         wizardFooter.document.getElementById(buttonName).style.display=(bDisplay>0?"inline":"none");
      }

      function disableButtons()
      {
         setFooterButtons( (oldButtons << 5) | (oldButtons & 1008) );
      }
 
      function doAction(strAction)
      {
         if(typeof wizardBody.handleAction == "function" && wizardBody.handleAction(strAction))
         {
            return;
         }


         if(strAction == "nextButton" || strAction == "finishButton")
         {
            if(typeof wizardBody.isPageValid == "function" && !wizardBody.isPageValid())
            {
               return;
            }
	
            disableButtons();
            wizardBody.document.forms[0].submit();
            
         }
         else if(strAction == "backButton")
         {   //back button was getting disbled, and it should not have been at that place. 
         	//disableButtons();
         	      window.wizardBody.history.go(-1);
         	        <%/* wierd hack;  go back one on NS and to on IE" go(MS4?-2:-1) */%>
         }
         else if(strAction == "cancelButton" || strAction == "closeButton")
         {
            window.location = "webacc?NPService=fw.LaunchService&NPAction=Return&returnID=<%= c.urlEncode(c.var("taskId")) %>";
         }
      }

      function showHelpWindow()
      {
         launchHelp(window.helpfile);
      }

      
   </SCRIPT>

</HEAD>

            <%
   // Old way
   String nextState = (String)request.getAttribute("nextState");
   if(nextState==null || nextState.length()==0)
   {
      nextState = "initialState";
   }

   // New way
   String wizardBodyNextState = (String)request.getAttribute("wizardBodyNextState");
   if(wizardBodyNextState!=null && wizardBodyNextState.length()>0)
   {
      nextState = wizardBodyNextState;
   }
%>


<FRAMESET ROWS="103px,100%,42px" frameborder=0>
    <FRAME name="wizardHeader" SCROLLING=auto src="webacc?taskId=dev.Empty&merge=dev.WizardFrameHeader" marginheight=3 marginwidth=6>
    <FRAME name="wizardBody"   SCROLLING=auto src="webacc?User.context=<%= c.var("User.context") %>&taskId=<%= c.urlEncode(c.var("taskId")) %>&nextState=<%= nextState %>&merge=<%= c.var("wizardBodyMerge") %>" marginheight=0 marginwidth=6>
    <FRAME name="wizardFooter" SCROLLING=auto src="webacc?taskId=dev.Empty&merge=dev.WizardFrameFooter" marginheight=0 marginwidth=6>
</FRAMESET>
</HTML>
