function nsBrowFix() {
	if(pageWidth!=innerWidth || pageHeight!=innerHeight)
		location.reload()
}


if(document.layers) {
	pageWidth=innerWidth
	pageHeight=innerHeight
	window.onresize=nsBrowFix
}


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;
} 

//scroll div identified as scrollerX down
function scrollDown(num) {
	var obj = (eval("scroller" + num));
	b = true;
	var denaam = (num==1?"divText":"divText2");
	var deander = (num==1?"divText2":"divText");
	var contentdiv = layer(denaam);
	var contentdiv2 = layer(deander);
	//if (obj.container.height < obj.content.height) {
	if (parseInt(layerheight) < parseInt(contentdiv.getHeight())) {
		obj.content.move(0, (parseInt(contentdiv.getTop()) - distance));
//		if (parseInt(contentdiv.getTop()) >= parseInt(obj.prop.dif)) {
//		alert(parseInt(contentdiv.getTop()+contentdiv.getHeight())+" >= "+parseInt(layertop+layerheigth));
		if (parseInt(contentdiv.getTop())+parseInt(contentdiv.getHeight()) >= parseInt(contentdiv.getTop())+(parseInt(layerheight)-160)) {
			tid="";
			tid = setTimeout("scrollDown('" + num + "')", speed);
		}
		obj.content.top = parseInt(contentdiv.getTop()) - distance;
	} else {
		stop();
	}
} 

//scroll div identified as scrollerX up
function scrollUp(num) {
	var obj = (eval("scroller" + num));
	b = true;
	var denaam = (num==1?"divText":"divText2");
	var contentdiv = layer(denaam);
	if(parseInt(contentdiv.getTop()) != 0) {
		obj.content.move(0, (parseInt(contentdiv.getTop()) + distance));
		obj.content.top = parseInt(contentdiv.getTop()) +distance;
		tid="";
		tid = setTimeout("scrollUp('" + num + "')", speed);
	}
} 

//stopp all divs from scrolling
function stopScroll(denaam) {
	clearTimeout(tid);
	b = false
}
