var clipTop = 0;
var clipWidth = 300;
var clipBottom = 285;
var topper = 285;
var lyrheight = 300;
var time,amount,theTime,theHeight,DHTML;

function init()
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('ctext');
	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,0)';
		x.style.clip = clipstring;
	}
}

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 )
	{
		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 vis(lname,val)
{
	if (!DHTML) return;
	var f = new getObj(lname);
	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];
  }
}

var ws = new Array('tl','tr','bl','br')
function doSlice(sn,n) {
  lastn = n
  lasts = sn
  for ( i=0; i<ws.length; i++ ) {
    if ( ws[i] == sn ) {
      eval("document."+sn+".src='images/"+sn+n+".jpg'")
      //eval("writit('"+sn+n+"')")
    } else {
      eval("document."+ws[i]+".src='images/"+ws[i]+".jpg'")
    }
  }
}


function writit(section) {
	if (document.getElementById) {
		x = document.getElementById("ctitle");
		y = document.getElementById("ctext");
		x.innerHTML = '';
		y.innerHTML = '';
		eval("x.innerHTML = "+section+"_title");
		eval("y.innerHTML = "+section+"_text");
	} else if (document.all) {
		x = document.all["ctitle"];
		y = document.all["ctext"];
		eval("x.innerHTML = "+section+"_title");
		eval("y.innerHTML = "+section+"_text");
	} else if (document.layers) {
		x = document.layers["ctitle"];
		y = document.layers["ctext"];
		x.document.open();
		eval("x.document.write("+section+"_title)");
		x.document.close();
		y.document.open();
		eval("y.document.write("+section+"_text)");
		y.document.close();
	}
  if ( section == "bl1" ) vis('nav','visible');
  else vis('nav','hidden');
	if (document.getElementById || document.all) {
    y.style.top='285px'
    y.style.clip='rect(0px,300px,285px,0)'
	} else if (document.layers) {
		thelayer.style.clip.top = 285;
		thelayer.style.clip.bottom = 285;
		thelayer.style.top = 300;
	}

}
