// utils.js - JavaScript utilities for FAB.

// popup image script: enclose image in a link as follows:
// <a href='javascript:popup("myimg.jpg")'><img ... ></a>
function popup(url)
{
    var win = window.open('','','menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,resizable=yes,height=800,width=800');
    win.document.writeln('<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">');
    win.document.writeln('<html><head></head><body style="border:0px; margin:0px">');
    win.document.writeln('<html><head><script>');
    win.document.writeln('function sizeMe()');
    win.document.writeln('{');
    if (navigator.appName=="Netscape")
    {
        win.document.writeln('  iWidth = window.innerWidth;');
        win.document.writeln('  iHeight = window.innerHeight;');
    }
    else
    {
        win.document.writeln('  iWidth = document.body.clientWidth;');
        win.document.writeln('  iHeight = document.body.clientHeight;');
    }
    win.document.writeln('  iWidth = document.images[0].width - iWidth;');
    win.document.writeln('  iHeight = document.images[0].height - iHeight;');
    win.document.writeln('  window.resizeBy(iWidth, iHeight);');
    win.document.writeln('  self.focus();');
    win.document.writeln('}');
    win.document.writeln('</script></head><body style="border:0px; margin:0px">');
    win.document.writeln('<img style="border:0px; margin:0px" src="' + url + '" onLoad="sizeMe()">');
    win.document.writeln('</body></html>');
    win.document.close();
}

// onchange callback for seasonSelector()
function selectSeason()
{
    var yr = document.nav.season.selectedIndex + 78;
    var address="../" + (yr) + "_" + (yr+1) + "/";
    document.location = address;
}

// dropdown season selector
function seasonSelector(now)
{
    document.writeln('<form name=nav>');
    document.writeln('Jump to: <select name="season" size=1 onchange="selectSeason()">');
    var yr = 78;
    for (yr = 78; yr < 84; yr++)
    {
        if (yr == now)
        {
            document.writeln('<option selected>Select season');
        }
        else
        {
            document.writeln("<option>19"+yr+"-19"+(yr+1)+"\n");
        }
    }
    document.writeln('</select></form>');
}

