Subject: Help Please
Posted By: Beerman3436 Post Date: 8/16/2006 10:02:49 AM
I have navigation buttons (First, Next, Previous, Last) on the top of my page to scroll through the database records. I can't get them to work. Can anyone look at the code and help me please?

[CODE]
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="ROBOTS" content="noindex,nofollow" >
<!--#include file="includes/connection.asp"-->
<script language="JavaScript" src="includes/date-picker.js"></script>
<script language="JavaScript" src="includes/calendar2.js"></script>
<TITLE>SMSe Information</TITLE>
</HEAD>
<STYLE TYPE="text/javascript">
classes.Sans.all.fontFamily = "MS Sans Serif"
classes.Sans.all.fontSize = "10pt"
</STYLE>
<SCRIPT LANGUAGE="JavaScript" src="includes/md5.js"></SCRIPT>
<%
lcASPFile = Right( Request.ServerVariables( "URL" ), Len(Request.ServerVariables( "URL" )) - InStrRev( Request.ServerVariables( "URL" ), "/" ))
cVersion = "LIVE VERSION 1.0.13"
if UCase( Left( lcASPFile, 4 )) = "BETA" then
    cVersion = Replace( cVersion, "LIVE", "BETA" )
end if
lcOrigRqst = Request.QueryString()
lnEmpID = session("emp")
lcLogin = Request.QueryString("login")
lcQHash = Request.QueryString("hash")
lcSetHash = Request.QueryString("sethash")
lcNewPass = Request.QueryString("newpassword")

set rsGet = Server.CreateObject("ADODB.Recordset")
set rsGet.ActiveConnection = oConn
rsGet.CursorType = 3
%>
<SCRIPT LANGUAGE="JavaScript">
function OpenReport( pcSearch ) {
  windowName = 'SMSe Post Information' ;
  newURL = location.protocol + "//" + location.hostname + "/SMSe/smse_info.asp?wo=" + pcSearch ;
  oldURL = "http://fse.ds.state.gov/smse/smse_info.asp?wo=" + pcSearch
  newWindow= window.open( newURL );    
  newWindow.focus();
}

function SwapImage( poImage, pcImageFile ) {
  poImage.src = pcImageFile ;
}

function openSearch( pcSearchText ) {
alert( pcSearchText );
  if ( pcSearchText.length > 0 )
    window.location = location.protocol + "//" + location.hostname + "/SMSe/smse_info.asp?doit=search&text=" + pcSearchText ;
  else
    alert( "The search you have requested will pull in too many records, please narrow your search by entering part of the work order number into the search box." );
}

function openWindow(contentURL,criteria,windowName,windowWidth,windowHeight) {
    var winl = (screen.width - windowWidth) / 2;
    var wint = (screen.height - windowHeight) / 2;
    var cAddURL = "" ;

    winProps = 'height=' + windowHeight + ',width=' + windowWidth + ',top=' + wint + ',left=' + winl + ',scrollbars=Yes,resizable=Yes,menubar=Yes';
    for ( x = 0; x < criteria ; x++ ) {
        var cVal = eval( "document.ReportForm.criteria" + (x+1) + ".value" );
        if ( x == 0 )
            cAddURL = cAddURL +  '?criteria' + (x+1) + '=' + cVal ;
        else
            cAddURL = cAddURL +  '&criteria' + (x+1) + '=' + cVal ;
    }
    var cOpenWin = contentURL + cAddURL ;
    newWindow = window.open(cOpenWin,windowName,winProps);
    if (parseInt(navigator.appVersion) >= 4) { newWindow.window.focus(); }
}

function wwrite( wtext ) {
  document.writeln( wtext );
}

function SwapImage( poImage, pcImageFile ) {
  poImage.src = pcImageFile ;
}

function CheckLogin( oLogin, oPassword ) {
   var cEncrPs =  hex_hmac_md5( this.login.value, this.password.value );
   var cLogin =  this.login.value;
   window.location = location.protocol + "//" + location.hostname + location.pathname +  "?login=" + cLogin + "&hash=" + cEncrPs;
 }

function DoAction( cURL ) {
    var cFind = document.StatusForm.find.value ;

    if ( cFind.length > 0 )
       window.location = location.protocol + "//" + location.hostname + location.pathname +  "?" + cURL + "&find=" + cFind;
    else
       window.location = location.protocol + "//" + location.hostname + location.pathname +  "?" + cURL;
}

function GetReport( cURL ) {
    var nReport = this.reportname.value ;

    window.location = location.protocol + "//" + location.hostname + location.pathname +  "?" + cURL + "&find=" + nReport;
}

function GetWO( cURL ) {
    var nWO = this.workorder.value ;

    window.location = location.protocol + "//" + location.hostname + location.pathname +  "?" + cURL + "&find=" + nWO;
}

function ApplyDataMod( pcInsType ) {
    document.MaintForm.doit.value = pcInsType ;
    document.MaintForm.submit();
}

function Reposition( cURL ) {
    var nFilter = this.filterid.value ;

    if ( nFilter.length > 0 && nFilter > 0 ) {
       if ( typeof cURL == "doit=search" || cURL == "doit=status" )
          window.location = location.protocol + "//" + location.hostname + location.pathname +  "?filterid=" + nFilter;
       else
          window.location = location.protocol + "//" + location.hostname + location.pathname +  "?" + cURL + "&filterid=" + nFilter;
       }
    else
       window.location = location.protocol + "//" + location.hostname + location.pathname +  "?" + cURL;
}

function EditWORepos( cURL ) {
    var cText = this.editsearch.value ;

    if ( cText.length > 0 )
       window.location = location.protocol + "//" + location.hostname + location.pathname +  "?" + cURL + "&text=" + cText;
    else {
    window.location = location.protocol + "//" + location.hostname + location.pathname +  "?" + cURL;
    }
}

function VerifyLogin( cHash, cVerify ) {
   if ( cHash == cVerify )
       window.location = location.protocol + "//" + location.hostname + location.pathname +  "?login=<%=lcLogin%>&sethash=" + cHash;
 }

function ValidatePost( pcFormName ) {

  var cPostID = document.forms[ pcFormName ].elements['postid'].value ;
  var cPostName = document.forms[ pcFormName ].elements['PostName'].value ;
  var cRouterIP = document.forms[ pcFormName ].elements['Router_IP'].value ;
  var cCountry = document.forms[ pcFormName ].elements['country'].value ;
  if ( cPostID == 0 || cPostID == "" )
    alert( "You must select the post." )
  else
    if ( cPostName == 0 || cPostName == "" )
        alert( "You must select a Post." )
    else
        if ( cRouterIP == 0 || cRouterIP == "" )
            alert( "You must select the Router IP." )
        else
            if ( cCountry == "undefined" || cCountry == "" )
                alert( "You must specify the Country.")
            else
                    document.forms[ pcFormName ].submit();
}
</SCRIPT>

<%
set oCmd = Server.CreateObject("ADODB.Command")
set oCmd.ActiveConnection = oConn
cMsg = ""
if Len( session( "emp" )) > 0 AND Len( lcLogin ) = 0 AND Not isEmpty( session("emp")) then
    call InterfaceForm( cMsg )
