// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
Event.addBehavior.reassignAfterAjax = true;
Event.addBehavior({
'div.pagination a' : Remote.Link
});


function check_chars_left(comment, limit) {
    if (comment.value.length > limit) {
        comment.value = comment.value.substring(0, limit-1);
    }
    $('chars_left').innerHTML = (limit - comment.value.length) + ' chars left';
}

function disableKeyPress(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}

var side_div;
var main_div;

function setMainDivHeight(check_height) {
    if (side_div != null && main_div != null) {
        if (!check_height || side_div.getHeight() > main_div.getHeight()) {
            main_div.setStyle({height: side_div.getHeight() + 'px'});
        }
    }
}

function callOnLoad () {
    setMainDivHeight(true);
}
