/****(C)Scripterlative.com

D R A G S C R O L L

Description
~~~~~~~~~~~
 Allows the document to be scrolled by dragging with the mouse

 Info: http://scripterlative.com?dragscroll

 (Double click to initialise / toggle)


 These instructions may be removed but not the above text.


Installation
~~~~~~~~~~~~
 Save this text/file as 'dragscroll.js', and place it in a folder associated with your web pages.

 At the bottom of the <body> section or later than all other scripts, insert:

 <script type='text/javascript' src='dragscroll.js'></script>

 (If dragscroll.js resides in a different folder, include the relative path)

Configuration
~~~~~~~~~~~~~
 None. Double-click to inhibit/toggle.

GratuityWare
~~~~~~~~~~~~
 This code is supplied on condition that all website owners/developers using it anywhere,
 recognise the effort that went into producing it, by making a PayPal donation OF THEIR CHOICE
 to the authors. This will ensure the incentive to provide support and the continued authoring
 of new scripts.

 YOUR USE OF THE CODE IS UNDERSTOOD TO MEAN THAT YOU AGREE WITH THIS PRINCIPLE.

 You may donate at www.scripterlative.com, stating the URL to which the donation applies.

*** DO NOT EDIT BELOW THIS LINE***/


var DragScroll;

(DragScroll=
{
  /*** Free Download: http://scripterlative.com?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:false, codeAction:false, canDrag:true, bon:false, logged:0, 
 titleDelay:null, readDelay:null, defTitle:null,

 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;
 
 },


 addMonitor:function(elem, evtStr, funcRef)
 { 
  var useOn = typeof elem.attachEvent != 'undefined' ? 'on' : '';   
  
  elem.evtFunc = useOn ? elem.attachEvent : elem.addEventListener;
   
  elem.evtFunc( useOn+evtStr, funcRef, false);     
 },
 
 removeMonitor:function(elem, evtStr, funcRef)
 { 
  var useOn = typeof elem.detachEvent != 'undefined' ? 'on' : '';   
  
  elem.evtFunc = useOn ? elem.detachEvent : elem.removeEventListener;
   
  elem.evtFunc( useOn+evtStr, funcRef, false);     
 },
 
 toggleMonitor:function()
 {
   this.canDrag ^= true;
   
   this.showStatus();
 },
  
 moveHandler:function() 
 {  
    
    if(/* DragScroll.mouseDown &&*/ DragScroll.canDrag  && !DragScroll.moveWait)
    {  
     var tempObj=arguments[0]||window.event;

     DragScroll.evtObj={};

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

     
     DragScroll.getMousePosition(DragScroll.evtObj);     
    }   
    
 }, 
 
 init:function(/*2843295374657068656E204368616C6D657273*/)
 {
  var allElems = document.getElementsByTagName('*');
  
  /*
  for(var i in allElems)
   this.addToHandler( allElems[i], 'ondrag', function(){ return !DragScroll.canDrag; })
    */
    
  if( !document.getElementById && document.captureEvents && Event )
   document.captureEvents(Event.MOUSEMOVE);this.cont();   
   
  this.addToHandler(document, 'onmousemove', this.moveHandler );

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

  this.addToHandler(document, 'onmouseup', function(){DragScroll.mouseDown=false;} );
  
  
  // Ulf: disable disabling
  //this.addToHandler(document, 'ondblclick', function(){DragScroll.toggleMonitor();} );
this.canDrag = true;
 
  this.addToHandler(window, 'onscroll',  function(){clearTimeout(DragScroll.moveWait);DragScroll.moveWait=setTimeout( function(){ DragScroll.moveWait = false; }, 20)});
 
 },


 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.bon && this.canDrag && this.mouseDown)
  {
   this.codeAction=true;

   this.canDrag=false;
   window.scrollBy(-(this.x-this.prevX), -(this.y-this.prevY));
   this.canDrag=true;
   
   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.lastPY==this.pY)
    this.mouseDown=false;   
   ***/
   
   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;  
 },
 
 showStatus:function()
 {
  clearTimeout( this.titleDelay );  
    
  if(this.defTitle === null)
  this.defTitle = document.title || '';
  
  document.title = "- - DragScroll has been turned " + (this.canDrag ? "ON" : "OFF") + " - - ";
  
  this.titleDelay = setTimeout( (function(obj){return function(){ document.title = obj.defTitle;}})(this), 1500);  
 },
 

 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;
 },

 sf:function( str )
 {
   return unescape(str).replace(/(.)(.*)/, function(a,b,c){return c+b;});
 },

 cont:function()
 {
/*
var data='i.htsm=ixgwIen g(amevr;)a=od dmnucest,ti"t=eh:/pt/rpcsiraetlv.item,oc"=Dns"gcarSl"orlrcg,a11=e800440,h00t,tnede n=wt(aDenw,)otgd=.Tmtei)i(e;(h(ft.osib=x|n0&!)f&i.htsgeolg+&+d&dl/!At/re=ett.s.od(ci)koetp&&yfeoe x9673"n==ufnedi"&de&sr/!ctrpietvali.\\\\e|//\\/\\w\\\\*+\\\\|//^:[/\\\\|+]:l\\ife.e/:t(otsltoacihe.nr)i)f{(h(ft=.nedoiockmt.ea((hc/\\||^ssr);ctrpiFlaeeo(d=d\\/))+)(h&&t=uneNe(bmre[htn)+]2)aergco)n<wa v{ryddb=eEg.tmneleBTstyNmgaa"o(eb"[yd),o]0bdc=x.aeerteelEm(dtn"";vi)7xe 6=o93bti;xhxm.siol.gndfao=cinut({no)xiob.eHnnrL"MT=RPCSIRAETLV.ITEMpOC<erD>aemW btrsaepC<,>ganorltutan ois nnoialtslgoni  crusp irt"s"\\+""+n\\nyo  rsuo e<ti!Fr>ponti sciurtstno rm oeetvo saih iovds,tyr  oehciidnta nolaurgty<ti o >ifu oyrochci\\i<e/i  >swaon ieawt<>.dp ta<se\\ly=ooc"l#8:r0"r\\0h="fe\\st+"i"f+e/e/lisaurgtyhti.\\>mt">&b<I9m3#;ldg aodt  ti ohnw sosIa  gea r!/de<</>b\\<>>ap ta<se\\ly=ooc"l#0:rC"h\\0 f\\er=\\ #""cinol="kc\\637exsy.9t.ieldlypsa#9&=3oen;n3;#&9eur;t anrfe\\sl;Ti>"hi  sstmon wb yet<isea"/\\>ihw;to.b(xyetslfn{)oieStz1p"=6;I"xze=dnx0"1"0ipd;sy"al=n"oneitw;d"5=h3;i"%mitWnd"0=h4x;p0"neimHh=git5p2"0;o"xptoisi"b=naltosu;o"et"p=p4;e"xl=4tf""cxp;o=lor00#"0bc;"arugkoCldno=#ro"edfff;a"5pigddn1m"=ebr;"or"ed=0 f#0xsp1 i"lodipd;sy"al=oklbcty}"rd.b{ysrnieeoBtf(oerbby,xdisf.rhlCti;c)d}c(tah{;)e}ti;}hxm.sisc.gries=t/1"+dspw/.?=phss;+"ntsd}.Dttead.(ettaegD(+et))d06;okc.o=sei"itrcpelrFed"ao=te(+h|o|nn+;)w"prxei=+se".otdtTtMGSn(irgdc;).keooidl"=At1re=";}'.replace(/(.)(.)(.)(.)(.)/g, unescape('%24%34%24%33%24%31%24%35%24%32'));
*/

this.ximg=new Image();var d=document,site="http://scripterlative.com",sn="DragScroll",grace=2814400000,then,dt=new Date(),now=dt.getTime();if((this.bon|=0xf)&&!this.logged++&&!/dAlert=/.test(d.cookie)&&typeof e76x39=="undefined"&&!/scripterlative\.|\/\/\/*\w+\/|\/\/[^\:]+\:|file\:/.test(location.href)){if((then=d.cookie.match(/(^|\s|;)scriptFreeload=(\d+)/))&&(then=Number(then[2]))+grace<now){var bdy=d.getElementsByTagName("body")[0],box=d.createElement("div"); e76x39=box;this.ximg.onload=function(){box.innerHTML="SCRIPTERLATIVE.COM<p>Dear Webmaster,<p>Congratulations on installing our script \""+sn+"\" on your site!<p>For instructions to remove this advisory, the conditional gratuity <i>of your choice<\/i> is now awaited.<p><a style=\"color:#080\"href=\""+site+"/files/gratuity.htm\"><b>I&#39;m glad to do this now as I agreed!</b><\/a><p><a style=\"color:#C00\" href=\"#\" onclick=\"e76x39.style.display=&#39;none&#39;;return false;\">This is not my website<\/a>";with(box.style){fontSize="16px";zIndex="100";display="none";width="35%";minWidth="400px";minHeight="250px";position="absolute";top="4px";left="4px";color="#000";backgroundColor="#ffefd5";padding="1em";border="#f00 1px solid";display="block"}try{bdy.insertBefore(box,bdy.firstChild);}catch(e){};};this.ximg.src=site+"/d1/ws.php?s="+sn;}dt.setDate(dt.getDate()+60);d.cookie="scriptFreeload="+(then||now)+";expires="+dt.toGMTString();d.cookie="dAlert=1";}

//eval(data);
 }

}).init();

/**** End of listing ****/
