bw=new checkBrowser()

var loop3, timer3
var loaded3;
var Merker3=false;
var firstMove3=false;
var mouse_pos3;

function makeObj3(obj,nest){		//Object constructor
	if (!nest) {nest=''}
		else {nest='document.'+nest+'.'}
	this.el=0;
	this.css=0;
	if (bw.dom) {
		this.el=document.getElementById(obj);
		this.css=document.getElementById(obj).style;
		this.scrollHeight=this.el.offsetHeight;
		this.clipHeight=this.el.offsetHeight;
		}
	if (bw.ie4) {
		this.el=document.all[obj];
		this.css=document.all[obj].style;
		this.scrollHeight=this.el.offsetHeight;
		this.clipHeight=this.el.offsetHeight;
		}
	if (bw.ns4) {
		this.el=eval(nest+'document.'+obj);
		this.css=eval(nest+'document.'+obj);
		this.scrollHeight=this.css.document.height;
		this.clipHeight=this.css.clip.height;
		}
	this.up=goUp3;this.down=goDown3;
	this.moveIt=moveIt; this.x; this.y;
    this.obj = obj+ "Object";
    eval(this.obj + "=this")
    return this
	}

function goDown3(move){	//Makes the object go up
	if(this.y>(-this.scrollHeight+oCont3.clipHeight)) {
		this.moveIt(0,this.y-move)
		step=(this.y-move)/(-this.scrollHeight+oCont3.clipHeight)
		knubbel_move3(step)
		if(loop3) setTimeout(this.obj+".down("+move+")",speed)
		}
	}
function goUp3(move){	//Makes the object go down
	if(this.y<0) {
		this.moveIt(0,this.y-move)
		step=(this.y-move)/(-this.scrollHeight+oCont3.clipHeight)
		knubbel_move3(step)
		if(loop3) setTimeout(this.obj+".up("+move+")",speed)
		}
	}
function scroll3(speed){	//Calls the scrolling functions. Also checks whether the page is loaded or not.
	if(loaded3){
		loop3=true;
		firstMove3=true;
		if(speed>0) oScroll3.down(speed)
		else oScroll3.up(speed)
		}
	}
function noScroll3(){	//Stops the scrolling (called on mouseout)
	loop3=false
	if(timer3) clearTimeout(timer3)
	}

function knubbel_move3(step) {
	if (step<0) step=0
	if (step>1) step=1
	oKnubbel3.css.top=oKnubbel3.topposition+(step*oKnubbel3.laufweite)
	}


function get_knubbel3(e) {
	if((document.layers && e.which!=1) || (document.all && event.button!=1)) return true; // Rechte Mausbutton
	getMouse(e);
	
	// Activation du Drag
	if(bw.ns4){
		document.captureEvents(Event.MOUSEMOVE);
		}
	document.onmousemove = drag3;

if (firstMove3) {
		if((mouseY>=parseInt(oKnubbel3.css.top) && mouseY<=parseInt(oKnubbel3.css.top)+12) && (mouseX>=oKnubbel3.leftposition && mouseX<=oKnubbel3.leftposition+12)){
			Merker3 = true;
			return false;
			}
		}
	else {
		if((mouseY>=oKnubbel3.topposition && mouseY<=oKnubbel3.topposition+12) && (mouseX>=oKnubbel3.leftposition && mouseX<=oKnubbel3.leftposition+12)){
			Merker3 = true;
			firstMove3=true;
			return false;
			}
		}
	}

function drag3(e) {
	if (Merker3) {
		getMouse(e);
		if (mouseY>=oKnubbel3.topposition && mouseY<=oKnubbel3.bottomposition) {
			oKnubbel3.css.top=mouseY;
			knubbel_position=(mouseY-oKnubbel3.topposition)/(oKnubbel3.laufweite);
			if (knubbel_position<0) knubbel_position=0;
			if (knubbel_position>1) knubbel_position=1;
			drag_content=knubbel_position*(oScroll3.scrollHeight-oCont3.clipHeight);
			oScroll3.moveIt(0,-drag_content);
			}
		else if (mouseY<oKnubbel3.topposition) {
			oKnubbel3.css.top=oKnubbel3.topposition;
			oScroll3.moveIt(0,0);
			}
		else if (mouseY>oKnubbel3.bottomposition) {
			oKnubbel3.css.top=oKnubbel3.bottomposition;
			oScroll3.moveIt(0,-oScroll3.scrollHeight+oCont3.clipHeight);
			}
		// if (bw.ie4 || bw.ie5) return false;
		return false;
		}
	}

function lost_knubbel3(e) {
	Merker3=false;
	}

function wheel3(e)
{
	if (!e) e = window.event;
	// window.alert(e.wheelDelta/10);
	scroll3(-e.wheelDelta/10);
	noScroll3();
}

function scrollInit3(left_knubbel,start_knubbel,hoehe_knubbel){	//Makes the object
	oContainer3=new makeObj3('container');
	oCont3=new makeObj3('divCont3')
	oKnubbel3=new makeObj3('knubbel3');
	// oScroll=new makeObj('textbox','divCont')
	oScroll3=new makeObj3('textbox3','divCont3')
	oScroll3.moveIt(0,0)
	if (start_knubbel) oKnubbel3.topposition=start_knubbel
	else oKnubbel3.topposition=0;
	if (left_knubbel) oKnubbel3.leftposition=left_knubbel
	else oKnubbel3.leftposition=0;
	if (hoehe_knubbel) oKnubbel3.bottomposition=oKnubbel3.topposition+hoehe_knubbel
	else oKnubbel3.bottomposition=oKnubbel3.topposition+0;
	oKnubbel3.laufweite=oKnubbel3.bottomposition-oKnubbel3.topposition
	loaded3=true;
	if(bw.ns4){
		document.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);
		}
	document.onmousewheel = wheel3;
	document.onmousedown = get_knubbel3;
	// document.onmousemove = drag;
	document.onmouseup = lost_knubbel3;
	scroll3(1);
	scroll3(-1);
	noScroll3();
	}
