function addEvent (obj, evType, fn) {
    if (obj.addEventListener) {
        obj.addEventListener(evType, fn, true);
        return true;
    } else if (obj.attachEvent) {
        return obj.attachEvent("on" + evType, fn);
    } else {
        return false;
    }
}

function sizeHomeBoxes() {
    if ( (document.getElementById('box1') != null) && (document.getElementById('box2') != null) && (document.getElementById('box3') != null) ) {
        // Get heights of boxes in first row
        var row1A = new Array();
        row1A[0] = document.getElementById('box1').offsetHeight;
        row1A[1] = document.getElementById('box2').offsetHeight;
        row1A[2] = document.getElementById('box3').offsetHeight;
        // Find tallest box
        var row1H = Math.max.apply(null, row1A);
        //Set heights for row1
        document.getElementById('box1').style.height = row1H + "px";
        document.getElementById('box2').style.height = row1H + "px";
        document.getElementById('box3').style.height = row1H + "px";
    }
    
    if ( (document.getElementById('box4') != null) && (document.getElementById('box5') != null) ) {
        // Get heights of boxes in second row
        var row2A = new Array();
        row2A[0] = document.getElementById('box4').offsetHeight;
        row2A[1] = document.getElementById('box5').offsetHeight;
        // Find tallest box
        var row2H = Math.max.apply(null, row2A);
        //Set heights for row1
        document.getElementById('box4').style.height = row2H + "px";
        document.getElementById('box5').style.height = row2H + "px";
    }
}

function sizeHomeCols() {
    col1 = document.getElementById('col1').offsetHeight;
    col2 = document.getElementById('col2').offsetHeight;

    if (col1 > col2) {
        document.getElementById('box1').style.height = col2 + "px";
    } else {
        document.getElementById('box2').style.height = col1 + "px";
    }
    
}

addEvent(window, 'load', sizeHomeBoxes);
addEvent(window, 'resize', sizeHomeBoxes);
//addEvent(window, 'load', sizeHomeCols);
//addEvent(window, 'resize', sizeHomeCols);
