


 function bm(element, tagname, classname, onlyfirst)
 {
	var node= (typeof(element) == 'object') ? element : (element == 'body') ? document.body : document.getElementById(element);
	if (tagname == null) return node;
	else
	{
		blocks= node.getElementsByTagName(tagname);
		blocks_choice= new Array();
		for (var x= 0; x < blocks.length; x++) if ((classname != null && blocks[x].className.contains(classname)) || (classname == null)) blocks_choice.push(blocks[x]);
		return (onlyfirst) ? blocks_choice[0] : blocks_choice;
	}
 }



 function timer_class()
 {
	this.workqueue= new Array();
	this.timerinterval;
	this.active= false;


	this.checkinterval= function()
	{
		if (!this.active) { this.timerinterval= setInterval('timer.work()', 20); this.active= true; }
	}


	this.work= function()
	{
		if (this.workqueue.length == 0) { clearInterval(this.timerinterval); this.active= false; return; }

		var now= new Date().getTime();

		for (job in this.workqueue) if (now >= this.workqueue[job][3]) if (this['action_'+this.workqueue[job][1]](this.workqueue[job][0], this.workqueue[job][2])) this.removework(this.workqueue[job][0], this.workqueue[job][1], this.workqueue[job][2]);
	}


	this.addwork= function(element, func, type, vars, offset)
	{
		if (element.length >= 1)
		{
			for (var i= 0; i < element.length; i++) this.addwork(element[i], func, type, vars, offset);
			return;
		}	

		var now= new Date().getTime();
		var offset= (offset == null) ? 0 : offset;

		if (!element['vars']) element['vars']= new Object();
		if (!element['vars'][func]) element['vars'][func]= new Object();

		if (type == null) for (var v in vars) element['vars'][func][v]= vars[v];
		else { if (!element['vars'][func][type]) element['vars'][func][type]= new Object(); for (var v in vars) element['vars'][func][type][v]= vars[v]; }

		var addarray= new Array(element, func, type, now-(-offset));
		var added= false;

		for (var x= 0; x < this.workqueue.length; x++) if (this.workqueue[x][0] == element && this.workqueue[x][1] == func) { if (this.workqueue[x][2] != null && type != null && this.workqueue[x][2] != type) { } else { this.workqueue[x]= addarray; added= true; } }

		if (!added) this.workqueue.push(addarray);

		this.checkinterval();
	}


	this.removework= function(element, func, type)
	{
		for (var x= 0; x < this.workqueue.length; x++) if (this.workqueue[x][0] == element) if (func == this.workqueue[x][1] || func == null) if (type == this.workqueue[x][2] || type == null) { this.workqueue.splice(x, 1); x--; }
	}


	this.action_fade= function(element, type)
	{
		if (element.style.display != 'block') element.style.display= 'block';

		var vars= element['vars']['fade'];

		var from= (!vars['from'] && vars['from'] != 0) ? vars['from_default'] : vars['from'];
		var to= vars['to'];

		var c= Math.round(1/10 * Math.abs(from-to) + 1);
		var newvalue= (to > from) ? (from-(-c) > to) ? to : from-(-c) : (from-c < to) ? to : from-c;
		
		if (newvalue == 0) { element.style.display= 'none'; return true; }

		vars['from']= newvalue;

		element.style.filter= (newvalue == 100) ? '' : 'alpha(opacity = '+newvalue+')';
		//element.style.filter= 'progid:DXImageTransform.Microsoft.Alpha(Opacity=' + newvalue + ')';
		element.style["-moz-opacity"]= ""+(newvalue/100);
		element.style["opacity"]= ""+(newvalue/100);

		return (newvalue == to) ? true : false;
	}


	this.action_move= function(element, type)
	{
		if (element.style.display != 'block') element.style.display= 'block';

		var vars= element['vars']['move'][type];
		
		if (vars['counter'] == null) vars['counter']= 0;
		vars['counter']++;

		switch (type)
		{
			case 'width'	:	var from= element.offsetWidth;
								break;
			case 'height'	:	var from= element.offsetHeight;
								break;
			case 'left'		:	var from= element.offsetLeft;
								break;
			case 'top'		:	var from= element.offsetTop;
								break;
			default			:	var from= vars['from'] || vars['defaultfrom'];
		}

		if (vars['forcefrom'] != null) { from= vars['forcefrom']; vars['forcefrom']= null; }
		
		if (vars['speed'] != null)
		{
			if (vars['actualspeed'] == null) vars['actualspeed']= 0;
			
			var to= from;
			var speed= vars['actualspeed'];
			if (vars['counter']%6 == 0 && vars['speed'] != vars['actualspeed']) speed= (vars['speed'] > vars['actualspeed']) ? vars['actualspeed']+1 : vars['actualspeed']-1;
			var newvalue= from + speed;
			if (vars['min'] != null)
			{
				if (newvalue < vars['min']+14 && vars['speed'] < 0) { newvalue= from-1; speed= -1; }
				if (newvalue < vars['min']) { newvalue= vars['min']; to= newvalue; speed= 0; }
			}
			if (vars['max'] != null)
			{
				if (newvalue > vars['max']-14 && vars['speed'] > 0) { newvalue= from+1; speed= 1; }
				if (newvalue > vars['max']) { newvalue= vars['max']; to= newvalue; speed= 0; }
			}
			vars['actualspeed']= speed;
		}
		else
		{
			var to= vars['to'];
	
			var sub= (to - from) / 5 * (-1);
			if (sub < 2 && sub > 0) sub= 2;
			if (sub < 0 && sub > -2) sub= -2;
			var newvalue= from - Math.round(sub);
			if (Math.abs(from-to) <= 2) newvalue= to;
		}

		if (newvalue == 0 && (type == 'width' || type == 'height')) { element.style.display= 'none'; return true; }
		else element.style[(type.substring(type.length-7) == 'percent')?type.substring(0,type.length-7):type]= (type.substring(type.length-7) == 'percent') ? newvalue + '%' : newvalue + 'px';

		vars['from']= newvalue;

		return (newvalue == to) ? true : false;
	}

 }

 var timer= new timer_class(), global_timer= timer;





 function ajax(query, callbackfunction, nojson)
 {
 	this.query= query;
 	this.callbackfunction= callbackfunction;
 	this.nojson= (nojson == null || nojson == false) ? false : true;

 	this.request= null;
 	this.sending= false;
 	this.content= null;
 	this.contentType= 'application/x-www-form-urlencoded; charset=UTF-8';

 	this.send= function(content)
 	{
 		if (this.sending) this.abort();
 		if (window.XMLHttpRequest) this.request= new XMLHttpRequest();              
		else this.request= new ActiveXObject("Microsoft.XMLHTTP");
		if (this.request == null) return false;

		if (typeof(content) == 'object') content= this.parse_form(content);
		this.content= content;

		var request= this.request;
		var that= this;
		this.request.onreadystatechange= function()
		{
			if (request.readyState == 4)
			{
				if (request.status == 200)
				{
					callbackfunction((this.nojson) ? request.responseText : request.responseText.json());
					that.abort();
				}
				else that.send(that.content);
			}
		}

		//this.query= this.query.replace(/\//, '');
		this.query= this.query.replace(/ /i, '+');
		this.request.open("post", 'suchen/' + encodeURIComponent(this.query));
		this.request.setRequestHeader("Content-Type", this.contentType);
		request.send(content);
		this.sending= true;
 	}

 	this.abort= function()
 	{
 		if (!this.sending) return;
		this.request.abort();
		this.request= null;
		this.sending= false;
 	}

 	this.parse_form= function(form)
 	{
		var elements = form.elements;
		var pairs= new Array();

		for (var i= 0; i < elements.length; i++)
		{
			if ((name= elements[i].name) && (value= elements[i].value))
            pairs.push(name + "=" + encodeURIComponent(value));
		}
		return pairs.join("&");
 	}
 }






 function scrolldiv(div)
 {
 	var that= this;
 	this.div= div;
 	this.slider= bm(this.div, 'div', 'slider', true);
 	this.move= 0;
 	this.min;
 	this.max;
 	
 	this.div.addevent("mousemove", function(ev) {
 		that.min= (that.slider.offsetWidth-that.div.offsetWidth)*(-1);
 		that.max= 0;
 		var total= (that.div.offsetWidth/2);
 		var exp= total-(ev.x-that.div.offsetLeft);
 		var amount= 0;
 		for (var x= 2; x < 8; x++) if (total - Math.abs(exp) < total / x) amount= (exp < 0) ? (x-1)*(-1) : x-1;
 		that.slider.move('left', amount, that.min, that.max);
 	});

 	this.div.addevent("mouseout", function(ev) { if (that.div.nochild(ev)) that.slider.move('left', 0, that.min, that.max); });
 }






 Object.prototype.execute= function(func, vars)
 {
 	if (this.length >= 1) 
	{
		var returns= new Array();
		for (var i= 0; i < this.length; i++) returns.push(func(this[i], i, vars));
		return returns;
	}
	else return (this == false) ? false : func(this, i, vars);
 }




 Element.prototype.move= function(type, amount, min, max)
 {
	timer.addwork(this, 'move', type, {speed : amount, min : min, max : max});
 }

 Element.prototype.moveto= function(type, to, defaultfrom, forcefrom, offset)
 {
	timer.addwork(this, 'move', type, {to : to, defaultfrom : defaultfrom, forcefrom : forcefrom, speed : null}, offset);
 }


 Element.prototype.fadein= function(offset)
 {
	timer.addwork(this, 'fade', null, {from : 0, to : 100}, offset);
 }

 Element.prototype.fadeout= function(offset)
 {
	timer.addwork(this, 'fade', null, {from : 100, to : 0}, offset);
 }

 Element.prototype.fadeto= function(to, defaultfrom, offset)
 {
	timer.addwork(this, 'fade', null, {from_default : defaultfrom, to : to}, offset);
 }

 Element.prototype.fade= function(from, to, offset)
 {
	timer.addwork(this, 'fade', null, {from : from, to : to}, offset);
 }




 Element.prototype.addevent= function(type, func)
 {
	if (this.addEventListener) this.addEventListener(type, func, false);
	else if (this.attachEvent)
	{
		this["e"+type+func]= func;
		this[type+func]= function() { this["e"+type+func](window.event); }
		this.attachEvent("on"+type, this[type+func]);
	}
 }

 Element.prototype.removeevent= function(type, func)
 {
	if (this.removeEventListener) this.removeEventListener(type, func, false);
	else if (this.detachEvent)
	{
		this.detachEvent("on"+type, this[type+func]);
		this[type+func]= null;
		this["e"+type+func]= null;
	}
 }

 Element.prototype.nochild= function(e, ieinvers)
 {
	var etarget= (e.relatedTarget) ? e.relatedTarget : (ieinvers) ? e.fromElement : e.toElement;
	var echildren= this.getElementsByTagName('*');
	for (var i= 0; i < echildren.length; i++) if(echildren[i] == etarget || this == etarget) return false;
	return true;
 }




 Element.prototype.scrollable= function()
 {
	this.script= new scrolldiv(this);
 }






 Array.prototype.contains= function(value)
 {
	for (var i= 0; i < this.length; i++) if (this[i] === value) return true;
	return false;

 };


 Array.prototype.drop= function(value)
 {
	for (var x= 0; x < this.length; x++) if (this[x] == value) { this.splice(x, 1); return true; }
	return false;

 };





 String.prototype.contains= function(value)
 {
	var classes= this.split(' ');
	for (var i= 0; i < classes.length; i++) if (classes[i] == value) return true;
	return false;
 }


 String.prototype.cleanatt= function()
 {
	return (this.substr(this.length-2, 2) == 'px') ? this.substr(0, this.length - 2) : this;
 }

 String.prototype.json= function()
 {
 	return (this.substr(0, 1) == '{' || this.substr(0, 1) == '[') ? eval('('+this+')') : String(this);
 }




var _st = window.setTimeout;
 
window.setTimeout = function(fRef, mDelay) { 
    if(typeof fRef == "function") {  
        var argu = Array.prototype.slice.call(arguments,2); 
        var f = (function(){ fRef.apply(null, argu); }); 
        return _st(f, mDelay); 
    } 
    return _st(fRef,mDelay);
}




