function w_dropdown_dep(container_, options_)
{
	this.container = container_;
	
	this.opt = new Array();
	
	if (options_ != null)
	{
		for (x in options_)
			this.opt[x] = options_[x];
	}

	this.items = new Array();
	this.itemIndex = 0;
	
	this.loadData = function() {
		
		// This is how it should work live:
		
		if (this.opt["url"] != null)
		{
			var self = this;
			$j.ajax({
				async: true,
				url: this.opt["url"],
				method: "GET",
				cache: false,
				data: "item=" + this.opt["value_dep"],
				dataType: "jsonp",
				timeout: 5000,
				success: function(json) {
					if (json.found != 0){	
						self.items= new Array();
						for (iitem in json.news){
							if (json.news.hasOwnProperty(iitem)) {
								var a = new Array();
								a["ID_Departure"] = json.news[iitem].ID_Departure;
								a["NAME"] = json.news[iitem].NAME;
								self.items.push(a);
							}
						 }
						 self.displayItems();
					}
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
				}
			});	
		}
	}
	var initHtml = '<option value="">Select a departure point</option>';
	this.displayItems = function() {
		var self = this;
		
		if (this.items != null)
		{
			
			for(i in this.items)			
			{
				if (this.items.hasOwnProperty(i)) {
					var theItem = this.items[i];
					
					
					initHtml+='<option value="' + theItem["ID_Departure"] + '">' + theItem["NAME"] + '</option>';
					
				}				
			}			
		}		
		$j(this.container).html(initHtml);		
		
	}
	this.loadData();	
}
