var foc = '';

var isIE = 1;
if (navigator.appName == "Netscape")
    { 
    isIE = 0;
    }

function nil()
    {
    }

function clickLogin()
        {
        if (document.getElementById('z2tLogin').value == '' && document.getElementById('z2tPassword').value == '')
            {
            document.getElementById('z2tLogin').focus();
            return;
            }

        if (document.getElementById('z2tLogin').value == '')
            {
            document.getElementById('z2tLogin').focus();
            alert('Please enter your User Name');
            return;
            }

        if (document.getElementById('z2tPassword').value == '')
            {
            document.getElementById('z2tPassword').focus();
            alert('Please enter your Password');
            return;
            }

        var URL = pathBase + currentPage +
            '?lname=' + document.getElementById('z2tLogin').value +
            '&pass=' + document.getElementById('z2tPassword').value;
        window.document.location = URL;
        }

function clickLogout()
        {
        var URL = pathBase + 'index.asp' +
            '?logout=true';
        window.document.location = URL;
        }

function clickLookup()
        {
        var zip = document.getElementById('inputZip');
        if (zip.value.length > 5)
            {
            zip.value = zip.value.substr(0,5);
            }

        if (zip.value.length == 5)
            {
            var URL = pathBase + 'z2t_lookup.asp' +
                '?inputZip=' + zip.value;
            window.document.location = URL;
            }
        else
            {
            alert('Zip Code Must Contain 5 Characters');
            }
        }

function focusField(f)
    {
    foc=f;
    }


function keyPress(myfield, e)
    {
    var key;

    if (window.event)
        key = window.event.keyCode;
    else if (e)
        key = e.which;
    else
        return true;

    // Enter key hit
    if (key == 13) 
        {
        key = 0;
        if (myfield.name == 'z2tLogin')
            {
            document.getElementById('z2tPassword').focus();
            return false;
            }
        if (myfield.name == 'z2tPassword')
            {
            clickLogin();
            return false;
            }
        }
    }


function keyPressNumbersOnly(myfield, e, dec)
    {
    var key;
    var keychar;

    if (window.event)    
       key = window.event.keyCode;
    else if (e)
       key = e.which;
    else
       return true;
    keychar = String.fromCharCode(key);


    // Enter key hit
    if (key==13)
        {
        if (foc == 'amt')
            {
            document.getElementById('inputzip').focus();
            }
        if (foc == 'zip')
            {
            document.getElementById('inputamt').focus();
            }
        if (myfield.name == 'inputZip')
            {
            clickLookup();
            }
        }

        // control keys
        if ((key==null) || (key==0) || (key==8) || 
            (key==9) || (key==27) )
           return true;

        // numbers
        else if ((("0123456789").indexOf(keychar) > -1))
           return true;

        // decimal point jump
        else if (dec && (keychar == "."))
           {
           myfield.form.elements[dec].focus();
           return false;
           }
        else
           return false;
        }


function getPosition(e) {
    //Firefox event gets passed in, but IE needs to get it now
    if (!e) var e = window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        cursor.x = e.clientX + 
            (document.documentElement.scrollLeft || 
            document.body.scrollLeft) - 
            document.documentElement.clientLeft;
        cursor.y = e.clientY + 
            (document.documentElement.scrollTop || 
            document.body.scrollTop) - 
            document.documentElement.clientTop;
    }
    return cursor;
}



