 @timer = null
 dialogIsOpen = false
 dialog = $("<table id='dialog'></table>")
-path = null
+@path = null
 @file = null
 
 #functions



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
			

		enterBind = (e) ->
			code = if e.keyCode then e.keyCode else e.which
			if code is 13
				save @path+'/'+$('#newFN').val()
				closeDialog()

		dialog.append(
