jQuery.fn.extend({
	silVerticalScroll: function(options) {
		return this.each(function() {
			new jQuery.silVerticalScroll(this, options);
		});
	}
});

jQuery.silVerticalScroll = function(obj, opt) {

  var opt = opt || {};
  opt.changeTime = opt.changeTime || 111;
  opt.jumpSize = opt.jumpSize || 3;
  opt.private = {Count:0};
  var $select = $(obj);
  
  IntervalID = null;
  var html = $select.html();
  $select.html("<div id=\"sil-div\">"+html+"</div>");

  document.getElementById('sil-div').setAttribute("count", 0);

  function goo() {

    tmp = document.getElementById('sil-div');
    opt.private.Count=tmp.getAttribute("count");

    opt.private.Count=parseFloat(opt.private.Count)+parseFloat(opt.jumpSize);
    tmp.scrollTop=opt.private.Count;

    if(opt.private.Count>tmp.scrollTop) opt.private.Count=0;

    tmp.setAttribute("count", opt.private.Count);
  }
  
  $("#sil-div").mouseover(function() {
    if(IntervalID == null)
      IntervalID = setInterval(goo, opt.changeTime);
    else {
      clearInterval(IntervalID);
      IntervalID = null;
    }
  });
  
  $("#sil-div").mouseout(function() {
    if(IntervalID == null)
      IntervalID = setInterval(goo, opt.changeTime);
    else {
      clearInterval(IntervalID);
      IntervalID = null;
    }
  });
  
  IntervalID = setInterval(goo, opt.changeTime);
}
