﻿// JScript File

var clipTop = 0;
var clipWidth = 552 ;
var clipBottom = 320;
var topper = 180;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;

var scrollerHeight;
var scrollerTop;
var initialScrollerOpacity = 0.3;

function init()
{
	DHTML = (document.getElementById || document.all || document.layers);
	
	if (!DHTML) return;
	var x = new getObj('aboutText');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 0;
		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;
	}
	x.style.visibility = "visible";
	
	// create the scroller:
	var scroller = document.getElementById("scroller");
	scrollerHeight = ((clipBottom - clipTop) / lyrheight) * (clipBottom - clipTop - 16);
	scroller.style.height = scrollerHeight + "px";
	scroller.style.top = "10px";
	scrollerTop = 10;
	scroller.style.position = "absolute";

	//makeDraggable(scroller);
	
}

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;
	
	var scroller = document.getElementById("scroller");
	
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
	    var scrollerOffset = (amount / lyrheight) * 331;
	    scrollerTop += scrollerOffset;
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)'
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
		scroller.style.top = scrollerTop + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
		scroller.style.top = scrollerTop;
	}
	time = setTimeout('realscroll()',theTime);
}

function vis(val)
{
	if (!DHTML) return;
	var f = new getObj('aboutText');
	f.style.visibility = val;
}

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];
  }
}
function overScroller()
{
    var scroller = new getObj('scroller');
    scroller.style.opacity = "0.6";
    scroller.style.filter = "alpha(style=0,opacity=60)";
}
function outScroller()
{
    var scroller = new getObj('scroller');
    scroller.style.opacity = initialScrollerOpacity;
    scroller.style.filter = "alpha(opacity=" + (initialScrollerOpacity * 100) + ")";
}
