function lib_tmcheck(){
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	// de volgende checked dus gewoon op msie(als er iemand uberhaupt nog 3 of minder gebruikt is dat uitermate heldhaftgte noemen)
	this.ie7=(this.ver.indexOf("MSIE")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6||this.ie7
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.tm=(this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}

var tm = new lib_tmcheck()
var numScrollPages = 1
var transitionOut = 0;
var transitionIn = 0;
var slideAcceleration = 0;
var transitionOnload = 0
var activePage = null
var busy = 0;
var px = tm.ns4||window.opera?"":"px";

if(document.layers){ 
	scrX = innerWidth; scrY= innerHeight;
	onresize= function(){
		if(scrX!= innerWidth || scrY!= innerHeight){
			history.go(0)
		}
	}
}

//
function scrollerobj(obj,nest){
	nest = (!nest)?"":'document.'+nest+'.'
	
	this.elm = tm.ie4?document.all[obj]:tm.ns4?eval(nest+'document.'+obj):document.getElementById(obj)
	this.css = tm.ns4?this.elm:this.elm.style
	
	this.doc = tm.ns4?this.elm.document:document
	this.obj = obj+'scrollerobj'; eval(this.obj+'=this')
	
	this.x = (tm.ns4||tm.opera5)?this.css.left:this.elm.offsetLeft
	this.y = (tm.ns4||tm.opera5)?this.css.top:this.elm.offsetTop
	
	this.w = (tm.ie4||tm.ie5||tm.ie6||tm.ie7||tm.ns6)?this.elm.offsetWidth:tm.ns4?this.elm.clip.width:tm.opera5?this.css.pixelWidth:0
	this.h = (tm.ie4||tm.ie5||tm.ie6||tm.ie7||tm.ns6)?this.elm.offsetHeight:tm.ns4?this.elm.clip.height:tm.opera5?this.css.pixelHeight:0
}

//
scrollerobj.prototype.moveTo = function(x,y){

	//alert(this.css)

	//document.getElementById('debug').innerHTML = "x:"+x+" :: y:"+y+" :: css-left:"+this.css.left+" :: css-top:"+this.css.top
	
	if(x!=null){
		this.x = x; 
		this.css.left = x+px;
	}
	if(y!=null){
		this.y=y; 
		this.css.top = y+px;
	}
}
scrollerobj.prototype.moveBy = function(x,y){
	this.moveTo(this.x+x,this.y+y)
}

//
var scrollTimer = null;

function scroll(step){
	//window.status = step
	
	
	clearTimeout(scrollTimer);
	//if ( step >= 0 && parseInt(activePage.y,10) <= 1 || step <=0 ) {
	
	
	
	var h1 = activePage.y + activePage.h
	
//document.getElementById('debug').innerHTML = "step: "+step+" activePage.y: "+activePage.y+" activePage.h: "+activePage.h+" scroller1.h: "+scroller1.h+" h1: "+h1
	if(h1 < 10){
		init();	
	}	


	if ( 
		(
			step < 0 && 
			h1 > scroller1.h
		)
		 || 
		(
			step > 0 && activePage.y < 0 
			)
	){

		activePage.moveBy(0,step);
		scrollTimer = setTimeout('scroll('+step+')',40);
		
	}
		//alert("step:"+step);
		//alert("y"+parseInt(activePage.y,10));
	//}
}
function stopScroll(){
	clearTimeout(scrollTimer);
}
