var picobj;
function picdisplay(picnum) {
	picobj = document.getElementById('gallerypic');
	picobj.src = eval('gallery_' + picnum + '.src');
}

var n4, ie, n6;
var doc1, doc2, doc3, sty;

if (document.layers) {
	doc1 = "document.";
	doc2 = ".document.";
	doc3 = "";
	sty = "";
	n4 = true;
} else if (document.all) {
	doc1 = "document.all.";
	doc2 = "";
	doc3 = "";
	sty = ".style";
	ie = true;
} else if (document.getElementById) {
	doc1 = "document.getElementById('";
	doc2 = "')";
	doc3 = "')";
	sty = "').style";
	n6 = true;
}

var pgtnboxobj, pgtntextobj;
var scrollspeed = 40;
var loaded = 0;
var loop = 0;
var minheight, containerbox, textbox;

function createObject (elem, container) {
	if (document.all) {
		this.element = document.all[elem];
		this.styleElem = this.element.style;
		this.elemheight = this.element.offsetHeight;
		this.clipheight = this.element.offsetHeight;
	}

	else if (document.getElementById) {
		this.element = document.getElementById(elem);
		this.styleElem = this.element.style;
		this.elemheight = this.element.offsetHeight;
		this.clipheight = this.element.offsetHeight;
	}

	else if (container) {
		container = doc1+container+".";
		this.element = eval (container+doc1+elem);
		this.styleElem = eval (container+doc1+elem);
		this.elemheight = this.styleElem.document.height;
		this.clipheight = this.styleElem.clip.height;
	}

	else {
		return false;
	}

	this.scrollthis = scrollThis;
	this.scrollup = scrollUp;
	this.scrolldown = scrollDown;
	this.scrollit = scrollIt;
	this.positionit = positionIt;
	return this;
}

function scrollThis (xpos, ypos) {
	this.x=xpos;
	this.y=ypos;

	this.styleElem.left = xpos+'px';
	this.styleElem.top = ypos+'px';
}

function scrollUp (incr) {
	minheight = this.elemheight - containerbox.clipheight;

	if (this.y > -minheight) {
		this.scrollthis (0, this.y-incr);
	} else {
		clearInterval(this.intervalID);
		loop = 0;
	}
}

function scrollDown (incr) {
	if (this.y < 0) {
		this.scrollthis (0, this.y-incr);
	} else {
		clearInterval(this.intervalID);
		loop = 0;
	}
}

function scrollIt (elem, incr) {
	containerbox = eval (elem + "boxobj");
	textbox = eval (elem + "textobj");

	if ((loaded == 1) && (loop == 0)) {
		loop = 1;

		if (incr > 0) {
			textbox.intervalID=setInterval("textbox.scrollup ("+incr+")", scrollspeed);
		} else {
			textbox.intervalID=setInterval("textbox.scrolldown ("+incr+")", scrollspeed);
		}
	}
}

function positionIt (elem, posx, posy) {
	textbox = eval (elem + "textobj");

	if (loaded == 1) {
		textbox.scrollthis (posx, posy);
	}
}

function initMover(pgtntext) {
	pgtnboxobj = new createObject ('pgtnbox');
	pgtntextobj = new createObject (pgtntext, 'pgtnbox');

	pgtntextobj.scrollthis (0, 0);

	loaded = 1;
}

function startScroll (dir) {
	if (dir == 'up') {
		scrollIt ('pgtn', -10);
	} else {
		scrollIt ('pgtn', 10);
	}
}

function stopScroll () {
	clearInterval(pgtntextobj.intervalID);
	loop = 0;
}
