var booking_class = application.extend({
	end : function () {
		Rimory.map.rem_marker_group("booking");
		return this._super();
	},
	map_click : function (lat, lng, title, icon, id, opts, group, mrk) {
		if(group == "booking") {
			Rimory.map.show_bubble(new GLatLng(lat,lng), { 
				title		: lat + "<br />" + lng, 
				url			: "/app/booking/" + id, 
				callback	: function () { 
					Rimory.map.geocoder.getLocations(new GLatLng(lat,lng), function(data) {
						if(data.Status.code == 200) { $("#addr").html(data.Placemark[0].address); }
					}); 
				}
			});
		}
		else this._super(lat, lng, title, icon, id, opts, group, mrk);
	},
	search : function(cb) {
		var _this = this;
		$.post("/app/booking/search", { srch : $('#book_srch').val(), from : $("#book_from").val(), to : $("#book_to").val(), sort : $("#book_sort").val() }, function (data) {
			$("#book_hotels").slideDown();
			/*
			var s = $("Point coordinates", data).size();
			$("Point coordinates", data).each( function (i) {
				var tmp = $(this).text().split(",");
				if(tmp[0] === last_lng && tmp[1] === last_lat) return;
				Rimory.map.instance.addOverlay(Rimory.map.add_marker(tmp[1], tmp[0], "", (i == (s - 2) ? "track_end" : "track_one"), $(this).parents("Placemark:eq(0)").children("description").text().split("|")[0].split(":")[1], {}, "trace"));
				last_lng = tmp[0];
				last_lat = tmp[1];
			});
			_this.line = Rimory.map.draw_line("trace");
			Rimory.map.instance.addOverlay(_this.line);
			_this.get_distance();
			if(!cb || $("#keep_on_screen").is(":checked")) Rimory.map.zoom_to_group("trace");
			_this.track_to = setTimeout(function() { _this.trace(true); }, 5000);
			*/
		});
	}
});
Rimory.inst.booking = new booking_class();