const MOBILE_NAV_PAGE_SIZE = 475; // px
const MOBILE_NAV_TOGGLE_TIME = 300; // msec
const TEXTAREA_MIN_SIZE = 120; // px

function mobile_nav_toggle() {
    $("nav > a").slideToggle(MOBILE_NAV_TOGGLE_TIME);
}

$(window).resize(function () {
    if(window.innerWidth > MOBILE_NAV_PAGE_SIZE) {
        $("nav > a").show(0);
    }
    else {
        $("nav > a").hide(0);
    }
});

$('textarea').each(function () {
    this.style.height = Math.max(this.scrollHeight, TEXTAREA_MIN_SIZE) + 'px';
    this.style.resize = 'none';
    this.style.overflowY = 'hidden';
}).on('input', function () {
    this.style.height = 'auto';
    this.style.height = Math.max(this.scrollHeight, TEXTAREA_MIN_SIZE) + 'px';
});