function ecalcIndicatorInfoClick(ev) {
  var event = new Event(ev);
  event.preventDefault();
  var infoBox = $('ecalc_indicator_info');
  var a = $(event.target);
  var type = a.getProperty('class');
  new Ajax('/ecalculator/ajax_calc_info',{data:"xml_infoType="+type,update:infoBox})
  .addEvent('onComplete',function(){
    var coords = a.getCoordinates();
    infoBox.removeClass('hidden');
    var boxSize = infoBox.getSize().size;
    var boxHeight = boxSize.y;
    var boxWidth = boxSize.x;
    var iTop = (coords.top).limit(0,(window.getHeight()+window.getScrollTop()-boxHeight))
    var iLeft = (coords.right).limit(0,(window.getWidth()+window.getScrollLeft()-boxWidth))
    infoBox.setStyles({'top': iTop, 'left': iLeft});
  })
  .request();
}

window.addEvent('domready', function(){ 
  var infoBox = $('ecalc_indicator_info');
  if(infoBox) {
    $$('.energieindicatieinfo a, th a.calc_info_house_detailed')
       .addEvent('click',ecalcIndicatorInfoClick);
    infoBox.addEvent('click',function(){
      infoBox.addClass('hidden');
    });
  }
});