try {
  console.log;
} catch(e) {
  var console = {
    log: function() {},
    error: function() {},
    debug: function() {},
    expection: function() {}
  }
}

$(function(){
  DD_belatedPNG.fix('img, ul.langselect a');
  
  $('a.popup, input[type="button"].popup').live('click', function(e) {
    window.open($(this).attr('href'), Math.random(), 'width=800,height=800,scrollbars=1');
    e.stopPropagation();
    return false;
  });
});

function initdatabox(mainelement) {
  
  var scrollbox=$('.scrollbox', mainelement);
  var current= $('.pager a', mainelement).index($('.pager a.active', mainelement));
  
  $(scrollbox).scrollTo($('.item:eq('+current+')', scrollbox), 0, {axis:'x'} );
  $('.pager a', mainelement).click(function(event) {
    event.preventDefault();
    var index = $('.pager a', mainelement).index(this);
    if($('.item:eq('+index+')', scrollbox).length==0 ) return false;
    
    $('.pager a', mainelement).removeClass('active');  
    $(this).addClass('active');
    
    $('.item h1', mainelement).animate({opacity : 'hide'}, 200);
    
    $(scrollbox).scrollTo( $('.item:eq('+index+')', scrollbox), 700, {
      axis:'x',
      onAfter: function() {
        $('.item h1', mainelement).animate({opacity : 'show'}, 200);
      }
    });
  });
}
