function addEvent(obj, evType, fn){ 
	if (obj.addEventListener){ 
		obj.addEventListener(evType, fn, false); 
		return true; 
	} else if (obj.attachEvent){ 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} else { 
		return false; 
	} 
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

var step = 10;//mehr=schneller
var timer = null;

function scroll(val, obj_id){
	clearTimeout(timer);
	obj=document.getElementById(obj_id);
	y=obj.scrollTop;

	if(val==1)y-=step;
	if(val==2)y+=step;

	if(y<=obj.scrollHeight-obj.offsetHeight+step && y>=0-step){
		obj.scrollTop=y;
		timer=setTimeout('scroll('+val+',"'+obj_id+'")',50);
	}
	if(y<0||y>obj.scrollHeight-obj.offsetHeight){
		clearTimeout(timer);
	}
}

function toggle_controls(outter_id, inner_id, controls_id, size) {
	outter = document.getElementById(outter_id);
	inner = document.getElementById(inner_id);
	
//	alert(outter.offsetHeight - inner.offsetHeight);

	if (inner.offsetHeight < size) {
		document.getElementById(controls_id).style.visibility="hidden";
	}
}

