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

				if type is 'directory'
					cb = (file) -> 
						closeDialog()
						showFileDialog("#{path}/#{file}", callback)
				else if type is 'file'
					cb = (file) ->
						closeDialog()
						callback("#{path}/#{file}")
					
				table.append(
					$("<tr></tr>")



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
			
