
/*
 *  Allow tabbing by setting onFocus and onBlur
 */

function add_focus() {
    //var code = document.getElementById("code");
    var code = document.getElementsByTagName("body")[0];
    if (!code) return;

    var hotspots = code.getElementsByTagName("A");
    if (!hotspots) return;
    
    var first = -1;

    for (var i = 0; i < hotspots.length; i++) {
        if (hotspots[i].onmouseover) hotspots[i].onfocus = hotspots[i].onmouseover;
        if (hotspots[i].onmouseout) hotspots[i].onblur = hotspots[i].onmouseout;
        if (first < 0 && hotspots[i].onmouseover) first = i;
    }

    if (first != -1) {
       if (first > 0) {
          hotspots[first - 1].focus();
          hotspots[first - 1].blur();
       } else {
          hotspots[first].focus();
       }
    }
}

window.onload = add_focus;