GalleryScroller = {
	box : null,
	speedFactor : 1,
	boxSpeed : 40,
	boxIntval : 0,
	
	init : function( box, speedFactor, boxSpeed) {
		this.box = jQuery(box);
		this.speedFactor = speedFactor;
		this.boxSpeed = boxSpeed;
	},
	
	vScroll : function( scrollMode ) {
		
		var boxContainer = this.box;
		var boxMaxWidth = boxContainer.attr('scrollHeight') - boxContainer.width();
		
		if ( scrollMode == 'right' ) {
			
			if ( boxContainer.scrollLeft() == boxMaxWidth ) {				
				jQuery('.vscroller-right').css('display', 'none');
			} else {
				jQuery('.vscroller-left').css('display', 'inline');
				boxContainer.scrollLeft(boxContainer.scrollLeft() + this.speedFactor);
			}
													
		} else {
		
			if ( boxContainer.scrollLeft() == 0) {
				jQuery('.vscroller-left').css('display', 'none');
			} else {	
				jQuery('.vscroller-right').css('display', 'inline');
				boxContainer.scrollLeft(boxContainer.scrollLeft() - this.speedFactor);										
			}
			
		}
		
	},
	
	scrollLeft: function() {
		this.boxIntval = setInterval("GalleryScroller.vScroll('left')", this.boxSpeed);
	},
	
	scrollRight: function() {
		this.boxIntval = setInterval("GalleryScroller.vScroll('right')", this.boxSpeed);
	},
	
	stop : function() {
		window.clearInterval(this.boxIntval);
	}
	
};

VideoScroller = {
	box : null,
	speedFactor : 1,
	boxSpeed : 40,
	boxIntval : 0,
	
	init : function( box, speedFactor, boxSpeed) {
		this.box = jQuery(box);
		this.speedFactor = speedFactor;
		this.boxSpeed = boxSpeed;
	},
	
	hScroll : function( scrollMode ) {
		
		var boxContainer = this.box;
		var boxMaxWidth = boxContainer.attr('scrollHeight') - boxContainer.height();
		
		if ( scrollMode == 'down' ) {
			
			if ( boxContainer.scrollTop() == boxMaxWidth ) {				
				// jQuery('.vscroller-down').css('display', 'none');
			} else {
				jQuery('.vscroller-up').css('display', 'inline');
				boxContainer.scrollTop(boxContainer.scrollTop() + this.speedFactor);
			}
													
		} else {
		
			if ( boxContainer.scrollTop() == 0) {
				// jQuery('.vscroller-up').css('display', 'none');
			} else {	
				jQuery('.vscroller-down').css('display', 'inline');
				boxContainer.scrollTop(boxContainer.scrollTop() - this.speedFactor);										
			}
			
		}
		
	},
	
	scrollUp: function() {
		this.boxIntval = setInterval("VideoScroller.hScroll('up')", this.boxSpeed);
	},
	
	scrollDown: function() {
		this.boxIntval = setInterval("VideoScroller.hScroll('down')", this.boxSpeed);
	},
	
	stop : function() {
		window.clearInterval(this.boxIntval);
	}
	
};

NewsScroller = {
	box : null,
	speedFactor : 1,
	boxSpeed : 40,
	boxIntval : 0,
	
	init : function( box, speedFactor, boxSpeed) {
		this.box = jQuery(box);
		this.speedFactor = speedFactor;
		this.boxSpeed = boxSpeed;
	},
	
	hScroll : function( scrollMode ) {
		
		var boxContainer = this.box;
		var boxMaxWidth = boxContainer.attr('scrollHeight') - boxContainer.height();
		
		if ( scrollMode == 'down' ) {
			
			if ( boxContainer.scrollTop() == boxMaxWidth ) {				
				jQuery('.vscroller-down').css('display', 'none');
			} else {
				jQuery('.vscroller-up').css('display', 'inline');
				boxContainer.scrollTop(boxContainer.scrollTop() + this.speedFactor);
			}
													
		} else {
		
			if ( boxContainer.scrollTop() == 0) {
				jQuery('.vscroller-up').css('display', 'none');
			} else {	
				jQuery('.vscroller-down').css('display', 'inline');
				boxContainer.scrollTop(boxContainer.scrollTop() - this.speedFactor);										
			}
			
		}
		
	},
	
	scrollUp: function() {
		this.boxIntval = setInterval("NewsScroller.hScroll('up')", this.boxSpeed);
	},
	
	scrollDown: function() {
		this.boxIntval = setInterval("NewsScroller.hScroll('down')", this.boxSpeed);
	},
	
	stop : function() {
		window.clearInterval(this.boxIntval);
	}
	
};

