var x0=0; // Startwert
var x1; // CA Wert da Script in 60er Schritten läuft
var c_width;

var down_speed=125; // Geschwindigkeit beim runterfahren
var up_speed=60; // Geschwindigkeit beim hochfahren

function current_width(div_menue_id){
	if(c_width=document.getElementById(div_menue_id).style.width){
		}
	else{
		c_width=0;
		}
	c_width=parseInt(c_width);
	
	//alert("aktuelle breite von "+div_menue_id+" beträgt: "+c_width);
	return(c_width);
	}

function move(identifier,x1){
	c_width=current_width('m'+identifier);
	
	if(c_width != x1){
		x0=c_width;
		move_down(identifier,c_width,x1);
		}
	else{
		x1=c_width;
		document.getElementById('l'+identifier).style.display = 'none';
		move_up(identifier,c_width);
		}
	}

// Rausfahren
function move_down (identifier,c_width,x1){
	c_width = c_width + down_speed;
	
	document.getElementById('b'+identifier).style.display = "";
	document.getElementById('m'+identifier).style.width = c_width + "px";
	
	tmp_x1=x1-down_speed;
	
	if(c_width < tmp_x1){
		setTimeout("move_down("+identifier+","+c_width+","+x1+")",0);
		}
	else{
		document.getElementById('m'+identifier).style.width = x1 + "px";
		document.getElementById('a'+identifier).style.background = "url(img/schalter_out.gif)";
		document.getElementById('l'+identifier).style.display = '';
		}
	}

// Reinfahren
function move_up (identifier,c_width){
	c_width = c_width - up_speed;
	document.getElementById('m'+identifier).style.width = c_width + "px";
	
	tmp_x0=x0+up_speed; // Rechnet den mindestabstand aus
	
	if(c_width > tmp_x0){ // wenn mindestabstand noch nicht erreicht dann weiter verkleinern
		setTimeout("move_up("+identifier+","+c_width+")",0);
		}
	else{ // wenn mindestabstand erreich dann auf null setzten.
		document.getElementById('m'+identifier).style.width = x0 + "px";
		document.getElementById('b'+identifier).style.display = "none";
		document.getElementById('a'+identifier).style.background = "url(img/schalter_in.gif)";
		}
	}