addLoadEvent(lagBillede);

function addLoadEvent(func) {
  var oldonload = window.onload;
    if (typeof window.onload != 'function') {
      window.onload = func;
    } else {
      window.onload = function() {
      oldonload();
      func();
    }
  }
}

function lagBillede()
{
  if(document.getElementById('caseBillede'))
  {
    var img = document.getElementById('caseBillede').innerHTML;
    var moveImg = document.getElementById('contentImage');
        moveImg.innerHTML = img;
  }
}

 var t=null;

      function scroller(theelement, startheight, endheight, maxspeed, softness) 
      {
        var el=document.getElementById(theelement);
        
        if (el.scrollTop != endheight) {
          var distanceend=Math.abs((endheight - el.scrollTop) / softness);
          var distancestart=Math.abs((startheight - el.scrollTop) / softness);
          var distance=Math.min(distancestart, distanceend);
          var multiplier;
          
          if (distance<1)
          { 
            multiplier=Math.abs(distance-1)+1;
          } else 
          {
            multiplier=1;
          }
          
          distance=Math.ceil(distance);
          
          if (distance==0)
          {
            distance=1;
          }
          
          if (distance>maxspeed)
          {
            distance=maxspeed;
          }
          
          if (startheight > endheight)
          {
            distance=-distance;
          }
          
          var tempscrolltop=el.scrollTop;
          
          el.scrollTop+=distance;
          
          if (tempscrolltop+distance==el.scrollTop)
          {
            t=setTimeout('scroller(\''+theelement+'\','+
            startheight+','+endheight+','+maxspeed+','+
            softness+')',Math.round(1 * multiplier));
          } else
          {
            t=null;
          }  
        } else
        {
          t=null;
        }
      }
      
      function scroll(theelement, distance) {
        if (!t) {                                             //  1
          var element=document.getElementById(theelement);    //  2
          var startheight=element.scrollTop;                  //  3
          var endheight=element.scrollTop+distance;           //  4
          if (endheight < 0) endheight=0;                     //  5
          scroller(theelement, startheight, endheight, 10000000,1);//  6
        }
      }