function dom_init() {

  // See http://fancybox.net/api for all options
  
  $("a.imagelink").fancybox({
    'speedIn' : 600,
    'speedOut' : 300
	});
	
	$("a[href^='http']").not('a[href*=abusix.]').addClass('external').attr('target', '_blank');
	
	runtext($('#runtext li').length);

}


function runtext(number) {
  $('#runtext').animate({
      top: '0'
    }, 5000, function() {
      var gap = 65;
      var aniblock = $('#runtext .block')[0];
      var curpos = aniblock.style.top;
      curpos = curpos.substr(0, curpos.length-2);
      curpos = (curpos * (-1) / gap) + 1;
      if (curpos < number) {
        $(aniblock).animate({
            top: '-='+gap
          }, 2000, function() {
            runtext(number);
          });
      } else {
        $(aniblock).animate({
            top: '-='+(gap/2)
          }, 1000, function() {
            $(this).css('top',(gap/2)+"px").animate({
                top: '0'
              }, 1000, function() {
                runtext(number);
              });

          });
      }
      
    });
}
