/*

NOTE: The profiling below will only run to the end of the Profile filter.
The actuall result may exceed the stated.

== PAGE TIMERS =========== 
0.0000000000000 "PHP start."
0.016289949417114 "Bootstrap Started."
0.020617008209229 "Loading Load Filter: 'cron-jobs'"
0.023736000061035 "-> Applied Load Filter: 'cron-jobs'"
0.023751974105835 "Loading Load Filter: 'no-cache-compiler-read'"
0.025443077087402 "-> Applied Load Filter: 'no-cache-compiler-read'"
0.030740022659302 "Boot-strapped."
0.030858039855957 "Generated possible incoming routes."
0.031304121017456 "Not Including '/export/www/UK/www.natashabedingfield.com/wwwdoc/pages/compress/javascript.php'"
0.031412124633789 "Including '/export/www/UK/www.natashabedingfield.com/wwwdoc/pages/compress.php'"
0.035856962203979 "Loading Output Filter: 'profiler'"
0.03733491897583 "Page Close."
-----@@@@FINAL-TIMER@@@@-----

== MEMORY ================ 
Memory Usage = 1.21MB

*/
// For full license see: http://www.natashabedingfield.com/js/scriptaculous/credits.js
Effect.ScrollTo = Class.create();
Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    this.start(arguments[1] || {});
  },
  setup: function() {
    Position.prepare();
    var offsets = Position.cumulativeOffset(this.element);
    if(this.options.offset) offsets[1] += this.options.offset;
    var max = window.innerHeight ? 
      window.height - window.innerHeight :
      document.body.scrollHeight - 
        (document.documentElement.clientHeight ? 
          document.documentElement.clientHeight : document.body.clientHeight);
    this.scrollStart = Position.deltaY;
    this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
  },
  update: function(position) {
    Position.prepare();
    window.scrollTo(Position.deltaX, 
      this.scrollStart + (position*this.delta));
  }
});
