﻿// JScript File "fieldcontrol.js"

    // -----------------------------------------------------------
    // This function tries getElementById both with and without
    //  the content placeholder prefix, so that it can be found
    //  whether it is in the master page or in the content page,
    //  and whether it is an ordinary HTML control or an ASP control.
    //
    //  Created 10/05/2009 kaw
    // -----------------------------------------------------------
    function getPageElement(strElementId)
    {
        // first try with no prefix
        var objCtl=document.getElementById(strElementId);
        if (objCtl) return(objCtl);
            
        // not found, so try with content placeholder prefix
        return(document.getElementById('ctl00_DataEntryAreaPlaceholder_' + strElementId));
    }    

    // -----------------------------------------------------------
    // jumpnext: Generic function auto-jumps to next screen field
    //  when max field length of text box is reached.
    // Call from "onkeyup" event of text box.
    //
    // From "JavaScript & DHTML Cookbook", Danny Goodman
    // O'Reilly 2003 edition p.213
    //
    //  Used in login.aspx.
    // -----------------------------------------------------------
    function jumpnext(field, next, evt)
    {
       evt = (evt) ? evt : event;
       var charCode = (evt.charCode) ? evt.charCode 
                    : ((evt.keyCode) ? evt.keyCode
                    : ((evt.which) ? evt.which : 0));
       if (charCode > 31 && (field.value.length == field.maxLength)) {
          next = "ctl00$DataEntryAreaPlaceholder$" + next;
          field.form.elements[next].focus();
       }
    }
    
    // -----------------------------------------------------------
    // Button rollover routines make buttons pop out a bit when
    //  rolled over by mouse.
    //
    //  Used in all application screens that have buttons.
    // -----------------------------------------------------------
    function buttonRollover(field)
    {
        field.style.border="thin outset white";
    }
    function buttonRollout(field)
    {
        field.style.border="thin solid white";
    }
    
// end JScript File