
 function adjustElementsHeight(){
    
    leftColumnHeight =  $('column_left').getHeight();
    rightColumnHeight = $('column_right').getHeight();
    foldersHeight =     $('box').getHeight();

  if (leftColumnHeight > rightColumnHeight){
      $('main_text').setStyle({
        height: (leftColumnHeight - foldersHeight  - 90 )  + 'px'
      });
    
  }else {
      $('news').setStyle({
        height: (rightColumnHeight - 272) + 'px'
      });
  }
}

function checkDivValue(current_headline)
    {
            if (current_headline)
            {
               //$('#down').css('display', 'block');
               //$("#down").addClass("block").show("slow");
               $("#down").removeClass("display_none")
            }
            else
            {
                //$('#down').css('display', 'none');
                //$("#down").addClass("none").show("slow");
                $("#down").addClass("display_none")
            }
            
            if (current_headline==(headline_count-1))
            {
               //$('#up').css('display', 'none');
               //$("#up").addClass("none").show("slow");
               $("#up").addClass("display_none")
            }
            else
            {
                //$('#up').css('display', 'block');
                //$("#up").addClass("block").show("slow");
                $("#up").removeClass("display_none")
            }
    }

var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline=0;

$(document).ready(function(){
  headline_count = $("div.headline").size();
  $("div.headline:eq("+current_headline+")").css('top','0px');
  

  $('#up').click( function() {
    headline_rotate_up();
  });
    $('#down').click( function() {
    headline_rotate_down();
  });
    checkDivValue(current_headline);
    //alert(headline_count);
});

function headline_rotate_up() {
  current_headline = (old_headline + 1) % headline_count; //remainder will always equal old_headline until it reaches headline_count - at which point it becomes zero. clock arithmetic
  $("div.headline:eq(" + current_headline + ")").css('top','600px'); 
  $("div.headline:eq(" + old_headline + ")").animate({top: -600},400, function() {
    $(this).css('top','-900px');
    });
  $("div.headline:eq(" + current_headline + ")").show().animate({top: 0},400);
  checkDivValue(current_headline);
  old_headline = current_headline;
};
function headline_rotate_down() {
  current_headline = (old_headline -1) % headline_count; //remainder will always equal old_headline until it reaches headline_count - at which point it becomes zero. clock arithmetic
    if (current_headline == -1) {
    current_headline = headline_count -1 }
  $("div.headline:eq(" + current_headline + ")").css('top','-600px'); 
  $("div.headline:eq(" + old_headline + ")").animate({top: 600},400, function() {
    $(this).css('top','600px');
    });
  $("div.headline:eq(" + current_headline + ")").show().animate({top: 0},400);
  checkDivValue(current_headline); 
  old_headline = current_headline;
};


