var clipTop = 0;
var clipWidth = 170;
var clipBottom = 376;
var topper = 47;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;

var setTopper, setClipBottom;

function prepLyr( siteId, style )
{
	if( siteId==2 ){
		clipTop = 0;
		clipWidth = 170;
		switch(style){
			case 1:
			  clipBottom = 80;
			  break;    
			case 2:
			  clipBottom = 160;
			  break;
			case 3:
			  clipBottom = 240;
			  break;
			case 4:
			  clipBottom = 320;
			  break;
			default:
			  clipBottom = 320;
		}
		topper = 80;
		
		switch(style){
			case 1:
			  setClipBottom = 80;
			  break;    
			case 2:
			  setClipBottom = 160;
			  break;
			case 3:
			  setClipBottom = 240;
			  break;
			case 4:
			  setClipBottom = 320;
			  break;
			default:
			  setClipBottom = 320;
		}
		setTopper = 80;
	}else{
		clipTop = 0;
		clipWidth = 208;
		switch(style){
			case 1:
			  clipBottom = 93;
			  break;    
			case 2:
			  clipBottom = 156;
			  break;
			case 3:
			  clipBottom = 235;
			  break;
			case 4:
			  clipBottom = 310;
			  break;
			default:
			  clipBottom = 310;
		}
		topper = 145;
		
		switch(style){
			case 1:
			  setClipBottom = 93;
			  break;    
			case 2:
			  setClipBottom = 156;
			  break;
			case 3:
			  setClipBottom = 235;
			  break;
			case 4:
			  setClipBottom = 310;
			  break;
			default:
			  setClipBottom = 310;
		}
		setTopper = 145;
	}

	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('indexLayer');
	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)
	{
		contentHeight = getDim(document.all.newsbottom).y;
		if( x.obj.offsetHeight==0 ){
			lyrheight = contentHeight+(clipBottom*3);
		}else{
			lyrheight = contentHeight + (clipBottom-150);;
		}
		x.style.clip = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
	}
	
	//alert( "IE & FireFox: " + getDim(document.all.newsbottom).y );
}

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 (clipBottom > lyrheight)
	if( getDim(document.all.newsbottom).y < setTopper )
	{
		//alert( "IE & FireFox: " + getDim(document.all.newsbottom).y );
		clipTop = 0;
		clipBottom = setClipBottom;
		topper = setTopper;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper;
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

function vis(val)
{
	if (!DHTML) return;
	var f = new getObj('example');
	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];
  }
}
