function dom_init() {
  
  $('.gallery br').remove();
  $('.thumbs img').wrap('<a href="#"></a>');
  $('.thumbs a:even').each(function(i){
    $(this).attr('id', 'gall-'+i).addClass('even').click(function(){
      $(this).parent().next().find('img, .mejs-container').fadeOut();
      $(this).parent().find('.active').hide().removeClass('active').prev().show();
      $(this).next().show().addClass('active').prev().hide();
      $('.large-'+i).fadeIn(200);
      return false;
    });
  });
  $(this).find('.thumbs a:odd').addClass('odd').hide().click(function(){
    return false;
  });
  
  $('video').mediaelementplayer({features: ['playpause','progress','duration','fullscreen']});
  
  $('.large > *, .newsitem img').not('script').each(function(i){
  
    $(this).addClass('large-'+i);
    
    var suffix = this.src.substr(this.src.length-3, 3);
    if (suffix == "mp4" || suffix == "flv") {
      var myid = this.id = "flash"+i;
      var poster = this.src.substr(0,this.src.length-3)+"jpg";
      
      $(this).wrap('<video id="'+myid+'" src="'+this.src+'" poster="'+poster+'" height="288" width="512" controls></video>').parent().mediaelementplayer({features: ['playpause','progress','duration','fullscreen']}).closest('.mejs-container').addClass('large-'+i);
      
     }
     
  });
  
  
  
  
  
  $('.gallery').each(function(){
    $(this).find('.large img').not('.large img:first-child').hide();
    $(this).find('.thumbs a:first-child').hide().next().show().addClass('active');
  });
}
