//BROWSER SNIFFER

function Is2() {
    this.ie4 = document.all && !document.getElementById;
	this.ns4 = document.layers;
	this.ie5 = document.all && document.getElementById;
	this.ns6 = document.getElementById && !document.all;
}

var is2 = new Is2()

if(is2.ns4) {
	doc = "document";
	sty = "";
	htm = ".document"
}
else if(is2.ie4 || is2.ie5) {
	doc = "document.all";
	sty = ".style";
	htm = ""
}
else if(is2.ns6) {
	doc = "document.getElementById(";
	sty = ").style";
	htm = ""
}

function showLayer(layer)
{
	showLyr = eval(doc + '["' + layer + '"]' + sty);
	showLyr.visibility = "visible";
}

function hideLayer(layer)
{
	hideLyr = eval(doc + '["' + layer + '"]' + sty);
	hideLyr.visibility = "hidden";
}

var win=null;
function NewWindow(mypage, name)
{
	settings='top=0,left=0,scrollbars=yes,location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes';
	win=top.open(mypage, name);
}

function NewWindowHood(mypage,myname,w,h,scroll){
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	TopPosition=(screen.height)?(screen.height-h)/2:100;
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
}

var top = 0;
//var clipTop = 0;
//var clipWidth = 212;
//var clipBottom = 0;
//var topper = 300;
var lyrheight = 0;
function prepLyr()
{
	textLyr = eval(doc + '["scrollLayer"]' + sty);
	shadowLyr = eval(doc + '["dropShadow"]' + sty);
	if (is2.ns4)
	{
		lyrheight = textLyr.clip.bottom;
		//lyrheight += 20;
		textLyr.clip.top = clipTop;
		textLyr.clip.left = clipLeft;
		textLyr.clip.right = clipRight;
		textLyr.clip.bottom = clipBottom;
	}
	else
	{
		if(is2.ns6)
		{
			lyrheight = lyrheightNS6;
			lyrwidth = document.getElementById("scrollLayer").offsetWidth;
		}
		else
		{
			lyrheight = scrollLayer.offsetHeight-5;
			lyrwidth = scrollLayer.offsetWidth;
		}
			
		textLyr.clip = 'rect('+clipTop+'px '+clipRight+'px '+clipBottom+'px '+clipLeft+'px)';
	}
	textLyr.visibility = "visible";
	shadowLyr.visibility = "visible";
}

var loop = false;
//var direction = "up";
var timer1 = null;
function scroll(dir)
{
	textLyr = eval(doc + '["scrollLayer"]' + sty);
	//lyrheight = text.offsetHeight;
    direction = dir;
	if(!is2.ns6)
    	speed = 1;
	else
    	speed = 2;
    var y_pos = parseInt(textLyr.top);
    var x_pos = parseInt(textLyr.left);
	if(direction == "down") 
	{
		if(clipBottom > lyrheight)
			return;
		y_position = (y_pos-(speed))
		textLyr.top = y_position + 'px';
		clipTop += speed;
		clipBottom  += speed;
		if (is2.ns4)
		{
			textLyr.clip.top = clipTop;
			textLyr.clip.bottom = clipBottom;
			//alert(textLyr.clip.top);
		}
		else
		{
			clipstring = 'rect('+clipTop+'px '+clipRight+'px '+clipBottom+'px '+clipLeft+'px)';
			textLyr.clip = clipstring;
		}
		clearTimeout(timer1);
		timer1 = setTimeout("scroll(direction,speed)", 2);
	} 
	else if(direction == "up") 
	{
		if(y_pos > top)
			return;
		y_position = (y_pos+(speed))
		textLyr.top = y_position + 'px';
		clipTop -= speed;
		clipBottom  -= speed;
		if (is2.ns4)
		{
			textLyr.clip.top = clipTop;
			textLyr.clip.bottom = clipBottom;
			//alert(textLyr.clip.top);
		}
		else
		{
			clipstring = 'rect('+clipTop+'px '+clipRight+'px '+clipBottom+'px '+clipLeft+'px)';
			textLyr.clip = clipstring;
			//textLyr.top = topper;
		}
		clearTimeout(timer1);
		timer1 = setTimeout("scroll(direction,speed)", 2);
	}
	else if(direction == "right") 
	{
		if(clipRight >= lyrwidth)
			return;
		x_position = (x_pos-(speed))
		textLyr.left = x_position + 'px';
		clipLeft += speed;
		clipRight  += speed;
		if (is2.ns4)
		{
			textLyr.clip.left = clipLeft;
			textLyr.clip.right = clipRight;
			//alert(textLyr.clip.top);
		}
		else
		{
			clipstring = 'rect('+clipTop+'px '+clipRight+'px '+clipBottom+'px '+clipLeft+'px)';
			textLyr.clip = clipstring;
		}
		clearTimeout(timer1);
		timer1 = setTimeout("scroll(direction,speed)", 2);
	} 
	else if(direction == "left") 
	{
		if(x_pos > leftStop)
			return;
		x_position = (x_pos+(speed))
		textLyr.left = x_position + 'px';
		clipLeft -= speed;
		clipRight  -= speed;
		if (is2.ns4)
		{
			textLyr.clip.left = clipLeft;
			textLyr.clip.right = clipRight;
			//alert(textLyr.clip.top);
		}
		else
		{
			clipstring = 'rect('+clipTop+'px '+clipRight+'px '+clipBottom+'px '+clipLeft+'px)';
			textLyr.clip = clipstring;
			//textLyr.top = topper;
		}
		clearTimeout(timer1);
		timer1 = setTimeout("scroll(direction,speed)", 2);
	}
	return;
}	

function scrollLR(dir)
{
	textLyr = eval(doc + '["text"]' + sty);
	//lyrheight = text.offsetHeight;
    direction = dir;
    speed = 1;
    //var y_pos = parseInt(textLyr.top);
    var x_pos = parseInt(textLyr.left);
	if(direction == "right") 
	{
		if(clipRight <= lyrwidth)
			return;
		textLyr.left = (x_pos-(speed));
		clipLeft += speed;
		clipRight  += speed;
		if (is2.ns4)
		{
			textLyr.clip.left = clipLeft;
			textLyr.clip.right = clipRight;
			//alert(textLyr.clip.top);
		}
		else
		{
			clipstring = 'rect( 0 '+clipRight+' 270 '+clipLeft+')';
			textLyr.clip = clipstring;
		}
		clearTimeout(timer1);
		timer1 = setTimeout("scroll(direction,speed)", 2);
	} 
	else if(direction == "left") 
	{
		if(x_pos > 357)
			return;
		textLyr.left = (x_pos+(speed));
		clipLeft -= speed;
		clipRight  -= speed;
		if (is2.ns4)
		{
			textLyr.clip.left = clipLeft;
			textLyr.clip.right = clipRight;
			//alert(textLyr.clip.top);
		}
		else
		{
			clipstring = 'rect( 0 '+clipRight+' 270 '+clipLeft+')';
			textLyr.clip = clipstring;
			//textLyr.top = topper;
		}
		clearTimeout(timer1);
		timer1 = setTimeout("scroll(direction,speed)", 2);
	}
	return;
}	

function stopScroll()
{
	if (timer1) clearTimeout(timer1);
}

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 time,amount,theTime,theHeight,DHTML;
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 += 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;
		x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
	}
}