// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function stopPropagation(e) {
    e = e||event;
    e.stopPropagation? e.stopPropagation() : e.cancelBubble=true;
}

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

function resizeFromBottom(id, extra_offset) {
    //alert("resizeFromBottom(" + id + ", " + extra_offset + ")");
    newHeight = (document.viewport.getHeight() - $(id).offsetTop);
    //alert("resizeFromBottom(" + id + ", " + extra_offset + "): offsetTop: " + $(id).offsetTop + ", new height: " + newHeight);
    $(id).setStyle({height: (newHeight - extra_offset) + 'px'});
}
