function nav_update_buttons() {
    var c = document.nav.thread.options[document.nav.thread.selectedIndex].value.split(',');
    document.nav.frst.value = c[0];
    document.nav.frst.disabled = isNaN(parseInt(c[0]));
    document.nav.prev.value = c[1];
    document.nav.prev.disabled = isNaN(parseInt(c[1]));
    document.nav.next.value = c[2];
    document.nav.next.disabled = isNaN(parseInt(c[2]));
    document.nav.last.value = c[3];
    document.nav.last.disabled = isNaN(parseInt(c[3]));
}

function nav_press_buttons(button) {
    // actually go to the required page
    var c = document.nav.thread.options[document.nav.thread.selectedIndex].value.split(',');
    var url = 'http://www.megatokyo.it/?lang=it&id=' + parseInt(c[button]);
    if (c[4] == 'c')
	url += '&char=' + c[5];
    else if (c[4] == 's')
	url += '&story=' + c[5];
    window.location.href = url;
}

function storyboard_switch() {
    var storyboard = document.getElementById('storyboard');
    var tooltip = document.getElementById('tooltip');
    if (storyboard.clientHeight < 100) {
	storyboard.style.height == '';
	storyboard.style.overflow = 'visible';
	tooltip.textContent = '';
    } else if (storyboard.style.height == '') {
	storyboard.style.height = '100px';
	storyboard.style.overflow = 'hidden';
	tooltip.textContent = 'clicca per espandere';
    } else {
	storyboard.style.height = '';
	storyboard.style.overflow = 'visible';
	tooltip.textContent = 'clicca per restringere';
    }
    return true;
}
