
   //    these scripts are licensed under
   //    Creative Commons Attribuzione-Condividi allo stesso modo 2.5 Italia License
   //    http://creativecommons.org/licenses/by-sa/2.5/it/

jQuery(function($){

  var $popup = $('#popup-news');

  if(!$popup.size() || !$('#popups-list').size()){
    return;
  }

  $('#popup-news .popup-close').show();
  $('.popup-close a', $popup).click(function(e){
    $(this).parent().parent().parent().hide();
    return false;
  })

  var p_width = 550;
  var p_height = 0;

  $popup.css({
    position: 'absolute'
    ,height: 1
    ,width: p_width
    ,zIndex: 200
    ,right: ((-1*p_width  )-5)
  })
  .animate({
    height: p_height
  }, 600);

  var pos_pop = function(){
      $popup
      .css({
        right: 5
        ,top: ($(document).scrollTop() + ($('#menu').offset().top + $('#menu').height() + 5))
      });
//     console.log($(document).scrollTop());
  }

  pos_pop();
  $(window).scroll(function(){      if( ! $popup.height() > $(document).height()) pos_pop(); });

});