$(function () {
  $('.bubbleInfo').each(function () {
    var distance = 20;
    var time = 350;
    var hideDelay = 100;
    var hideDelayTimer = null;
    var beingShown = false;
    var shown = false;
    var trigger = $('.trigger', this);
    var info = $('.popup', this).css('opacity', 0);

    $([trigger.get(0), info.get(0)]).mouseover(function () {
      if (hideDelayTimer) {
        clearTimeout(hideDelayTimer);
      }
      if (beingShown || shown) {
        // don't trigger the animation again
        return;
      } else {
        // reset position of info box
        beingShown = true;
        info.css({
          top: 24,
          left: 5,
          display: 'block',
        }).animate({
          right: '-=' + distance + 'px',
          opacity: 1
          }, time, 'swing', function() {
          beingShown = false;
          shown = true;
        });
      }
      return false;
    }).mouseout(function () {
      if (hideDelayTimer) {
        clearTimeout(hideDelayTimer);
      }
      hideDelayTimer = setTimeout(function () {
        hideDelayTimer = null;
        info.animate({
          top: '-=' + distance + 'px',
          opacity: 0
          }, time, 'swing', function () {
          shown = false;
          info.css('display', 'none');
        });
      }, hideDelay);
      return false;
    });
  });
});

function showRss(d) {
  $('#description_'+d).slideToggle("fast");
  $('#description_'+d+'_icon').toggleClass('toggle_expand');
  $('#description_'+d+'_icon').toggleClass('toggle_collapse');
}

function resize(objs,col) {
  if (col==1){
    for (var i = 0; i < objs.length; i++) {
      var width = parseInt($(objs[i]).attr('width')); 
      if(width > 160) {  
        $(objs[i]).attr('width',160).attr('height',160);  
      }  
    }               
  }
  if (col==2){
    for (var i = 0; i < objs.length; i++) {
      var width = parseInt($(objs[i]).attr('width')); 
      if(width > 340) {
        $(objs[i]).attr('width',340).attr('height',340);
      }
    }
  }
}  