var n = navigator;
var d = document;
var speed = 40;
var agent = n.userAgent.toLowerCase();
var tid, b;


//Browser sniff hash obj
var sniff =
	{
	bw:
  	{
		ns:d.layers,
		ie:d.all && !d.getElementById,
		ie4:agent.indexOf("MSIE 4.") != -1,
		ie5:agent.indexOf("MSIE 5.") != -1,
		ie6:agent.indexOf("MSIE 6.") != -1,
		dom:d.getElementById,
		ns6:d.getElementById && agent.indexOf("Gecko") != -1
		},
	os:
  	{
		win:agent.indexOf("Win") != -1,
		mac:agent.indexOf("Mac") != -1
		}
	}; 

var distance = (sniff.os.mac && sniff.bw.ns6 || sniff.os.win && sniff.bw.ie4)?5:(sniff.os.mac && sniff.bw.ns)?6:4; 

function createScrollerObj(lyr1, lyr2)
	{
	this.container =
  	{
		obj:(sniff.bw.ns)?d[lyr1]:sniff.bw.ie?d.all[lyr1]:d.getElementById(lyr1),
		css:(sniff.bw.ns)?d[lyr1]:sniff.bw.ie?d.all[lyr1].style:d.getElementById(lyr1).style,
		height:(sniff.bw.ns)?d[lyr1].clip.height:sniff.bw.ie?d.all[lyr1].offsetHeight:d.getElementById(lyr1).offsetHeight
		};

	this.content =
  	{
		obj:(sniff.bw.ns)?d[lyr1].document[lyr2]:sniff.bw.ie?d.all[lyr2]:d.getElementById(lyr2),
		css:(sniff.bw.ns)?d[lyr1].document[lyr2]:sniff.bw.ie?d.all[lyr2].style:d.getElementById(lyr2).style,
		height:(sniff.bw.ns)?d[lyr1].document[lyr2].clip.height:sniff.bw.ie?d.all[lyr2].offsetHeight:d.getElementById(lyr2).offsetHeight,
		move:moveLyr,
		top:0
		};

	this.prop =
  	{
		dif:this.container.height - this.content.height
		};
	return this;
	} 

//move something
function moveLyr(x, y)
	{
	this.css.left = x;
	this.css.top = y;
	} 

function scrollDown(num)
	{
	var obj = (eval("scroller" + num));
	b = true;
	if (obj.container.height < obj.content.height)
  	{
		obj.content.move(0, (parseInt(obj.content.top) - distance));
		if (parseInt(obj.content.top) >= parseInt(obj.prop.dif))
    	{
			tid = setTimeout("scrollDown('" + num + "')", speed);
			}
		obj.content.top = parseInt(obj.content.top) - distance;
		}
   else
   	{
		stop();
		}
	} 

function scrollUp(num)
	{
	var obj = (eval("scroller" + num));
	b = true;
	if(parseInt(obj.content.top) != 0)
  	{
		obj.content.move(0, (parseInt(obj.content.top) + distance));
		obj.content.top = parseInt(obj.content.top) +distance;
		tid = setTimeout("scrollUp('" + num + "')", speed);
		}
	} 

function stopScroll()
	{
	clearTimeout(tid);
	b = false
	} 

function createObj()
	{
	scroller1 = new createScrollerObj('divContainer1', 'divContent1');
  scroller2 = new createScrollerObj('divContainer2', 'divContent2');
	}

function overLyr(layerName, imgName, img_src)
	{
	d.layers?d[layerName].document[imgName].src=img_src:d[imgName].src=img_src;
	}

function outLyr(layerName, imgName, img_src)
	{
	d.layers?d[layerName].document[imgName].src=img_src:d[imgName].src=img_src;
	}

function popupWindow(url,specs)
	{
	window.open(url, "aWindow", specs);
	}
  