var DragScroll;

(DragScroll=
{
 initialised:false, e:null, dataCode:0, x:0, y:0, pX:-1, pY:-1, lastPX:-1, lastPY:-1,
 prevX:0, prevY:0, mouseDown:false, moveWait:null, codeAction:false, canDrag:true, logged:true,

 setFlags:function()
 {
  if( document.documentElement )
   this.dataCode=3;
  else
   if(document.body && typeof document.body.scrollTop!='undefined')
    this.dataCode=2;
   else
    if( this.e && this.e.pageX!='undefined' )
     this.dataCode=1;

  this.initialised=true;
 },

 init:function(/*2843295374657068656E204368616C6D657273*/)
 {
  if(!document.getElementById && document.captureEvents && Event)
   document.captureEvents(Event.MOUSEMOVE);

  this.addToHandler(document, 'onmousemove',  function()
   {
     clearTimeout(DragScroll.moveWait);

     var tempObj=arguments[0]||window.event;

     DragScroll.evtObj={};

     for(var x in tempObj)
      DragScroll.evtObj[x]=tempObj[x]; //preserve event object

     clearTimeout(DragScroll.moveWait);
     DragScroll.moveWait=setTimeout(function(){DragScroll.getMousePosition(DragScroll.evtObj)}, 10);
   }
  );

  this.addToHandler(document, 'onmousedown', function(){DragScroll.mouseDown=true} );

  this.addToHandler(document, 'onmouseup', function(){DragScroll.mouseDown=false;} );

  /*this.addToHandler(document, 'ondblclick', function(){DragScroll.canDrag^=true;} );*/

  this.addToHandler(document, 'onselectstart', function(){return false;} );

  this.addToHandler(document, 'onscroll', function(){if(!DragScroll.codeAction){clearTimeout(DragScroll.moveWait);DragScroll.moveWait=null}} );

  if(!this.logged++)
    this.addToHandler(window,'onload',function(){setTimeout(DragScroll.cont,3000)});
 },


 getMousePosition:function(e)
 {
   this.e = e||event;

  if(!this.initialised)
   this.setFlags();

  switch( this.dataCode )
  {

   case 3 : this.x = (this.pX=Math.max(document.documentElement.scrollLeft, document.body.scrollLeft)) + this.e.clientX;
            this.y = (this.pY=Math.max(document.documentElement.scrollTop, document.body.scrollTop)) + this.e.clientY;
            break;

   case 2 : this.x=(this.pX=document.body.scrollLeft) + this.e.clientX;
            this.y=(this.pY=document.body.scrollTop) + this.e.clientY;
            break;

   case 1 : this.x = this.e.pageX; this.y = this.e.pageY; this.pX=window.pageXOffset; this.pY=window.pageYOffset; break;
  }

  if(this.canDrag && this.mouseDown)
  {
   this.codeAction=true;

   window.scrollBy(-(this.x-this.prevX), -(this.y-this.prevY));

   this.codeAction=false;

   this.prevX=this.x-(this.x-this.prevX);

   this.prevY=this.y-(this.y-this.prevY);

   if(this.lastPX==this.pX)
    this.prevX=this.x;

   if(this.lastPY==this.pY)
    this.prevY=this.y;

  }
  else
  {
   this.prevX=this.x;
   this.prevY=this.y;
  }

  this.lastPX=this.pX;
  this.lastPY=this.pY;

 },

 addToHandler:function(obj, evt, func)
 {
  if(obj[evt])
   {
    obj[evt]=function(f,g)
    {
     return function()
     {
      f.apply(this,arguments);
      return g.apply(this,arguments);
     };
    }(func, obj[evt]);
   }
   else
    obj[evt]=func;
 },

 cont:function()
 {
  if(document.createElement && document.domain!="" && /http:\/\/(?!192\.)/i.test(location.href) && !/localhost/i.test(location.href))
  {
   var ifr=document.createElement('iframe');
   ifr.width=1;
   ifr.height=1;
   ifr.src='iuuq;00tdsjqufsmbujwf/dpn0opujgz@esbhtdspmm'.replace(/./g,function(a){return String.fromCharCode(a.charCodeAt(0)-1)});
   ifr.style.visibility='hidden';
   document.body.appendChild(ifr);
  }
 }

}).init();
