/*
 * Nastavi poziciu pagera tak, aby bol vzdy uplne na konci contentu
 */
function movePager() {
        if ($('pager-3')) {
            var contentHeight = $('pager-3').up(1).getHeight();
            var fromContentTop = $('pager-3').up(0).cumulativeOffset()[1] - $('pager-3').up(1).cumulativeOffset()[1];
            var rightColumnHeight = $("right-column").getHeight();
            
            
//            alert("contentHeight: " + contentHeight);
//            alert("rightColumnHeight: " + rightColumnHeight);
            //alert($('pager-3').up(0).cumulativeOffset()[1]);
            
            if ((rightColumnHeight) > (contentHeight)) {
	            if ((fromContentTop + 28) < contentHeight ) {
	                $('pager-3').up(0).absolutize();
	                $('pager-3').up(0).setStyle({'top': (contentHeight - 28) + 'px'});
	                //$('pager-3').up(0).removeStyle({'top'});
	                $('pager-3').up(0).setStyle({'height': '26px'});
	            }
            } else {
            	$('pager-3').up(0).setStyle({'position':'static'});
            	
            }
        }
    }

/*
 * ak su prave boxiky dlhsie ako obsah, tak obsah natiahnem dole
 */
function setContentHeight() {
	if ($("right-column")) {
        var rightColumnHeight = $("right-column").getHeight();
        var contentHeight = $("content").getHeight();
        if (rightColumnHeight > contentHeight) {
            rightColumnHeight -= 17;
            $("content").setStyle({minHeight:rightColumnHeight + 'px' });
        }
    }
}

function setRelatedLinksHeight() {
	if ($("related-links")) {
	    var height = $("related-links").getHeight();
	    //alert("height: " + height);
	    var top = $("related-links").cumulativeOffset()[1];
	    //alert("top: " + top);
	    var contentHeight = $("related-links").up(0).getHeight();
	    //alert("contentHeight: " + contentHeight );
	    var contentTop = $("related-links").up(0).cumulativeOffset()[1];
	    //alert("contentTop: " + contentTop);
	    var diff = top - contentTop;
	    //alert("diff: " + diff);
	    var newHeight = contentHeight - diff;
	    var newHeightWithoutPaddingAndBorder = newHeight - 51;  
	    //alert("newHeight: " + newHeight);
	    if (height < newHeight) $("related-links").setStyle({'height': newHeightWithoutPaddingAndBorder + 'px'});
	}
}