/***********************************
*** scrolling layer content***
***********************************/

//Div example
var clipTop = 0;
var clipWidth = 335;
var clipBottom = 80;
var topper = 100;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;

//Div divmuseuslist
var clipTop1 = 0;
var clipWidth1 = 335;
var clipBottom1 = 116;
var topper1 = 85;
var lyrheight1 = 0;
var time1,amount1,theTime1,theHeight1,DHTML1;

function init()
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('example');

	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 50;
		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,0)';
		x.style.clip = clipstring;
	}
	
	if(document.getElementById('divmuseuslist'))
	{
		DHTML1 = (document.getElementById || document.all || document.layers)
	
		if (!DHTML1) return;
		
		var x1 = new getObj1('divmuseuslist');
	
		if (document.layers)
		{
			lyrheight1 = x1.style.clip.bottom;
			lyrheight1 += 20;
			x1.style.clip.top = clipTop1;
			x1.style.clip.left = 0;
			x1.style.clip.right = clipWidth1;
			x1.style.clip.bottom = clipBottom1;
			x1.style.overflow = 'hidden';
		}
		else if (document.getElementById || document.all)
		{
			lyrheight1 = x1.obj.offsetHeight;
			var clipstring1 = 'rect('+clipTop1+'px,'+clipWidth1+'px,'+clipBottom1+'px,0)';
			x1.style.clip = clipstring1;
			x1.style.overflow = 'hidden';
		}
	}
}


function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	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;
	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,0)'
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

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 = getObjNN4(document,name);
	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

/**********************************************
*** divmuseuslist
**********************************************/

function scrollayer1(layername1,amt1,tim1)
{
	if (!DHTML1) return;
	thelayer1 = new getObj1(layername1);
	if (!thelayer1) return;
	amount1 = amt1;
	theTime1 = tim1;
	realscroll1();
}

function stopScroll1()
{
	if (time1) clearTimeout(time1);
}

function realscroll1()
{
	if (!DHTML1) return;
	clipTop1 += amount1;
	clipBottom1 += amount1;
	topper1 -= amount1;
	if (clipTop1 < 0 || clipBottom1 > lyrheight1)
	{
		clipTop1 -= amount1;
		clipBottom1 -= amount1;
		topper1 += amount1;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring1 = 'rect('+clipTop1+'px,'+clipWidth1+'px,'+clipBottom1+'px,0)'
		thelayer1.style.clip = clipstring1;
		thelayer1.style.top = topper1 + 'px';
		thelayer1.style.overflow = 'hidden';
	}
	else if (document.layers)
	{
		thelayer1.style.clip.top = clipTop1;
		thelayer1.style.clip.bottom = clipBottom1;
		thelayer1.style.top = topper1;
		thelayer1.style.overflow = 'hidden';
	}
	time1 = setTimeout('realscroll1()',theTime1);
}


function getObj1(name1)
{
  if (document.getElementById)
  {

  	this.obj = document.getElementById(name1);
	this.style = document.getElementById(name1).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name1];
	this.style = document.all[name1].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN41(document,name1);
	this.style = this.obj;
  }
}

function getObjNN41(obj,name1)
{
	var x1 = obj.layers;
	var foundLayer1;
	for (var i=0;i<x1.length;i++)
	{
		if (x1[i].id == name1)
		 	foundLayer1 = x1[i];
		else if (x1[i].layers.length)
			var tmp1 = getObjNN41(x1[i],name1);
		if (tmp1) foundLayer1 = tmp1;
	}
	return foundLayer1;
}
