  (function($) {

    $.fn.contentScroll = function(options) {
		return this.each(function() {
			var size = options.height;
			var speed = options.speed;
			$self = $(this);
			$self.css({position: 'relative', height: size+'px', overflow: 'hidden', float: 'left'});
			var content = $('<div/>');

			content.html($self.html());

			$self.empty();

			$self.append(content);
			$self.append('<script type="text/javascript" language="javascript">$("a.thickbox").click(function(e){tb_show(" ", this.href, null);return false;});</script>');
			content.css({'margin-top':'0', 'float':'left'})

			var hght = content.outerHeight(true);
			

			showControls(0, hght, options.up, options.down, size)
		
			options.up.click(function()
									{
										content.stop();
										var ex_mtop=parseInt(content.css("margin-top").replace("px",""));

										to_mtop = ex_mtop - size;
										temp=ex_mtop - size;
										
									
										
										if( to_mtop <=  -hght ){
											
											to_mtop = ex_mtop;
										}
										showControls(to_mtop, hght, options.up, options.down, size)
										 
										
										content.animate({ 
												marginTop: to_mtop
											}, speed);
										
									}
							);

			options.down.click(function()
									{
										content.stop();
										var ex_mtop=parseInt(content.css("margin-top").replace("px",""));
										to_mtop = ex_mtop + size;
									
										if(to_mtop > 0) {
											to_mtop = 0;
										}
										showControls(to_mtop, hght, options.up, options.down, size)
										
										
										content.animate({ 
												marginTop: to_mtop
											}, speed);
									}
							);

			
		});
	};

	function showControls(top, height, up, down, size){
		
		var showTop = true;
		var showBottom = true;
		if( top >= 0)
			showTop = false;

		if( top + (-size) <=  -height )
			showBottom = false;

		if(showTop){
			down.addClass("arrow-show")
			down.removeClass("arrow-hide")
		}
		else{
			down.addClass("arrow-hide")
			down.removeClass("arrow-show")
		}

		if(showBottom)
		{
			up.addClass("arrow-show")
				up.removeClass("arrow-hide")
		}
		else
		{
			up.addClass("arrow-hide")
				up.removeClass("arrow-show")
			
		}
	}



  })(jQuery); 
