if(typeof im!="object"||im==null){
    var im={}
}
if(typeof im.common!="object"||im.common==null){
    im.common={}
}

im.common.updateScrollableContentHeight = function(force, minHeight, maxHeight) {
    if(undefined == minHeight) {
        minHeight = 350;
    }
    
    var  offsetBottom = $j('#box3').innerHeight();
    
    var headerHeight = $j('.scrolledContent .viewport').offset().top;
    
    var windowHeight = $j(window).height();
    var scrolledContentHeight = $j('.scrolledContent .overview').innerHeight();
    
     
    var newHeight=windowHeight-headerHeight-offsetBottom;
    newHeight = (newHeight<minHeight) ? minHeight : newHeight;
    
    $j('.scrolledContent .viewport').css('height',(newHeight)+'px');
    if ( force) {
        $j('.scrolledContent').tinyscrollbar_update('relative');
    }
}

im.common.init = function() {
    scrolledContent = $j('.scrolledContent');
    if ( scrolledContent.hasClass('scrolledContent') ) {
        im.common.updateScrollableContentHeight();
        
        var updateTimeout = false;
        
        $j(window).resize(function(){
            if ( false !== updateTimeout ) window.clearTimeout(updateTimeout);
            updateTimeout = window.setTimeout(function(){
                im.common.updateScrollableContentHeight(true);
                updateTimeout=false;
            }, 77);
        });
    }
    $j('.scrolledContent').tinyscrollbar();
}

var scrolledContent;

$j(document).ready(function(){
    im.common.init();
});

