This is a string:
flyout_id = "$('#"+id_name+"')";
What you presumably wanted to do was create a jQuery object:
flyout_id = $("#"+id_name);
Also note, since all your switch statement does is add "_fly" to the end of ID
(except for the case of sprache
), you could replace it with just:
id_name = ID;
if (ID !== "sprache") {
id_name = ID + "_fly";
}