var tidigarePlats = 0;
var avstand = 35;
var antal = 0;
var top = 0;
function item_clicked(vantal, id, vplats, vunder){
	if(tidigarePlats == 0){
		oppna(vplats, vantal, vunder);
		tidigarePlats = vplats;
	}else if(tidigarePlats != vplats && tidigarePlats != 0){
	 	stang(tidigarePlats, vantal);
		oppna(vplats, vantal, vunder);
		tidigarePlats = vplats;
	}else if(tidigarePlats == vplats){
		stang(vplats, vantal);
		tidigarePlats = 0;
	}
}
function stang(tplats, tantal){
 top = 150;
		document.getElementById('urub'+tplats).style.visibility = 'hidden';
		top += (tidigarePlats*avstand);
	for( i = tplats+1 ; i < tantal+1 ; i++ ){
		document.getElementById('rub'+i).style.top = top+avstand;
		top+=avstand;
	}
}
function oppna(tplats, tantal, tunder){
  top = 150;
	document.getElementById('urub'+tplats).style.visibility = 'visible';
	top += (tplats*avstand)+(tunder*18);
	for( i = tplats+1 ; i < tantal+1 ; i++ ){
		document.getElementById('rub'+i).style.top = top+avstand;
		top+=avstand;
	}
}
