	var cSCROLLUPDATETIMEMS = 50;
	var cSCROLLSPEED = 5;

	var ocontainer;
	var ocontent;
	var spaceToScroll;
	var scrollStopping = false;
	var scrollTimeoutId = null;

	function releaseScroll() {
		scrollStop();
		return true; 
	}

	$("#ibutDown")
		.click( function() { 
			imgChangeState(this);
			return false; 
		} )
		.mousedown( function() { 
			scrollDown();
			return false;  
		} )
		.mouseup(releaseScroll)
		.mouseover( function() { 
			imgChangeState(this,'over');
			return true; 
		})
		.mouseout(function() { 
			releaseScroll();
			imgChangeState(this);
			return true; 
		});

	$("#ibutUp")
		.click( function() { 
			imgChangeState(this);
			return false; 
		} )
		.mousedown( function() { 
			scrollUp();
			return false;  
		} )
		.mouseup(releaseScroll)
		.mouseover( function() { 
			imgChangeState(this,'over');
			return true; 
		})
		.mouseout( function() { 
			releaseScroll();
			imgChangeState(this);
			return true; 
		})

	$(document).bind("mousewheel", wheel);

	$(document).ready(startScrollScript);


function startScrollScript(){
	var contentHeight = 0;
	try{
		contentSize = jQuery.iUtil.getSize($('div.content').get(0));
		contentHeight = contentSize.hb;
	}catch(e){
		//not accessible yet.
		contentHeight = 0;
	} 
		
	if(contentHeight < 1){
		scrollStartTimeoutId = setTimeout(function() { startScrollScript(); }, 500);
	}else{
		doScrollScript();
	}
}


function doScrollScript(){
	scrollStopping = false;
	ocontainer = $('div.container');
	ocontent = $('div.content');
	oslider = $('div.slider1');
	oindicator = $('.indicator')

	oindicator
		.mouseover( function() { 
			$(this).addClass("indicatorover");
			return true; 
		})
		.mouseout(function() {
			$(this).removeClass("indicatorover");
			return true; 
		})
		.mouseup(function() {
			releaseScroll();
		});


	
	containerSize = jQuery.iUtil.getSize(ocontainer.get(0));
	containerPosition = jQuery.iUtil.getPosition(ocontainer.get(0));
	containerInner = jQuery.iUtil.getClient(ocontainer.get(0));
	
	contentSize = jQuery.iUtil.getSize(ocontent.get(0));
	spaceToScroll = contentSize.hb - containerInner.h;

	//alert("down: " + spaceToScroll);
	$('.slider1').Slider(
		{
			accept : oindicator,
			onSlide : function( cordx, cordy, x , y)
			{
				ocontent
					.css('top', - spaceToScroll * cordy / 100 + 'px');
			}
		}
	);
}


function scrollThePage(delta){
	if (spaceToScroll > 0 && scrollStopping == false) {
		//var SliderValues = { x: 50, scrollUp: 5, scrollLeft:20, scrollRight:20; };
		$('.slider1').SliderSetValues([[20, delta],[20,20]]);
		
		scrollTimeoutId = setTimeout(function() { scrollThePage(delta); }, cSCROLLUPDATETIMEMS);
	}else {
		scrollStopping = false;	
	}
}

function scrollDown(){
	scrollThePage(cSCROLLSPEED);
}

function scrollUp(){
	scrollThePage(-cSCROLLSPEED);
}

function scrollStop() {
	if(scrollTimeoutId != null){
		scrollTimeoutId = null;
		scrollStopping = true;
	}
}



// handle the actual scroll-event.
function handle(delta) {
	var Speed = -cSCROLLSPEED;

	
	if(delta < 0){
		Speed = cSCROLLSPEED;
	}else{
		Speed = -cSCROLLSPEED;
	}
	$('.slider1').SliderSetValues([[20, Speed],[20,20]])
}

// Event handler for mouse wheel event.
function wheel(event){
	var delta = 0;
	if (!event) { /* For IE. */
		event = window.event;
	}
	if (event.wheelDelta) { /* IE/Opera. */
		delta = event.wheelDelta/120;
		/** In Opera 9, delta differs in sign as compared to IE.*/
		if (window.opera) {
			delta = -delta;
		}
	} else if (event.detail) { /** Mozilla case. */
		// In Mozilla, sign of delta is different than in IE.  Also, delta is multiple of 3.
		delta = -event.detail / 3;
	}
	// If delta is nonzero, handle it.
	// Basically, delta is now positive if wheel was scrolled up, and negative, if wheel was scrolled down.
	if (delta) {
		handle(delta);
	}
	// Prevent default actions caused by mouse wheel.
	// That might be ugly, but we handle scrolls somehow anyway, so don't bother here..
	if (event.preventDefault) {
		event.preventDefault();
	}
	event.returnValue = false;
}


function imgChangeState(img, inState, inOldStateList) {
	if (typeof img == "string") {
		img = findElement(img);
	}
	if (!img) { return; }
	
	if (!inState) { inState = ""; }
	if (!inOldStateList) { inOldStateList = "_over"; }	// only "over" is default - pass in other vals for funny stuff
	
	var fn = img.src;
	var p = fn.lastIndexOf(".");
	var base = fn.substr(0, p);
	var re = new RegExp(inOldStateList + "$", "ig");
	var str = base.replace(re, "");
	
	img.src = str + ((!inState) ? "" : "_") + inState + fn.substr(p);
}