 				window.open "http://localhost:8000?file=none"
 			
 			when 79 #O
-				showFileDialog(path, open)
+				showFileDialog(@path, open)
 			
 			when 83 
 				if @file? and !e.shiftKey
 					save(@file)
 				else
 					# serverLog "save stuff:#{@file} #{e.shiftKey}"
-					showFileDialog(path, save) #S
+					showFileDialog(@path, save) #S
 			
 			when 87 #W - close tab
 				close()



showFileDialog = (p, callback) ->
	path = p
	path = path.replace "//", "/"
	dialogIsOpen = true
	debug "show save window:#{path}"
	sendReq {action:'fileList',path:path}, 'POST', (data) ->
		# debug "save window file list:#{data}"
		table = $("<table cellspacing='2' cellpadding='2' id='filebrowser'></table>")
		table.append("<colgroup><col span='1'/><col span='1' style='width:100px;'/></colgroup>")
		table.append("<thead><tr><th>file/dir name</th><th>type</th></tr></thead>")

		do ->
			if path is "/" then return
			up = path
			if up isnt "/" and up.match "/$"
				up = up.substring 0, up.length-1
			




# @input.bind 'keyup', (e)->
	# e.preventDefault()
	# e.stopPropagation()