else
    if Len( lcLogin ) > 0 then
        lcSQL_UPDATE = ""
        lcUserSQL = "SELECT tblUsers.* FROM tblUsers WHERE tblUsers.Inactive = 0 and Locked = 0 and UserName = '" & lcLogin & "'"
        set rsVerify = oConn.execute( lcUserSQL )
        if not rsVerify.eof then
            lcHash = rsVerify("Hash")
            if Len( lcSetHash ) > 0 then
                lcSQL_UPDATE = "UPDATE tblUsers SET hash = '" & lcSetHash & "' WHERE UserName = '" & lcLogin & "'"
                session("emp") = rsVerify( "UserID" )
                If rsVerify( "isAdmin" ) then
                    session("isadmin") = "On"
                End if
                session("emp") = rsVerify( "UserID" )
                call InterfaceForm( cMsg )
            else
                if Len( lcHash) = 0  or lcNewPass = 1 then
                    call PasswordForm( cMsg )
                else
                    if ( lcQHash <> rsVerify( "Hash" )) or ( lcLogin <> rsVerify( "UserName" )) then
                        lnAttempts = rsVerify( "Attempts" ) + 1
                        if lnAttempts >= 3 then
                            lcSQL_UPDATE = "update tblUsers set locked = 1, attempts = " & lnAttempts & " where userid = " & rsVerify("UserID")
                            cMsg = "Login Account has been Locked!"
                            call LoginForm( cMsg )
                        else
                            lcSQL_UPDATE = "update tblUsers set attempts = " & lnAttempts & " where userid = " & rsVerify("UserID")
                            cMsg = "Invalid Authentication..."
                            call LoginForm( cMsg )
                        end if
                    else
                        ldDate = FormatDateTime( Now(), vbGeneralDate )
                        lcSQL_UPDATE = "update tblUsers set lastlogin = '" & ldDate & "', attempts = 0 where userid = " & rsVerify("UserID")
                        If rsVerify( "isAdmin" ) then
                            session("isadmin") = "On"
                        Else
                            session("isadmin") = "Off"
                        End if
                        lnEmpID = rsVerify( "UserID" )
                        session("emp") = rsVerify( "UserID" )
                        call InterfaceForm( cMsg )
                    end if
                end if
            end if
        else
            cMsg = "Invalid Authentication...Unable to Locate User Profile"
            call LoginForm( cMsg )
        end if
    else
        call LoginForm( cMsg )
    end if
    if Len( lcSQL_UPDATE ) > 0 then
        oCmd.CommandText = lcSQL_UPDATE
        oCmd.CommandType = 1
        oCmd.Execute()
    end if
    set oCmd = nothing
    lcSQL_UPDATE = ""
    if Len( lcSQL_UPDATE ) > 0 then
        oCmd.CommandText = lcSQL_UPDATE
        oCmd.CommandType = 1
        oCmd.Execute()
    end if
    set oCmd = nothing
end if

Sub MaintHeader( pcTitle, pcIDFieldName, plUpdateID, pcSQL, pcDisplayField )
%>              <TBODY>
              <TR>
                
  <TD colspan=2 class="content-headingCell"><Font style='font size:14px'><B>&nbsp;-
    <%=pcTitle%> - </FONT></TD>
              </TR> <%
'    Using the navigation buttons at the top of the form, move to the indicated record. -Position RecordSet-
    lcShell = "doit=maint" & chr(asc("&")) & "sact=" & Request.QueryString( "sact" )
    lcCurID = Request.QueryString("curid")
    lcFindID = Request.QueryString("find")
    if Len( lcCurID ) = 0 and Len( lcFindID ) > 0 then
        lcCurID = lcFindID
    end if
    lcPosition = Request.QueryString("pos")
    lcQuery = Request.QueryString()

    rsGet.Open pcSQL
    if not rsGet.eof then
        if Len( lcCurID ) > 0 then
            llCycle = true
            lnRCnt = 1
            do
                lnValue = rsGet( pcIDFieldName )
                if lnValue = CLng(lcCurID) then
                    llCycle = false
                else
                    rsGet.MoveNext
                    lnRCnt = lnRCnt + 1
                end if
                if rsGet.Eof then
                    llCycle = false
                end if
            loop while llCycle
            if lcPosition = "first" then
                rsGet.MoveFirst
            else if lcPosition = "last" then
                rsGet.MoveLast
                else if lcPosition = "next" and lnRCnt+1 <= rsGet.RecordCount then
                    if not rsGet.EOF then
                        rsGet.MoveNext
                    end if
                    else if lcPosition = "previous" and lnRCnt-1 > 0 then
                            if not rsGet.BOF then
                                rsGet.MovePrevious
                            end if
                        end if
                    end if
                end if
            end if
            lcCurID = CStr( rsGet( pcIDFieldName ))
        end if
%>    <tr>
      <td align='right' colspan=2><TABLE border=0><TR><TD>
<%
        if rsGet.RecordCount > 1 then
            set rsSearch = Server.CreateObject("ADODB.Recordset")
            set rsSearch.ActiveConnection = oConn
            rsSearch.CursorType = 1
            rsSearch.Open pcSQL
            lnRecSz = rsSearch.RecordCount
%>
    <B>Search:  </B><SELECT name="find"  onChange="Reposition( '<%=lcShell%>&curid=' + this.value );" style="font size:11px"> <%
            nRecordBefore = 0
            do until rsSearch.eof
%>        <OPTION value='<%=rsSearch( pcIDFieldName )%>' <%
                if lcCurID = CStr( rsSearch( pcIDFieldName )) then
        %> SELECTED <%
                    nRecordBefore = nPrev
                end if
                if ( pcDisplayField = "PostName" ) then
                    if ( rsSearch( "Inactive" ) = true ) then
        %> DISABLED style="font-size:11px; color:#7f7f7f"<%
                    else
        %> style="font-size:11px; color:#000000" <%
                    end if
                end if %>><%=rsSearch( pcDisplayField )%></OPTION> <%
                nPrev = rsSearch( pcIDFieldName )
                rsSearch.MoveNext
            loop %>
      </SELECT><INPUT TYPE="HIDDEN" name="prevrecid" value="<%=nRecordBefore%>">
<%            rsSearch.Close
            Set rsSearch = nothing
        end if
        cAddCall = chr(asc("&")) & "curid=" & rsGet( pcIDFieldName ) & chr(asc("&")) & "pos=" %>
        <input type="button" name="Submit" value="&lt;&lt;" title="First Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>first')">
        <input type="button" name="Submit2" value="&lt;" title="Previous Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>previous')">
        <input type="button" name="Submit3" value="&gt;" title="Next Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>next')">
        <input type="button" name="Submit4" value="&gt;&gt;" title="Last Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>last')"></td></tr></table></td>
    </tr>
    <TR>
        <TD align="left"><input type="hidden" name="hiddenID" value="<%=rsGet( pcIDFieldName )%>">
    </TD></TR>
<%
    else %>
    <tr>
      <td align='right' colspan=2><TABLE border=0><TR><TD>
        <input type="button" name="Submit" value="&lt;&lt;" title="First Record" onClick="" DISABLED>
        <input type="button" name="Submit2" value="&lt;" title="Previous Record" onClick="" DISABLED>
        <input type="button" name="Submit3" value="&gt;" title="Next Record" onClick="" DISABLED>
        <input type="button" name="Submit4" value="&gt;&gt;" title="Last Record" onClick="" DISABLED></td></tr></table></td>
    </tr>
    <TR>
        <TD align="left"><input type="hidden" name="hiddenID" value="1">
    </TD></TR>
<%
    end if
End Sub

Sub MaintFooter( pcSQL, pcMatchText, pcMatchField, pcIDField, pcInsertType, plRemap )
' Delete Option Controlled through parameter pcInsertType. If field starts with "del", not "ins" the delete option will enable
if Left( pcInsertType, 3 ) = "del" then
    lcDeleteType = pcInsertType
    pcInsertType = Replace( pcInsertType, "del", "ins" )
else
    lcDeleteType = ""
end if
if plRemap = true then
    lcRemap = Replace( pcInsertType, "ins", "remap" )
%>    <TR valign="center">
        <TD colspan=2><HR></TD></TR>
    <TR valign='bottom'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Remap to:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><SELECT name='postid' style="font size:11px"> <%
        set rsMatch = oConn.execute( pcSQL )
        Do until rsMatch.eof
            if pcMatchText <> rsMatch( pcMatchField ) then %>
                <OPTION value='<%=rsMatch( pcIDField ) %>'><%=rsMatch( pcMatchField ) %></OPTION> <%
            end if
            rsMatch.movenext
        Loop
        rsMatch.close
        Set rsMatch = nothing
%>            </SELECT>&nbsp;&nbsp;&nbsp;<input type='Checkbox' name='remap'><Font face='Arial, Helvetica, sans-serif'  style="font size:11px">&nbsp;&nbsp;<B>Delete after Remap</B></Font></TD></TR>
    </TD></TR>
    <TR valign="center">
        <TD colspan=2><HR></TD></TR> <%
end if %>
    <TR valign='bottom'>
        <TD align='center' colspan=2>
            <INPUT TYPE='button' style='font size:11px' value='New' onClick="ApplyDataMod('<%=pcInsertType%>');">
            <INPUT TYPE='button' style='font size:11px' value='Save/Submit' onClick='submit();'>
<% if Len( lcDeleteType ) > 0 then %>            <INPUT TYPE='button' style='font size:11px' value='Delete' onClick="ApplyDataMod('<%=lcDeleteType%>');"><%end if%>
            <INPUT TYPE='button' style='font size:11px' value='Cancel' onClick="Reposition('');">
<% if plRemap=true then %>            <INPUT TYPE='button' style='font size:11px' value='Remap/Commit' onClick="ApplyDataMod('<%=lcRemap%>');"></TD></TR> <%end if%>
    </TABLE></TD><%
End Sub

