function getObj(name)
{
	if (document.getElementById)
	{
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	}
	else if (document.all)
	{
		this.obj = document.all[name];
		this.style = document.all[name].style;
	}
	else if (document.layers)
	{
		this.obj = document.layers[name];
		this.style = document.layers[name].style;
	}
}

var clipTop = 0;
var clipWidth = 470;
var clipHeight = 370;
var clipBottom = clipHeight;
var topper = 85;
var lyrheight = 0;
var curtop = 0;
var time,amount,theTime,theHeight,DHTML;

function init()
{
	DHTML = (document.getElementById || document.all || document.layers )
	if (!DHTML) return;
	var x = new getObj('content');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		var clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0px)';
		x.style.clip = clipstring;
	}
	if (document.all) { clipHeight += 10; }
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	thecursor = new getObj('cursor');
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function stopscroll()
{
	if (time) clearTimeout(time);
}

function realscroll()
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	var size = 340; // size of the bar
	padding = size / (lyrheight - clipHeight);
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0px)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
		curtop = Math.round(clipTop * padding);
		if (curtop > (size - 12)) { curtop = size - 12; }
		thecursor.style.top = curtop + 'px';
		
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
		thecursor.style.top = curtop;
	}
	time = setTimeout('realscroll()',theTime);
}

	
function getStyle(el,styleProp)
{
	var x = document.getElementById(el);
	if (window.getComputedStyle)
	var y = window.getComputedStyle(x,null).getPropertyValue(styleProp);
	else if (x.currentStyle)
	var y = eval('x.currentStyle.' + styleProp);
	return y;
}

function scroll()
{
	left = getStyle('photos','left');
	newleft = parseInt(left);
	newleft = newleft + 3;
	document.getElementById('photos').style.left=newleft+"px";
	window.setTimeout("scroll()",33);
}

function toggle(id)
{
	var s = getStyle(id,'display');
	var sn = (s == "none") ? "block" : "none";
	document.getElementById(id).style.display = sn;
}

function close(id)
{
	var s = getStyle(id,'display');
	if (s == "block") {
		document.getElementById(id).style.display="none";
	}
}

