/* * jQuery flashScroll - v0.1 * http://tamerayd.in/jquery-flashscroll * * Written by TAMER AYDIN - http://tamerayd.in * * This work is licensed under the Creative Commons Attribution 3.0 Unported License. * To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ * or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. */(function( $ ){    var scrollRepeat;    var acceleration = 1;	var methods = {		init : function( options ) {            return this.each(function() {                var $this = $(this);                var scrollRepeat;                var settings = {                    generatebuttons : false                };                if (options) {                    $.extend(settings,options);                }                                $this.css('overflow','hidden');                $this.prepend('<div class="flashScrollWrapper">');                $('.flashScrollWrapper').css({'width':$('.flashScrollWrapper').parent().css('width')});//ie                $this.children().not('.flashScrollWrapper').clone().appendTo('.flashScrollWrapper');                $this.children().not('.flashScrollWrapper').remove();                $('.flashScrollWrapper').find('span.event-color-20x10').bind('click', function() {                        	                    getEventDetail($(this).attr('id').split('_')[1]);                });				if ($('.flashScrollWrapper').parent('div').height() >= $('.flashScrollWrapper').height())					$('.termNav, .aboutNav, .infoNav').hide();				else					$('.termNav, .aboutNav, .infoNav').show();                $('.scrollUp').bind('mouseover',function () {scrollRepeat = setInterval(function(){$this.flashscroll('up');},30);});                $('.scrollDown').bind('mouseover',function () {scrollRepeat = setInterval(function(){$this.flashscroll('down');},30);});                $('.scrollUp').bind('mouseout',function () {                    clearInterval(scrollRepeat);                    acceleration=0;                });                $('.scrollDown').bind('mouseout',function () {                    clearInterval(scrollRepeat);                    acceleration=0;                });            });		},        up : function () {            return this.each(function() {                methods.scroll({'element':$(this),'direction':'up'});            });        },        down : function () {            return this.each(function() {                methods.scroll({'element':$(this),'direction':'down'});            });        },        scroll : function ( properties ) {            var sElement = $(properties.element);            var sWrapper = sElement.children('.flashScrollWrapper');            var sWrapperTopM = sWrapper.css('margin-top');            var currentPos = parseInt(sWrapperTopM.substring(0,sWrapperTopM.length-2));            switch (properties.direction) {                case 'up':                    if (currentPos<0)                        sWrapper.css('margin-top',(currentPos+(5+(acceleration/100))));                    break;                default:                    if (currentPos>sElement.height()-sWrapper.height())                        sWrapper.css('margin-top',(currentPos-(5+(acceleration/100))));                    break;            }                    },        destroy : function () {            $('div.flashScrollWrapper').each(function () {                var parentDiv = $(this).parent('div');                $(this).children('div').clone().appendTo(parentDiv);                $(this).remove();            });            $('.scrollUp').unbind('mouseover');            $('.scrollDown').unbind('mouseover');            $('.scrollUp').unbind('mouseout');            $('.scrollDown').unbind('mouseout');            clearInterval(scrollRepeat);            acceleration=0;        }	};	$.fn.flashscroll = function( method ) {		if ( methods[method] ) {			return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));		} else if ( typeof method === 'object' || ! method ) {			return methods.init.apply( this, arguments );			} else {			$.error( 'Method ' +  method + ' does not exist on jquery.flashscroll!' );		}	};	})( jQuery );