' ________________________________________________________________
'  INTERFACE FORMS
' ________________________________________________________________
Sub LoginForm( pcMsg )
%>
<table border=1 bgcolor='#9999FF' bordercolor='#0066CC'><TR><TD><img src='images/smse_banner.jpg'></TD></TR><tr><td>
<table border=0 align='center'><%
if Len( pcMsg ) > 0 then %>
<tr><td colsapn=2><Font face='Arial, Helvetica, sans-serif' style='font size:11px'><%=pcMsg%></font></td></tr>
<% end if %>
<tr><td><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>Login ID:</font>&nbsp;&nbsp;<INPUT TYPE='text' NAME=login ID=login style='font size:11px'></td></tr>
<tr><td><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>Password:</font>&nbsp;&nbsp;<INPUT TYPE='password' NAME='password' style='font size:11px'></td></tr>
<tr><td align='center' valign='top'>
<IMG SRC='images/login_norm.jpg' ALT='Login' onMouseOver= "SwapImage( this, 'images/login_over.jpg' )" OnMouseOut="SwapImage( this, 'images/login_norm.jpg' )" onClick="CheckLogin( document.login, document.password )">
&nbsp;&nbsp;&nbsp;<IMG SRC='images/cancel_norm.jpg' ALT='Cancel' onMouseOver="SwapImage( this, 'images/cancel_over.jpg' )" OnMouseOut="SwapImage( this, 'images/cancel_norm.jpg' )"></td></tr>
<Table border=0><tr><td align='center' valign='top'>
<%=pcHTML%>
</CENTER></BODY>
<% End Sub

Sub PasswordForm( pcMsg )
%>
<table border=1 bgcolor='#9999FF' bordercolor='#0066CC'><TR><TD><img src='images/smse_banner.jpg'></TD></TR><tr><td>
<table border=0 align='center'><%
if Len( pcMsg ) > 0 then %>
<tr><td colsapn=2><Font face='Arial, Helvetica, sans-serif' style='font size:11px'><%=pcMsg%></font></td></tr>
<% end if %>
<TR valign='bottom'><TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>New Password (Encrypted):</B>&nbsp;&nbsp;</Font></TD>
    <TD nowrap><input type='password' name='hash' size='32' maxlength='32' onFocus='this.select();' onChange='this.value = hex_hmac_md5( loginid.value, this.value );' style='font size:11px'></TD></TR>
<TR valign='bottom'><TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Verify Password (Encrypted):</B>&nbsp;&nbsp;</Font></TD>
    <TD nowrap><input type='password' name='verify' size='32' maxlength='32' value='' onFocus='this.select();' onChange='this.value = hex_hmac_md5( loginid.value, this.value );' style='font size:11px'></TD></TR>
<TR valign='top'><TD></TD><TD nowrap><FONT style='font size:11px'>When  entering a new password, do not leave any encrypted </FONT></TD></TR>
<TR valign='top'><TD></TD><TD nowrap><FONT style='font size:11px'>part of the newly encrypted password.</FONT></TD></TR>
<TR valign='top'><TD></TD><TD nowrap><FONT style='font size:11px'>*Note: The password encryption is one way and no decryption</FONT></TD></TR>
<TR valign='top'><TD></TD><TD nowrap><FONT style='font size:11px'> of the password is provided!*</FONT></TD></TR>
<tr><td align='center' valign='top' colspan=2><INPUT TYPE='hidden' name='loginid' value='<%=lcLogin%>'>
<INPUT TYPE='button' VALUE='Submit Change' style='font size:11px' onClick='VerifyLogin( hash.value, verify.value )'>
&nbsp;&nbsp;&nbsp;<INPUT TYPE='button' VALUE='Cancel' ALT='Cancel' style='font size:11px'></td></tr>
<Table border=0><tr><td align='center' valign='top'>
<%=pcHTML%>
</CENTER></BODY>
<% End Sub

Sub InterfaceForm( pcMsg )
%>
<table border=1 bgcolor='#9999FF' bordercolor='#0066CC'><TR><TD><img src='images/smse_banner.jpg'></TD></TR><%
if Len( pcMsg ) > 0 then %>
<tr><td><Font face='Arial, Helvetica, sans-serif' style='font size:11px'><%=pcMsg%></font></td></tr>
<% end if %><tr><td>
<% cAction = Request.QueryString( "doit" )
lnDivisionID = Request.QueryString( "filterid" )
if session("access") = True then %>
    <Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Viewing Filter:</B>&nbsp;&nbsp;</Font>
<SELECT name='filterid' style="font size:11px" onChange="Reposition();"> <%
    strSQL  =  "SELECT * FROM tblWebPages ORDER BY DivisionCode;"
    set rsPri = oConn.execute( strSQL ) %>
    <OPTION value='0'>No Filter</OPTION> <%
    Do until rsPri.eof %>
    <OPTION value='<%=rsPri( "DivisionID") %>' <%
        if Cstr(lnDivisionID) = CStr( rsPri( "DivisionID" )) then
    %> SELECTED <%
        end if %>><%=rsPri("DivisionCode") %></OPTION> <%
        rsPri.movenext
    Loop
    rsPri.close
    Set rsPri = nothing
%></SELECT>
<% else %>
<INPUT TYPE='hidden' name="filterid" value=''>
<% end if %>
<INPUT TYPE='button' style='font size:11px' value='Maint. Forms' onClick="Reposition('doit=maint');">
<INPUT TYPE='button' style='font size:11px' value='SMSe Post Information' onClick="Reposition('doit=smsepost');">
<INPUT TYPE='button' style='font size:11px' value='Reports' <% if cAction = "maint" then %> DISABLED <%end if%>onClick="Reposition('doit=reports');">
</td></tr><tr><td>
<%
 if cAction = "maint"  OR Left( cAction, 3 ) = "ins" OR Left( cAction, 3 ) = "upd" OR Left( cAction, 3 ) = "del" OR Left( cAction, 3 ) = "rem" then
    if  session( "isadmin" ) = "On" then%>
<INPUT TYPE='button' style='font size:11px' value='Regions' onClick="Reposition('doit=maint&sact=Region');">
<INPUT TYPE='button' style='font size:11px' value='Building Types' onClick="Reposition('doit=maint&sact=BuildingType');">
<INPUT TYPE='button' style='font size:11px' value='Post Type' onClick="Reposition('doit=maint&sact=PostType');">
<INPUT TYPE='button' style='font size:11px' value='ESO' onClick="Reposition('doit=maint&sact=ESO');">
<INPUT TYPE='button' style='font size:11px' value='ESC' onClick="Reposition('doit=maint&sact=ESC');">
<INPUT TYPE='button' style='font size:11px' value='RDSE' onClick="Reposition('doit=maint&sact=RDSE');">
<INPUT TYPE='button' style='font size:11px' value='Time Zone' onClick="Reposition('doit=maint&sact=TimeZone');">
<BR><%
    end if %>
<INPUT TYPE='button' style='font size:11px' value='Status' onClick="Reposition('doit=maint&sact=Status');">
<INPUT TYPE='button' style='font size:11px' value='Configs' onClick="Reposition('doit=maint&sact=ConfigType');">
<INPUT TYPE='button' style='font size:11px' value='Parent' onClick="Reposition('doit=maint&sact=Parent');">
<INPUT TYPE='button' style='font size:11px' value='Users' onClick="Reposition('doit=maint&sact=users');">
<INPUT TYPE='button' style='font size:11px' value='Encryption Devices' onClick="Reposition('doit=maint&sact=smsepost');">
<INPUT TYPE='button' style='font size:11px' value='Reports' onClick="Reposition('doit=maint&sact=repmaint');">
<INPUT TYPE='button' style='font size:11px' value='Report Criteria' onClick="Reposition('doit=maint&sact=criteria');">
<INPUT TYPE='button' style='font size:11px' value='Data Types' onClick="Reposition('doit=maint&sact=datatype');">
</td></tr><tr><td>
<%
end if %>
<Table border=0><tr><td align='center' valign='top'>
<%=pcHTML%>
</CENTER></BODY> <%
End Sub

' ________________________________________________________________
'  MAINTENANCE FORMS
' ________________________________________________________________
Sub UserForm

cGetSQL = "SELECT * FROM tblUsers ORDER BY UserName"
%><form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="updUser"></input>
     <input type="hidden" name="sact" value="users"></input>
    <TABLE border=0 width=755>
