   $("#"+d+"_panel").fadeTo("slow", 1)
   if d is "to"
     App.to = item
+    App.to_choosen = true
     $("#to_input").hide()
-    switchmode "from"
-    initInputBox
-      region: "de"
-      direction: "from"
-      selector: "#from_input_field"
-      showpanel: true
+    if not App.from_choosen
+      switchmode "from", "to"
+      initInputBox
+        region: "de"
+        direction: "from"
+        selector: "#from_input_field"
+        showpanel: true
   if d is "from"
+    App.from_choosen = true
     App.from = item
-    switchmode "result"
+    switchmode "result", "from"
 
 
 setupsocket = ->

  to: {}
  from: {}
  socket: {}
  geotypes: ["locality","sublocality","street_address","route"]
  # "locality", "premise", "subpremise", "route", "street_address
  mode: "splash"


switchmode = (mode, lastmode) ->
  if mode == "to"
    $("#to_input, #to_panel").show()
    $("#start_splash").hide()
  else if mode == "from"
    $("#from_input, #from_panel").show()
    $("#start_splash").hide()
  else if mode == "result"
    $("#middle_overlay, #to_input, #from_input").hide()
    $("#options").show()
    $("#rides").show()

  App.mode = mode
 
  # for debugging

    geocoder_region: params.region
    geocoder_address: true
    geocoder_types: App.geotypes.join(",")
    mapheight: 120
    mapwidth: 120
    noCache: true
    MapTypeIdaptype: "hybrid"
    select: (event, ui) ->
