﻿/*
* Copyright 2006 Ronny Engelmann
* This code is free; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation
* Contact Ronny Engelmann at ronny.engelmann [at] knoxmic [dot] net
*
* Description: scrolling content with javascript
*/



function scroll(objElement, intHeight) {

  var self = this;
  this._y = 0;
  objElement.style.top  = "0px";
  
  this.setPosition = function(intPos, y) {
    if (intPos > 0) intPos = 0;
    if (intPos < intHeight - objElement.offsetHeight)
      intPos = intHeight - objElement.offsetHeight;
    if (((this._y*-1) < objElement.offsetHeight) || (y > 0)) {
      this._y = intPos;
      objElement.style.top  = this._y +"px";
    }
  };
  
  this.scrollY = function(y) { this.setPosition(this._y + y, y); };
  
  this.start = function(y) { 
    this.scrollTimer = window.setInterval( 
      function() { self.scrollY(y); },  1 ); 
  };
  this.stop = function() { 
    if (this.scrollTimer) window.clearInterval(this.scrollTimer); };

	return false;
};

			

function initPage() {
			
			  var objElement = document.getElementById('scontent');
			  srollObject = new scroll(objElement, 300);
			  
			  //Style nur anpassen, wenn JS an ist
			  var scrollbject_s = document.getElementById('scrollObject');
			  scrollbject_s.style.width ="300px";
			  scrollbject_s.style.height ="300px";
			  scrollbject_s.style.overflow ="hidden";
			  scrollbject_s.style.position ="absolute";
			 
			}


