function password_inputokp(event) {
    okp(event)
    if(document.getElementById('caps_lock_on').style.display == "block"){
      document.getElementById('caps_lock_on').style.display = "inline";
    }

}



function init_page(timeout) {

    setTimeout(count_down, Math.max(0, (timeout * 1000) - timeout_warning_ms))

    if (document.forms[0].user.value == '') {
        document.forms[0].user.focus()
    } else {
        document.forms[0].pwd.focus()
    }

    if (window.name != window.top.name) {
        // prevents logout in frames
        window.top.location = window.location
    }

    var password_input = document.getElementById('password_input')
    if (password_input) {
        password_input.onkeypress = password_inputokp
    }
}




function count_down() {

    var message_node = document.getElementById('countdown')

    if (count_down_now <= 0) {
        count_down_now = 0
    }

    // innerHTML now works in most browsers.
    if (count_down_now == 0) {
        // Expire

        var inputUser = document.getElementById("user")
        inputUser.disabled = true;
        var inputPassword = document.getElementById("pwd")
        inputPassword.disabled = true;
        var inputSubmit = document.getElementById("signin")
        inputSubmit.style.visibility ='hidden';
        message_node.innerHTML = 'You took too long to log in. <a href="' + get_current_location() +'">Try again.<\/a>'
    } else {
        message_node.innerHTML = 'This page expires in ' + Math.floor(count_down_now/1000) + ' seconds.'
        count_down_now -= 1000
        setTimeout(count_down, 1000)
    }
}

function searchGet(){
  value = document.getElementById('Template_AutoId3_quickSearch').value;
  location.href = 'http://test.scottwilson.com/ScottWilson/system_pages/search.aspx?terms='+value;
}