<%
    call MaintHeader( "User Maintenance", "UserID", true, cGetSQL, "UserName" )
    lcUName = rsGet( "UserName" )
    lcHash = rsGet( "Hash" )
    llInactive = rsGet( "Inactive" )
    llLocked = rsGet( "Locked" )
    ldLastLogin = rsGet( "LastLogin" )
    lnAttempts = rsGet( "Attempts" )
    llIsAdmin = rsGet( "IsAdmin" ) %>
    <TR valign='bottom'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>User Name:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='username' size='20' maxlength='20' onFocus='this.select();' value='<%=lcUName%>' style='font size:11px'></TD></TR>
    <TR valign='bottom'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Password (Hash):</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='hash' size='32' maxlength='32' onFocus='this.select();' value='<%=lcHash%>' style='font size:11px'></TD></TR>
    <TR valign='bottom'>
        <TD></TD>
        <TD align='left'><input type='Checkbox' name='isadmin' <%if llIsAdmin = True then %> CHECKED<%end if %>>
            <Font face='Arial, Helvetica, sans-serif'  style="font size:11px">&nbsp;&nbsp;<B>Is an Administrator</B></Font></TD></TR>
    <TR valign='bottom'>
        <TD></TD>
        <TD align='left'><input type='Checkbox' name='locked' <%if llLocked = True then %> CHECKED<%end if %>>
            <Font face='Arial, Helvetica, sans-serif'  style="font size:11px">&nbsp;&nbsp;<B>Account is Locked</B></Font></TD></TR>
    <TR valign='bottom'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Login Attempts:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='attempts' size='10' maxlength='10' onFocus='this.select();' value='<%=lnAttempts%>' style='font size:11px'></TD></TR>
    <TR valign='bottom'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Last Login:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='lastlogin' size='18' maxlength='18' onFocus='this.select();' value='<%=ldLastLogin%>' style='font size:11px'></TD></TR>
    <TR valign='bottom'>
        <TD></TD>
        <TD align='left'><input type='Checkbox' name='inactive' <%if llInactive = True then %> CHECKED<%end if %>>
            <Font face='Arial, Helvetica, sans-serif'  style="font size:11px">&nbsp;&nbsp;<B>Account is Deactivated</B></Font></TD></TR>
<%    call MaintFooter( cGetSQL, lcUName, "UserName", "UserID", "insUsers", false )
End Sub

set rsReps = Server.CreateObject("ADODB.Recordset")
set rsReps.ActiveConnection = oConn
rsReps.CursorType = 3

sub WriteFormLine( pcLineType, pcLabel, pcFieldName, pnSize, pnMaxLen, pcSQL, pcIDField, pcIDValue )

select case pcLineType
  case "fixed_str"
    if rsGet.eof then
        lcValue = ""
    else
        lcValue = rsGet( pcFieldName )
    end if
%>              <tr>
                <td align=right><Font face='Arial, Helvetica, sans-serif' style='font size:11px'><B><%=pcLabel%>:</B></font></td>
                <td><input type="text" name="<%=LCase(pcFieldName)%>" size=<%=pnSize%> maxlength=<%=pnSize%> value="<%=lcValue%>" style="font size:11px"></input></td>
              </tr>
<%
  case "number"
    if rsGet.eof then
        lcValue = 0
    else
        lcValue = CLng( rsGet( pcFieldName ))
    end if
%>              <tr>
                <td align=right><Font face='Arial, Helvetica, sans-serif' style='font size:11px'><B><%=pcLabel%>:</B></font></td>
                <td><input type="text" name="<%=LCase(pcFieldName)%>" size=<%=pnSize%> maxlength=<%=pnSize%> value=<%=lcValue%> style="font size:11px"></input></td>
              </tr>
<%
  case "checkbox"
    if rsGet.eof then
        llValue = False
    else
        llValue = rsGet( pcFieldName )
    end if
    lcValue = ""
    if ( llValue = 1 ) OR ( llValue = true ) then
         lcValue = " Checked "
    end if
    
%>              <tr>
                <td align=right>&nbsp;</td>
                <td><input type="checkbox" name="<%=LCase(pcFieldName)%>" <%=lcValue%> style="font size:11px"><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;<B><%=pcLabel%></B>&nbsp;</font></td>
              </tr>
<%
  case "date"
  case "calendar"
  case "memo"
    if rsGet.eof then
        lcValue = ""
    else
        lcValue = rsGet( pcFieldName )
    end if
%>              <tr>
                <td align=right valign='top'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'><B><%=pcLabel%>:</B></font></td>
                <td><textarea name="<%=LCase(pcFieldName)%>" cols=<%=pnSize%> rows=<%=pnMaxLen%> style='font size:11px; FONT-FAMILY: arial;'><%=lcValue%></textarea></td>
              </tr>
<%
  case "fixed_strmax"
    if rsGet.eof then
        lcValue = ""
    else
        lcValue = rsGet( pcFieldName )
    end if
%>              <tr>
                <td align=right><Font face='Arial, Helvetica, sans-serif' style='font size:11px'><B><%=pcLabel%>:</B></font></td>
                <td><input type="text" name="<%=LCase(pcFieldName)%>" size=<%=pnSize%> maxlength=<%=pnMaxLen%> value="<%=lcValue%>" style="font size:11px"></input></td>
              </tr>
<%
  case "select_num"
'    lnValue = CLng( rsGet( pcIDField ))
    if rsGet.eof then
        pnLookup = 0
    else
        pnLookup = pcIDValue
    end if
'    pcIDValue = lnValue
%>              <tr>
                <td align=right><Font face='Arial, Helvetica, sans-serif' style='font size:11px'><B><%=pcLabel%>:</B></font></td>
                <td><select name="<%=LCase(pcIDField)%>" style="font size:11px">
        <OPTION value='0'  style="color:red">Please make a selection</OPTION>
<%          Set oRs = oConn.execute(pcSQL)
                      Do while (Not oRs.eof)
%>                      <option <% if ors( pcIDField ) = pnLookup then response.write "selected" end if %> value='<%=ors( pcIDField )%>'><%=oRs( pcFieldName ) %></option>
<%        oRs.MoveNext
             Loop
%>                  </select>
    </TD>
              </TR>
<%
  case "select_oTA"
'    lnValue = CLng( rsGet( pcIDField ))
    if rsGet.eof then
        pnLookup = 0
    else
        pnLookup = pcIDValue
    end if
'    pcIDValue = lnValue
%>              <tr>
                <td align=right><Font face='Arial, Helvetica, sans-serif' style='font size:11px'><B><%=pcLabel%>:</B></font></td>
                <td><select name="<%=LCase(pcIDField)%>" style="font size:11px">
                      <option value='0'>Select Contact, if appropriate</option>    
<%          Set oRs = oTAConn.execute(pcSQL)
                      Do while (Not oRs.eof)
%>                      <option <% if ors( pcIDField ) = pnLookup then response.write "selected" end if %> value='<%=ors( pcIDField )%>'><%=oRs( pcFieldName ) %></option>
<%        oRs.MoveNext
             Loop
%>                  </select>
    </TD>
              </TR>
<%
end select
end sub

sub WriteFormFooter( pcTable )
    lcShell = Request.QueryString
%>              <tr>
                <td colspan=2 align=center valign=top>
        <INPUT type="button" style='font size:11px' value="New" onClick="ApplyDataMod('<%=pcInsertType%>');"></input>&nbsp;&nbsp;
        <INPUT type="button" style='font size:11px' value="Save" onClick="submit();"></input>&nbsp;&nbsp;
        <INPUT type="button" style='font size:11px' value="Delete" onClick="buttonSubmit( this.value );" DISABLED></input>&nbsp;&nbsp;
        <INPUT type="button" style='font size:11px' value="Cancel" onClick="Reposition('');"></input>
                </td>
              </tr>
              <TR>
                <TD colspan=2 vAlign=top align=left><font class=spacertext>&nbsp;&nbsp;&nbsp;</font></TD>
              </TR></form>
            </table>
<%
end sub

