var more;
more=false;

function TextScroll(scrollname, div_name, up_name, down_name) {
this.div_name = div_name;
this.name = scrollname;
this.scrollCursor = document.getElementById(this.div_name).scrollLeft;
this.speed = 5;
this.timeoutID = 0;
this.div_obj = null;
this.up_name = up_name;
this.dn_name = down_name;

var right;
var left;
right=false;

//innitialise left end image
this.scrollCursor = document.getElementById(this.div_name).scrollLeft;
if (this.scrollCursor <=0 ) {
	this.scrollCursor = 0;
	MM_swapImage('scroll-left','','graphics/gallery-nav-left-end.png',1);
	left = true;
	} 
	else {
	left=false;
	}



	{
	if (document.getElementById) {
		div_obj = document.getElementById(this.div_name);
		if (div_obj) {
			this.div_obj = div_obj;
			//this.div_obj.style.overflow = "scroll";
			//hide scrollbars if using javascript, ie if javascript disabled will still get scrollbar.
			this.div_obj.style.overflowY = "hidden";
			this.div_obj.style.overflowX = "hidden";
			
			//initiialise right arrow
			this.scrollCursor = document.getElementById(this.div_name).scrollLeft;
			if (this.div_obj.scrollLeft >= 229) {
				MM_swapImage('scroll-right','','graphics/gallery-nav-right-end.png',1);
				right = true;
			}
			else {
				right=false;
			}
			//end
		}
		div_up_obj = document.getElementById(this.up_name);
		div_dn_obj = document.getElementById(this.dn_name);
		if (div_up_obj && div_dn_obj) {
			div_up_obj.onmouseover = function() { eval(scrollname + ".scrollUp();") };
			div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };

			div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown();") };
			div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };

		}
	}
}

this.stopScroll = function() {
	clearTimeout(this.timeoutID);
	this.scrollCursor = document.getElementById(this.div_name).scrollLeft;
} 

//left
this.scrollUp = function() {
	if (this.div_obj) {
	
		if (right==true){
			right = false;
			MM_swapImage('scroll-right','','graphics/gallery-nav-right.png',1);
		}	

		this.scrollCursor = document.getElementById(this.div_name).scrollLeft;
		//this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : (this.scrollCursor - this.speed);
		this.scrollCursor -= this.speed;
		if (this.scrollCursor <0 ) {
			this.scrollCursor = 0;
			MM_swapImage('scroll-left','','graphics/gallery-nav-left-end.png',1);
			left = true;
			}
		this.div_obj.scrollLeft = this.scrollCursor;
		this.timeoutID = setTimeout(this.name + ".scrollUp()", 30);
	}
}

//right
this.scrollDown = function() {
	if (this.div_obj) {
		
		if (left==true){
			left = false;
			MM_swapImage('scroll-left','','graphics/gallery-nav-left.png',1);
		}
		
		this.scrollCursor = document.getElementById(this.div_name).scrollLeft;
		this.scrollCursor += this.speed;
		this.div_obj.scrollLeft = this.scrollCursor;
		if (this.div_obj.scrollLeft == this.scrollCursor) {
			this.timeoutID = setTimeout(this.name + ".scrollDown()", 30);
			}
		else {
			this.scrollCursor = this.div_obj.scrollLeft;
			MM_swapImage('scroll-right','','graphics/gallery-nav-right-end.png',1);
			right=true;
		}

	}
}

this.resetScroll = function() {
	if (this.div_obj) {
		this.div_obj.scrollLeft = 0;
		this.scrollCursor = 0;
	}
} 
}

function showmore() {
document.getElementById('more').style.display="block";
more=true;
}
function closemore() {
document.getElementById('more').style.display="none";
more=false;
}

function showrollover() {
document.getElementById('rollover').style.display="block";
}
function hiderollover() {
document.getElementById('rollover').style.display="none";
}
