<%@  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");
   c.stringTable("BaseResources"); %>
<HTML>
<HEAD>
<TITLE><%= c.toDisplay(c.string("CreateAttr.Title")) %></TITLE>
<LINK rel="stylesheet" href="<%= c.getModulesUrl() + "/dev/css/hf_style.css" %>" type="text/css">
<jsp:include page='<%= c.getPath("dev/OSScripts_inc.jsp") %>' flush="true" />
<jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
</HEAD>

<!-------------------------JAVA SCRIPT BEGINS HERE------------------------------------------->
<SCRIPT language="JavaScript">

function setFormFocus()
{
   document.EnterAttrBoundsForm.LowerBound.focus();
}

// Check to make sure that user only inputs numbers for IE and Netscape
if (document.captureEvents) document.captureEvents(Event.KEYPRESS);
document.onkeypress=function(e)
{
   if (!e && event) e=
   {
      which:event.keyCode
   };
   if (e.which < 48 || e.which >57)
   {
      if(e.which!=13 && e.which!=0 && e.which!=8 && e.which!=45)
         return false;
   }
}

function previousSelected()
{
   document.EnterAttrBoundsForm.elements["merge"].value="base.CreateAttrFlags";
   document.EnterAttrBoundsForm.elements["nextState"].value="getNewAttrBounds";
   document.EnterAttrBoundsForm.elements["Task.SelectedButton"].value="previousSelected";
   document.EnterAttrBoundsForm.submit();
}

 function nextSelected()
   {
      if (getBounds())
      {
         document.EnterAttrBoundsForm.elements["merge"].value="base.CreateAttrSummary";
         document.EnterAttrBoundsForm.elements["nextState"].value="getNewAttrBounds";
         document.EnterAttrBoundsForm.elements["Task.SelectedButton"].value="nextSelected";
         document.EnterAttrBoundsForm.submit();
      }
   }//end of function
function getBounds()
{
   // Check for number and if not send a message and reset the box.
   // Once it is known that number has been entered. Check to make sure that
   // it is between 0-99999999 or -1-99999999
   // Depending on the type of the attribute, the upper and lower bounds can vary.
   // Ie string's lowerbound should be 0, but an integer lowerbound should be Int.MinValue

   with( document.forms[0] )
   {
      lowerBound = Number(LowerBound.value);
      upperBound = Number(UpperBound.value);
      if ((!LowerBound.value) || (!UpperBound.value))
      {
         alert("<%= c.toScript(c.string("CreateAttr.MustEnterLowerandUpperBounds")) %>");
         return false;
      }
      if (lowerBound < -99999999 || 99999999 < lowerBound)
      {
         alert("<%= c.toScript(c.string("CreateAttr.LowerBoundRangeErr")) %>");
         document.EnterAttrBoundsForm.LowerBound.focus();
         return false;
      }
       if(upperBound < -99999999 || 99999999 < upperBound)
      {
         alert("<%= c.toScript(c.string("CreateAttr.UpperBoundRangeErr")) %>");
         UpperBound.focus();
         return false;
      }
      if ((lowerBound > upperBound) && (upperBound != -1))
      {
         alert("<%= c.toScript(c.string("CreateAttr.LowerBoundErr")) %>");
         return false;
      }
      document.EnterAttrBoundsForm.elements["EnteredLowerBound"].value=lowerBound;
      document.EnterAttrBoundsForm.elements["EnteredUpperBound"].value=upperBound;
      return true;
   }
}

function restore()
{
   if(document.EnterAttrBoundsForm.elements["EnteredLowerBound"].value != "" &&
   document.EnterAttrBoundsForm.elements["EnteredUpperBound"].value != "")
   {
      var lowerbound = document.EnterAttrBoundsForm.elements["EnteredLowerBound"].value;
      var upperbound = document.EnterAttrBoundsForm.elements["EnteredUpperBound"].value;
      document.EnterAttrBoundsForm.LowerBound.value=lowerbound;
      document.EnterAttrBoundsForm.UpperBound.value=upperbound;
      return true;
   }
   document.EnterAttrBoundsForm.LowerBound.focus();
}
</SCRIPT>

<BODY text="#000000" link="#000000" vlink="#000000" alink="#000000" bgcolor="#FFFFFF" onload="setFormFocus(); restore(); " >
<FORM name="EnterAttrBoundsForm" method=post action="webacc">

<!------------------------ BEGIN WEBACCESS VARIABLES ---------------------------->
<INPUT type="hidden" name="error" value="dev.GenErr">
<INPUT type="hidden" name="merge" value="">
<INPUT type="hidden" name="User.context" value="<%= c.var("User.context") %>">
<INPUT type="hidden" name="nextState" value="">
<INPUT type="hidden" name="taskId" value="<%= c.var("taskId") %>">
<INPUT type="hidden" name="Task.SelectedButton" value="">
<INPUT type="hidden" name="EnteredLowerBound" value="<%= c.var("EnteredLowerBound") %>">
<INPUT type="hidden" name="EnteredUpperBound" value="<%= c.var("EnteredUpperBound") %>">
<INPUT type="hidden" name="whichFlags" value="<%= c.var("whichFlags") %>">

<% c.set("WizardHeader.title", c.toDisplay(c.string("CreateAttr.Title")));
   c.set("WizardHeader.helpFile", "base/schemacreate_attr_wizard_flags.html");
   c.set("WizardHeader.instruction", c.toDisplay(c.string("CreateAttr.InstrBounds"))); %>
<jsp:include page='<%= c.getPath("dev/WizardHeader_inc.jsp") %>' flush="true" />

<!------------------------------------- CONTENT TABLE ------------------------------------>

<TABLE border="0" cellspacing="0" cellpadding="2">
   <TR valign="baseline">
      <TD class="mediumtext"><%= c.toDisplay(c.string("CreateAttr.LowerBound")) %></TD>
      <TD class="mediumtext"><INPUT type="text" name="LowerBound" Size="15"></TD>
   </TR>
   <TR valign="baseline">
     <TD class="mediumtext"><%= c.toDisplay(c.string("CreateAttr.UpperBound")) %></TD>
     <TD class="mediumtext"><INPUT type="text" name="UpperBound" Size="15"></TD>
   </TR>
</TABLE>
<BR>

<!------------------------- BUTTON TABLE --------------------------->

<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" >
   <TR>
      <TD><jsp:include page='<%= c.getPath("dev/Bar_inc.jsp") %>' flush="true" /></TD>
   </TR>
   <TR>
      <TD>
         <A HREF="#" onClick="javascript:previousSelected();return false"><IMG src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.Back.image") %>" alt="<%= c.toDisplay(c.string("Button.Back.alt")) %>" title="<%= c.toDisplay(c.string("Button.Back.alt")) %>" border=0></A>
         <A HREF="#" onClick="javascript:nextSelected();return false"> <IMG src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.Next.image") %>" alt="<%= c.toDisplay(c.string("Button.Next.alt")) %>" title="<%= c.toDisplay(c.string("Button.Next.alt")) %>" border=0></A>
         <jsp:include page='<%= c.getPath("dev/Cancel_inc.jsp") %>' flush="true" />
      </TD>
   </TR>
</TABLE>
</FORM>
</BODY></HTML>