Sub BuildingTypeForm
%>     <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Building Security Type Maintenance", "BldgSecurityTypeID", 1, "SELECT * FROM BldgSecurityType ORDER BY BldgSecurityTypeDesc;", "BldgSecurityTypeDesc" )
call WriteFormLine( "fixed_str", "Building Security Type", "BldgSecurityTypeDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "BldgSecurityTypeDesc" )
end if
call MaintFooter( cSQL, lcDesc, "BldgSecurityTypeDesc", "BldgSecurityTypeID", "insBuildingType",  false )
End Sub

Sub RegionForm
%>     <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Region Maintenance", "RegionID", 1, "SELECT * FROM RegionType ORDER BY RegionDesc;", "RegionDesc" )
call WriteFormLine( "fixed_str", "Region Type", "RegionDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "RegionDesc" )
end if
call MaintFooter( cSQL, lcDesc, "RegionDesc", "RegionID", "insRegion",  false )
End Sub

Sub PostTypeForm
%>     <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Post Type Maintenance", "PostTypeID", 1, "SELECT * FROM PostType ORDER BY PostTypeDesc;", "PostTypeDesc" )
call WriteFormLine( "fixed_str", "Post Type", "PostTypeDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "PostTypeDesc" )
end if
call MaintFooter( cSQL, lcDesc, "PostTypeDesc", "PostTypeID", "insPostType",  false )
End Sub

Sub ESCForm
%>     <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "ESC Maintenance", "ESCID", 1, "SELECT * FROM ESC ORDER BY ESCDesc;", "ESCDesc" )
call WriteFormLine( "fixed_str", "ESC", "ESCDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "ESCDesc" )
end if
call MaintFooter( cSQL, lcDesc, "ESCDesc", "ESCID", "insESC",  false )
End Sub

Sub ESOForm
%>     <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "ESO Maintenance", "ESOID", 1, "SELECT * FROM ESO ORDER BY ESODesc;", "ESODesc" )
call WriteFormLine( "fixed_str", "ESO", "ESODesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "ESODesc" )
end if
call MaintFooter( cSQL, lcDesc, "ESODesc", "ESOID", "insESO",  false )
End Sub

Sub RDSEForm
%>     <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "RDSE Maintenance", "RDSEID", 1, "SELECT * FROM RDSE ORDER BY RDSEDesc;", "RDSEDesc" )
call WriteFormLine( "fixed_str", "RDSE", "RDSEDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "RDSEDesc" )
end if
call MaintFooter( cSQL, lcDesc, "RDSEDesc", "RDSEID", "insRDSE",  false )
End Sub


Sub ConfigTypeForm
%>     <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Configuration Type Maintenance", "ConfigTypeID", 1, "SELECT * FROM ConfigType ORDER BY ConfigTypeDesc;", "ConfigTypeDesc" )
call WriteFormLine( "fixed_str", "Configuration Type", "ConfigTypeDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "ConfigTypeDesc" )
end if
call MaintFooter( cSQL, lcDesc, "ConfigTypeDesc", "ConfigTypeID", "insConfigType",  false )
End Sub

Sub ParentForm
%>     <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Parent Post Maintenance", "ParentID", 1, "SELECT * FROM [Parent Post] ORDER BY ParentDesc;", "ParentDesc" )
call WriteFormLine( "fixed_str", "Parent Post", "ParentDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "ParentDesc" )
end if
call MaintFooter( cSQL, lcDesc, "ParentDesc", "ParentID", "insParent",  false )
End Sub

Sub StatusForm
%>     <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Status Maintenance", "StatusID", 1, "SELECT * FROM tblStatus ORDER BY StatusDesc;", "StatusDesc" )
call WriteFormLine( "fixed_str", "Status", "StatusDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "StatusDesc" )
end if
call MaintFooter( cSQL, lcDesc, "StatusDesc", "StatusID", "insStatus",  false )
End Sub

Sub TimeZoneForm
%>     <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Time Zone Maintenance", "TimeZoneID", 1, "SELECT * FROM TimeZone ORDER BY TimeZone;", "TimeZone" )
call WriteFormLine( "fixed_str", "Time Zone", "TimeZone", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "TimeZone" )
end if
call MaintFooter( cSQL, lcDesc, "TimeZone", "TimeZoneID", "insTimeZone",  false )
End Sub

Sub EncryptDevForm
%>     <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Encryption Device Maintenance", "EncryptypeID", 1, "SELECT * FROM Encryptype ORDER BY EncryptypeDesc;", "EncryptypeDesc" )
call WriteFormLine( "fixed_str", "Encyrption Device", "EncryptypeDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "EncryptypeDesc" )
end if
call MaintFooter( cSQL, lcDesc, "EncryptypeDesc", "EncryptypeID", "insEncryptDev.",  false )
End Sub

Sub ReportForm

lnReportID = Request.QueryString( "find" )
cRepSQL = "SELECT * FROM tblReports Where ReportID = " & lnReportID
set rsRep = oConn.Execute( cRepSQL )
if not rsRep.eof then
    lcRepName = rsRep( "ReportName" )
    lcASPFile = rsRep( "ASPFileName" )
else
    lcRepName = ""
    lcASPFile = ""
end if
rsRep.close
set rsRep=nothing
cGetSQL = "SELECT *, tblDataType.DataType FROM tblCriteria, tblDataType WHERE tblCriteria.DataTypeID = tblDataType.DataTypeID AND tblCriteria.ReportID = " & lnReportID & " ORDER BY OrderNumber"
rsGet.Open cGetSQL
If not rsGet.eof then
%><form action="<%=lcASPFile%>" method="get" name="ReportForm">
     <input type="hidden" name="doit" value="reports"></input>
     <input type="hidden" name="aspfilename" value="reports/<%=lcASPFile%>"></input>
    <TABLE border=0>
<%    nCnt = 0
    Do while not rsGet.eof
        nCnt = nCnt + 1
        lcCName = rsGet( "CriteriaName" )
        lcDataType = rsGet( "DataType" )
        lcDefault = rsGet( "DefaultValue" )
        llMand = rsGet( "isMandatory" )
        lcLastRun = rsGet( "LastRunValue" )
        lnSize = rsGet( "FieldSize" )%>
    <TR valign='bottom'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px' <%if llMand=True then%>color='#C8373A'<%end if%>>&nbsp;&nbsp;<B><%=lcCName%>:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='criteria<%=nCnt%>' size='<%=lnSize%>' maxlength='<%=lnSize%>' <%
        if lcDataType = "Date" then
            %>value='<%=lcDefault%>' onFocus="javascript:vDateType='1'" onKeyUp="DateFormat(this,this.value,event,false,'1')" onBlur="DateFormat(this,this.value,event,false,'1')" style='font size:11px'>
            <a href="javascript:show_calendar('ReportForm.criteria<%=nCnt%>');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src="images/ico_calendar.gif" alt='Set Date' width=16 height=16 border=0></a><%
        else
            %>onFocus='this.select();' value='<%=lcDefault%>' style='font size:11px'><%
        end if
            %></TD></TR>
<%        rsGet.MoveNext
    Loop
%>    <TR valign='bottom'>
        <TD align='center' colspan=2><INPUT TYPE='button' style='font size:11px' value='Run Report' onClick="openWindow( document.ReportForm.aspfilename.value,<%=nCnt%>,'newWindow','750','550');">
            <INPUT TYPE='button' style='font size:11px' value='Cancel' onClick="Reposition('');"></TD></TR>
    </TABLE></CENTER></TD>
    </TR>
<%
else
%><form action="<%=lcASPFile%>" method="get" name="ReportForm">
     <input type="hidden" name="doit" value="reports"></input>
     <input type="hidden" name="aspfilename" value="reports/<%=lcASPFile%>"></input>
    <TABLE border=0>
    <TR valign='bottom'>
        <TD align='center' colspan=2><INPUT TYPE='button' style='font size:11px' value='Run Report' onClick="openWindow( document.ReportForm.aspfilename.value,<%=nCnt%>,'newWindow','750','550');">
            <INPUT TYPE='button' style='font size:11px' value='Cancel' onClick="Reposition('');"></TD></TR>
    </TABLE></CENTER></TD>
    </TR>
<%
end if
End Sub

Sub ReportMaintForm

cGetSQL = "SELECT * FROM tblReports ORDER BY ReportName"
rsGet.Open cGetSQL
If not rsGet.eof then
%><form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="updRepMaint"></input>
     <input type="hidden" name="sact" value="repmaint"></input>
    <TABLE border=0>
<%    call MaintHeader( "ReportID", true, cGetSQL, "ReportName" )
    lcDesc = rsGet( "ReportName" )
    lcASP = rsGet( "ASPFilename" )
    ldLastRun = rsGet( "LastRun" ) %>
    <TR valign='center'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Report Name:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='reportname' size='60' maxlength='60' onFocus='this.select();' value='<%=lcDesc%>' style='font size:11px'></TD></TR>
    <TR valign='top'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>ASP File Name:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><TEXTAREA name="aspfilename" rows=4 cols=70 style='font size:11px; FONT-FAMILY: arial;'><%=lcASP%></TEXTAREA></TD></TR>
    <TR valign='center'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Report Last Run:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' READONLY name='lastrun' size='18' maxlength='18' onFocus='this.select();' value='<%=ldLastRun%>' style='font size:11px'></TD></TR>
<%    call MaintFooter( cGetSQL, lcDesc, "ReportName", "ReportID", "insRepMaint", false )
end if
End Sub

Sub ReportCriteriaForm

cGetSQL = "SELECT * FROM tblCriteria ORDER BY CriteriaName"
rsGet.Open cGetSQL
If not rsGet.eof then
%><form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="updRepCrit"></input>
     <input type="hidden" name="sact" value="criteria"></input>
    <TABLE border=0>
<%    call MaintHeader( "CriteriaID", true, cGetSQL, "CriteriaName" )
    lnRepID = rsGet( "ReportID" )
    lcDesc = rsGet( "CriteriaName" )
    lnDataTypeID = rsGet( "DataTypeID" )
    lcDefault = rsGet( "DefaultValue" )
    llMand = rsGet( "isMandatory" )
    lcLRV = rsGet( "LastRunValue" )
    lnOrder = rsGet( "OrderNumber" )
    lnSize = rsGet( "FieldSize" ) %>
    <TR valign='bottom'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Report Name:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><SELECT name='reportid' style="font size:11px"> <%
    strSQL = "SELECT * FROM tblReports ORDER BY ReportName"
    set rsPri = oConn.execute( strSQL )
    Do until rsPri.eof %>
                <OPTION value='<%=rsPri( "ReportID") %>' <%
        if Cstr(lnRepID) = CStr( rsPri( "ReportID" )) then
                %> SELECTED <%
        end if %>><%=rsPri("ReportName" )%></OPTION> <%
        rsPri.movenext
    Loop
    rsPri.close
    Set rsPri = nothing
%>            </SELECT></TD></TR>
    <TR valign='center'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Report Criteria Name:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='criterianame' size='50' maxlength='50' onFocus='this.select();' value='<%=lcDesc%>' style='font size:11px'></TD></TR>
    <TR valign='bottom'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Data Type:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><SELECT name='datatypeid' style="font size:11px"> <%
    strSQL = "SELECT * FROM tblDataType ORDER BY DataType"
    set rsPri = oConn.execute( strSQL )
    Do until rsPri.eof %>
                <OPTION value='<%=rsPri( "DataTypeID") %>' <%
        if Cstr(lnDataTypeID) = CStr( rsPri( "DataTypeID" )) then
                %> SELECTED <%
        end if %>><%=rsPri("DataType" )%></OPTION> <%
        rsPri.movenext
    Loop
    rsPri.close
    Set rsPri = nothing
%>            </SELECT></TD></TR>
    <TR valign='top'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Field Default Value:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='defaultvalue' size='50' maxlength='50' onFocus='this.select();' value='<%=lcDefault%>' style='font size:11px'></TD></TR>
    <TR valign='bottom'>
        <TD></TD>
        <TD align='left'><input type='Checkbox' name='ismandatory' <%if llMand = True then %> CHECKED<%end if %>>
            <Font face='Arial, Helvetica, sans-serif'  style="font size:11px">&nbsp;&nbsp;<B>The value for this Criteria <U>must</U> be filled in</B></Font></TD></TR>
    <TR valign='top'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Last Run Value:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='lastrunvalue' size='50' maxlength='50' onFocus='this.select();' value='<%=lcLRV%>' style='font size:11px'></TD></TR>
    <TR valign='top'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Order Number:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='ordernumber' size='4' maxlength='4' onFocus='this.select();' value='<%=lnOrder%>' style='font size:11px'></TD></TR>
    <TR valign='top'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Field Size:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='fieldsize' size='4' maxlength='4' onFocus='this.select();' value='<%=lnSize%>' style='font size:11px'></TD></TR>
<%    call MaintFooter( cGetSQL, lcDesc, "CriteriaName", "CriteriaID", "insRepCrit", false )
end if
End Sub

Sub DataTypeForm

cGetSQL = "SELECT * FROM tblDataType ORDER BY DataType"
rsGet.Open cGetSQL
If not rsGet.eof then
%><form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="updDataType"></input>
     <input type="hidden" name="sact" value="datatype"></input>
    <TABLE border=0>
<%    call MaintHeader( "DataTypeID", true, cGetSQL, "DataType" )
    lcDesc = rsGet( "DataType" ) %>
    <TR valign='bottom'>
        <TD align='right'><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Data Type:</B>&nbsp;&nbsp;</Font></TD>
        <TD nowrap><input type='text' name='datatype' size='12' maxlength='12' onFocus='this.select();' value='<%=lcDesc%>' style='font size:11px'></TD></TR>
<%    call MaintFooter( cGetSQL, lcDesc, "DataType", "DataTypeID", "insDataType", false )
end if
End Sub


Sub SMSePostForm
%>     <form action="<%=lcASPFile%>" method="post" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
        cSQL  =  "SELECT * FROM SMSePosts ORDER BY Postname;"
        call MaintHeader( "SMSe Post Maintenance", "PostID", 1, cSQL, "Postname" )
        if rsGet.eof then
            lnLink = 0
        else
            lnLink = rsGet("PostID")
        end if
%>              <tr>
                <td align=right><Font face='Arial, Helvetica, sans-serif' style='font size:11px'><B>Link #:</B></font></td>
                <td><input type="text" name="postid" size=4 maxlength=10 value="<%=lnLink%>" style="font size:11px" READONLY></input></td>
              </tr> <%
        call WriteFormLine( "fixed_str", "Post Name", "Postname", 50, 0, "", "", "" )
        call WriteFormLine( "fixed_str", "Country", "Country", 50, 0, "", "", "" )
        call WriteFormLine( "select_num", "Region", "RegionDesc", 0, 0, "SELECT * FROM RegionType ORDER BY RegionDesc", "RegionID", rsGet("RegionID") )
        call WriteFormLine( "select_num", "Building Security Type", "BldgSecurityTypeDesc", 0, 0, "SELECT * FROM BldgSecurityType ORDER BY BldgSecurityTypeDesc", "BldgSecurityTypeID", rsGet("BldgSecurityType") )
        call WriteFormLine( "checkbox", "Check here if this is an additional building with it's own SMSeNet Connectivity", "AnnexBldg", 0, 0, "", "", "" )
        call WriteFormLine( "select_num", "Post Type", "PostTypeDesc", 0, 0, "SELECT * FROM PostType ORDER BY PostTypeDesc;", "PostTypeID", rsGet("PostType") )
        call WriteFormLine( "select_num", "ESO", "ESODesc", 0, 0, "SELECT * FROM ESO ORDER BY ESODesc;", "ESOID", rsGet("ESO") )
        call WriteFormLine( "select_num", "ESC", "ESCDesc", 0, 0, "SELECT * FROM ESC ORDER BY ESCDesc;", "ESCID", rsGet("ESC") )
        call WriteFormLine( "select_num", "RDSE", "RDSEDesc", 0, 0, "SELECT * FROM RDSE ORDER BY RDSEDesc;", "RDSEID", rsGet("RDSE") )
        call WriteFormLine( "select_num", "Time Zone", "TimeZone", 0, 0, "SELECT * FROM TimeZone ORDER BY TimeZone;", "TimeZoneID", rsGet("TimeZone") )
        call WriteFormLine( "memo", "Notes", "Notes", 80, 2, "", "", "" )
%>              <tr><td align=right colspan=2>SMSe Information:<HR></td></tr> <%
        call WriteFormLine( "select_num", "SMSe Status", "StatusDesc", 0, 0, "SELECT * FROM tblStatus ORDER BY StatusDesc;", "StatusID", rsGet("SMSeStatus") )
        call WriteFormLine( "checkbox", "Commissioned", "Commissioned", 0, 0, "", "", "" )
        call WriteFormLine( "select_num", "SMSe Configuration", "ConfigTypeDesc", 0, 0, "SELECT * FROM ConfigType ORDER BY ConfigTypeDesc;", "ConfigTypeID", rsGet("ConfigType") )
        call WriteFormLine( "select_num", "Parent", "ParentDesc", 0, 0, "SELECT * FROM [Parent Post] ORDER BY ParentDesc;", "ParentID", rsGet("Parent") )
        call WriteFormLine( "fixed_str", "New Topology", "New_Topology", 50, 0, "", "", "" )
        call WriteFormLine( "fixed_str", "C*Curre License Version", "License_Ver", 50, 4, "", "", "" )
        call WriteFormLine( "select_num", "Encryption Device", "EncryptypeDesc", 0, 0, "SELECT * FROM Encryptype ORDER BY EncryptypeDesc;", "EncryptypeID", rsGet("Encryptype") )
        call WriteFormLine( "fixed_str", "Local Workstation #1", "wrkstn1", 50, 0, "", "", "" )
        call WriteFormLine( "fixed_str", "Local Workstation #2", "wrkstn2", 50, 0, "", "", "" )
        call WriteFormLine( "fixed_str", "Local Workstation #3", "wrkstn3", 50, 0, "", "", "" )
        call WriteFormLine( "fixed_str", "Local Workstation #4", "wrkstn4", 50, 0, "", "", "" )
        call WriteFormLine( "fixed_str", "Local Workstation #5", "wrkstn5", 50, 0, "", "", "" )
'        call WriteFormLine( "fixed_str", "Local Workstation #6", "wrkstn6", 50, 0, "", "", "" )
'        call WriteFormLine( "fixed_str", "Local Workstation #7", "wrkstn7", 50, 0, "", "", "" )
'        call WriteFormLine( "fixed_str", "Local Workstation #8", "wrkstn8", 50, 0, "", "", "" )
        call WriteFormLine( "number", "Number of CU-40s", "CU-40", 10, 0, "", "", "" )
        call WriteFormLine( "number", "Number of I-Stars", "IStars", 10, 0, "", "", "" )
        call WriteFormLine( "number", "Number of Advents", "Advent", 10, 0, "", "", "" )
        call WriteFormLine( "number", "Number of AES", "AES", 10, 0, "", "", "" )
        call WriteFormLine( "number", "Number of Card Readers", "Card_reader", 10, 0, "", "", "" )

%>              <tr><td align=right colspan=2>RVI/GLID Information:<HR></td></tr> <%
        call WriteFormLine( "select_num", "RVI Status", "StatusDesc", 0, 0, "SELECT * FROM tblStatus ORDER BY StatusDesc;", "StatusID", rsGet("RVIStatus") )
        call WriteFormLine( "select_num", "GLID Status", "StatusDesc", 0, 0, "SELECT * FROM tblStatus ORDER BY StatusDesc;", "StatusID", rsGet("GLIDStatus") )
        call WriteFormLine( "fixed_str", "Router IP Address", "Router_IP", 50, 0, "", "", "" )
        call WriteFormLine( "fixed_str", "DVR/CAM", "DVR_CAM", 50, 0, "", "", "" )
        call WriteFormLine( "fixed_str", "SMSeNet Online", "SMSeNet_Online", 50, 0, "", "", "" )
        call WriteFormLine( "fixed_str", "Badging Station", "Badging_Stn", 50, 0, "", "", "" )
        if rsGet.eof then
            lcDesc = ""
        else
            lcDesc = rsGet( "Postname" )
        end if
        call MaintFooter( cSQL, lcDesc, "Postname", "PostID", "delSMSePost",  false )
End Sub


Public rcServerTime
ldSTime = Now()
arDay = Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
arMonth = Array("January","February","March","April","May","June","July","August","September","October","November","December")
rcServerTime = arDay(WeekDay(ldSTime)-1) & ", " & arMonth(Month( ldSTime )-1) & " " & Day(ldSTime) & ", " & Year(ldSTime) & " - " &  FormatDateTime( ldSTime, vbLongTime )
'lnEmpID = Request.QueryString("emp")
lnEmpID = session("emp")
lcAction = Request.QueryString("doit")

If isEmpty( lnEmpID ) = false then
select case lcAction
case "maint"
    subAction = Request.QueryString( "sact" )
    nGetID = Request.QueryString( "find" )
    select case subAction
    case "BuildingType"
        call BuildingTypeForm
    case "Region"    
        call RegionForm
    case "PostType"
        call PostTypeForm
    case "ESC"
        call ESCForm
    case "ESO"
        call ESOForm
    case "RDSE"
        call RDSEForm
    case "ConfigType"
        call ConfigTypeForm
    case "Parent"
        call ParentForm
    case "Status"
        call StatusForm
    case "TimeZone"
        call TimeZoneForm
    case "Encryptype"
        call EncryptDevForm
    case "users"
        call UserForm
    case "criteria"
        call ReportCriteriaForm
    case "datatype"
        call DataTypeForm
    case "repmaint"
        call ReportMaintForm
    end select

case "smsepost"
    call SMSePostForm

case "insRepMaint"
    lcDesc = Request.QueryString( "reportname" )
    lcFile = Request.QueryString( "aspfilename" )
    cInsSQL = "INSERT INTO tblReports ( reportname, aspfilename ) VALUES ( '" & lcDesc & "', '" & lcFile & "' )"
    oConn.Execute( cInsSQL )
    call ReportMaintForm

case "updRepMaint"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lcDesc = Request.QueryString( "reportname" )
    lcFile = Request.QueryString( "aspfilename" )
    cUpdSQL = "UPDATE tblReports SET reportname = '" & lcDesc & "', aspfilename= '" & lcFile & "' WHERE ReportID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call ReportMaintForm

case "insRepCrit"
    lnRep = Request.QueryString( "reportid" )
    lcDesc = Request.QueryString( "criterianame" )
    lnData = Request.QueryString( "datatypeid" )
    lcDef = Request.QueryString( "defaultvalue" )
    vChange = Request.QueryString( "ismandatory" )
    if vChange = "on" then
        llMand = True
    else
        if isNull( vChange ) OR LEN( vChange ) = 0 then
            llMand = False
        end if
    end if
    lcLRV = Request.QueryString( "lastrunvalue" )
    lnOrder = Request.QueryString( "ordernumber" )
    lnSize = Request.QueryString( "fieldsize" )
    cInsSQL = "INSERT INTO tblCriteria ( reportid, criterianame, datatypeid, defaultvalue, ismandatory, lastrunvalue, ordernumber, fieldsize ) VALUES ( " & lnRep & ", '" & lcDesc & "', " & lnData & ", '" & lcDef & "', " & llMand & ", '" & lcLRV & "', " & lnOrder & ", " & lnSize & " )"
    oConn.Execute( cInsSQL )
    call ReportCriteriaForm

case "updRepCrit"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lnRep = Request.QueryString( "reportid" )
    lcDesc = Request.QueryString( "criterianame" )
    lnData = Request.QueryString( "datatypeid" )
    lcDef = Request.QueryString( "defaultvalue" )
    vChange = Request.QueryString( "ismandatory" )
    if vChange = "on" then
        llMand = True
    else
        if isNull( vChange ) OR LEN( vChange ) = 0 then
            llMand = False
        end if
    end if
    lcLRV = Request.QueryString( "lastrunvalue" )
    lnOrder = Request.QueryString( "ordernumber" )
    lnSize = Request.QueryString( "fieldsize" )
    cUpdSQL = "UPDATE tblCriteria SET reportid= " & lnRep & ", datatype = '" & lcDesc & "', datatypeid=" & lnData & ", defaultvalue='" & lcDef & "', ismandatory=" & llMand & ", lastrunvalue='" & lcLRV & "', ordernumber=" & lnOrder & ", fieldsize=" & lnSize & " WHERE DataTypeID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call ReportCriteriaForm

case "reports"
    nWorkID = Request.QueryString( "find" )
    if isEmpty( nWorkID ) then
        cSearch = Request.QueryString( "text" )
%>    <CENTER><TABLE border=0>
    <TR valign='bottom'>
        <TD align='center' colspan=2><Font face='Arial, Helvetica, sans-serif' style='font size:11px'>&nbsp;&nbsp;<B>Select the Report to Run:</B>&nbsp;&nbsp;</Font></TD></TR>
<%
        cFindSQL = "SELECT * FROM tblReports ORDER BY ReportName"
        set rsFind = oConn.Execute( cFindSQL )
        If not rsFind.eof then
%>    <TR valign='bottom'>
        <TD align='center' colspan=2><SELECT name='reportname' style="font size:11px" size=20> <%
            Do until rsFind.eof %>
                <OPTION value='<%=rsFind( "ReportID") %>'><%=rsFind("ReportName")%></OPTION> <%
                rsFind.movenext
            Loop
            rsFind.close
            Set rsFind = nothing
%>            </SELECT></TD></TR> <%
        end if
%>    <TR valign='bottom'>
        <TD align='center' colspan=2><INPUT TYPE='button' style='font size:11px' value='Select' onClick="GetReport('doit=reports');">
            <INPUT TYPE='button' style='font size:11px' value='Cancel' onClick="Reposition('');"></TD></TR>
    </TABLE></CENTER></TD>
    </TR>
<%    else    
        call ReportForm
    end if

case "insRegion"
    lcDesc = Request.QueryString( "regiondesc" )
    cInsSQL = "INSERT INTO RegionType ( regiondesc ) VALUES ( '" & lcDesc & "' )"
    oConn.Execute( cInsSQL )
    call RegionForm

case "updRegion"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lcDesc = Request.QueryString( "regiondesc" )
    cUpdSQL = "UPDATE RegionType SET regiondesc= '" & lcDesc & "' WHERE RegionID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call RegionForm

case "insBuildingType"
    lcDesc = Request.QueryString( "bldgsecuritytypedesc" )
    cInsSQL = "INSERT INTO BldgSecurityType ( bldgsecuritytypedesc ) VALUES ( '" & lcDesc & "' )"
    oConn.Execute( cInsSQL )
    call BuildingTypeForm

case "updBuildingType"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lcDesc = Request.QueryString( "bldgsecuritytypedesc" )
    cUpdSQL = "UPDATE BldgSecurityType SET bldgsecuritytypedesc= '" & lcDesc & "' WHERE BldgSecurityTypeID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call BuildingTypeForm

case "insPostType"
    lcDesc = Request.QueryString( "posttypedesc" )
    cInsSQL = "INSERT INTO PostType ( posttypedesc ) VALUES ( '" & lcDesc & "' )"
    oConn.Execute( cInsSQL )
    call PostTypeForm

case "updPostType"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lcDesc = Request.QueryString( "posttypedesc" )
    cUpdSQL = "UPDATE PostType SET posttypedesc= '" & lcDesc & "' WHERE PostTypeID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call PostTypeForm

case "insESO"
    lcDesc = Request.QueryString( "ESODesc" )
    cInsSQL = "INSERT INTO ESO ( esodesc ) VALUES ( '" & lcDesc & "' )"
    oConn.Execute( cInsSQL )
    call ESOForm

case "updESO"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lcDesc = Request.QueryString( "ESODesc" )
    cUpdSQL = "UPDATE ESO SET esodesc= '" & lcDesc & "' WHERE ESOID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call ESOForm

case "insESC"
    lcDesc = Request.QueryString( "ESCDesc" )
    cInsSQL = "INSERT INTO ESC ( ESCDesc ) VALUES ( '" & lcDesc & "' )"
    oConn.Execute( cInsSQL )
    call ESCForm

case "updESC"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lcDesc = Request.QueryString( "ESCDesc" )
    cUpdSQL = "UPDATE ESC SET ESCDesc= '" & lcDesc & "' WHERE ESCID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call ESCForm

case "insRDSE"
    lcDesc = Request.QueryString( "RDSEDesc" )
    cInsSQL = "INSERT INTO RDSE ( RDSEDesc ) VALUES ( '" & lcDesc & "' )"
    oConn.Execute( cInsSQL )
    call RDSEForm

case "updRDSE"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lcDesc = Request.QueryString( "RDSEDesc" )
    cUpdSQL = "UPDATE RDSE SET RDSEDesc= '" & lcDesc & "' WHERE RDSEID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call RDSEForm

case "insTimeZone"
    lcDesc = Request.QueryString( "timezone" )
    cInsSQL = "INSERT INTO TimeZone ( timezone ) VALUES ( '" & lcDesc & "' )"
    oConn.Execute( cInsSQL )
    call TimeZoneForm

case "updTimeZone"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lcDesc = Request.QueryString( "timezone" )
    cUpdSQL = "UPDATE TimeZone SET timezone= '" & lcDesc & "' WHERE timezoneID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call TimeZoneForm

case "insStatus"
    lcDesc = Request.QueryString( "statusdesc" )
    cInsSQL = "INSERT INTO tblStatus ( statusdesc ) VALUES ( '" & lcDesc & "' )"
    oConn.Execute( cInsSQL )
    call StatusForm

case "updStatus"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lcDesc = Request.QueryString( "statusdesc" )
    cUpdSQL = "UPDATE tblStatus SET statusdesc= '" & lcDesc & "' WHERE statusdescID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call StatusForm

case "insConfigType"
    lcDesc = Request.QueryString( "configtypedesc" )
    cInsSQL = "INSERT INTO ConfigType ( configtypedesc ) VALUES ( '" & lcDesc & "' )"
    oConn.Execute( cInsSQL )
    call ConfigTypeForm

case "updConfigType"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lcDesc = Request.QueryString( "configtypedesc" )
    cUpdSQL = "UPDATE ConfigType SET configtypedesc= '" & lcDesc & "' WHERE ConfigtypeID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call ConfigTypeForm

case "insParent"
    lcDesc = Request.QueryString( "parentdesc" )
    cInsSQL = "INSERT INTO [Parent Post] ( parentdesc ) VALUES ( '" & lcDesc & "' )"
    oConn.Execute( cInsSQL )
    call ParentForm

case "updParent"
    lnSetID = Request.QueryString( "find" )
    lnCurID = Request.QueryString( "curid" )
    if isEmpty( lnSetID ) AND not isEmpty( lnCurID ) then
        lnSetID = lnCurID
    end if
    lcDesc = Request.QueryString( "parentdesc" )
    cUpdSQL = "UPDATE [Parent Post] SET parentdesc= '" & lcDesc & "' WHERE ParentID = " & lnSetID
    oConn.Execute (cUpdSQL)
    call ParentForm

case "insSMSePost"
    lcPost = Request.Form( "Postname" )
    lcCountry = Request.Form( "Country" )
    lcServer = Request.Form( "Server_name" )
    lcTopology = Request.Form( "New_topology" )
    lcLicense = Request.Form( "License_ver" )
    lcRouter = Request.Form( "Router_IP" )
    lcDVR = Request.Form( "DVR_CAM" )
    lcBadge = Request.Form( "Badging_Stn" )
    lcOnline = Request.Form( "SMSeNet_Online" )
    lcWrk1 = Request.Form( "wrkstn1" )
    lcWrk2 = Request.Form( "wrkstn2" )
    lcWrk3 = Request.Form( "wrkstn3" )
    lcWrk4 = Request.Form( "wrkstn4" )
    lcWrk5 = Request.Form( "wrkstn5" )
    lcNotes = Request.Form( "Notes" )
    lnGLID = Request.Form( "GLIDStatus" )
    lnRVI = Request.Form( "RVIStatus" )
    lnSMSe = Request.Form( "SMSeStatus" )
    lnRDSE = Request.Form( "RDSE" )
    lnESC = Request.Form( "ESC" )
    lnESO = Request.Form( "ESO" )
    lnParent = Request.Form( "Parent" )
    lnEncrypt = Request.Form( "Encryptype" )
    lnPostType = Request.Form( "PostType" )
    lnCardReader = Request.Form( "Card_reader" )
    lnAES = Request.Form( "AES" )
    lnAdvent = Request.Form( "Advent" )
    lnCU40 = Request.Form( "CU-40" )
    lnSecType = Request.Form( "BldgSecurityType" )
    lnIStar = Request.Form( "IStars" )
    lnRegion = Request.Form( "RegionID" )
    lnConfigType = Request.Form( "ConfigType" )
    lnZone = Request.Form( "TimeZone" )
    vChange = Request.Form( "AnnexBldg" )
    if vChange = "on" then
        llAnnex = True
    else
        if isNull( vChange ) OR LEN( vChange ) = 0 then
            llAnnex = False
        end if
    end if
    vChange = Request.Form( "Commissioned" )
    if vChange = "on" then
        llComm = True
    else
        if isNull( vChange ) OR LEN( vChange ) = 0 then
            llComm = False
        end if
    end if
    cInsSQL = "INSERT INTO SMSePosts ( postname, country, server_name, new_topology, license_ver, router_ip, dvr_cam, badging_stn, smsenet_online, wrkstn1, wrkstn2, wrkstn3, wrkstn4, wrkstn5, notes, glidstatus, rvistatus, smsestatus, rdse, esc, eso, parent, encrytype, posttype, card_reader, aes, advent, cu-40, bldgsecuritytype, istars, regionid, configtype, timezone, annexbldg, commissioned ) VALUES ( '" & lcPost & "', '" & lcCountry & "', '" & lcServer & "', '" & lcTopology & "', '" & lcLicense & "', '" & lcRouter & "', '" & lcDVR & "', '" & lcBadge & "', '" & lcOnline & "', '" & lcWrk1 & "', '" & lcWrk2 & "', '" & lcWrk3 & "', '" & lcWrk4 & "', '" & lcWrk5 & "', '" & lcNotes & "', " &