 					if @success != null then @success(@response)
 					Request.callHttpEvent(@response, @, 'success')
 				else
-					error = new Error 'Can not load ' + @url + ' address'
+					error = new Error 'Can not load ' + url + ' address'
 					if @error != null then @error(error)
 					Request.callHttpEvent(@response, @, 'error', [error])
 



	constructor: (@url, @type = 'GET', @data = null) ->
		@type = @type.toUpperCase()
		if @type not in ['GET', 'POST', 'PUT', 'DELETE']
			throw new Error 'Http request: type must be GET, POST, PUT or DELETE, ' + @type + ' given'

		if @data != null
			@data = Request.parseData(@data)
			if @type != 'POST'
				@url = if @url.indexOf('?') != -1 then @url + '&' + @data else @url + '?' + @data
				@data = null

		@xhr = Request.createRequestObject()
		@xhr.open(@type, @url, true)

		if @type == 'POST'
			@setHeader('Content-type', 'application/x-www-form-urlencoded')

			return new ActiveXObject("Microsoft.XMLHTTP")


	@callHttpEvent: (response, request, event, args = []) ->
		if Request.Http == null
			Request.Http = require './Http'
