/**
 * @alias mvtours.pack
 * @author ArwebSystems <systems@arweb.com>
 * @since 2008.
 */

var mvtours = {
	
	custommer: {
		
		URL: "/mvtours/",
		
		images: {
			'home': ['nav_home_nrm.gif', 'nav_home_dwn.gif'],
			'about': ['nav_about_nrm.gif', 'nav_about_dwn.gif'],
			'mvinfo': ['nav_mvinfo_nrm.gif', 'nav_mvinfo_dwn.gif'],
			'tomonteverde': ['nav_howtogetthere_nrm.gif', 'nav_howtogetthere_dwn.gif'],
			'hotels': ['nav_hotels_nrm.gif', 'nav_hotels_dwn.gif'],
			'imgmvtours': ['nav_mvtours_nrm.gif', 'nav_mvtours_dwn.gif'],
			'horseback': ['nav_horseback_nrm.gif', 'nav_horseback_dwn.gif'],
			'packages': ['nav_packages_nrm.gif', 'nav_packages_dwn.gif'],
			'maps': ['nav_maps_nrm.gif', 'nav_maps_dwn.gif'],
			'transport': ['nav_transport_nrm.gif', 'nav_transport_dwn.gif']
		},
/* ---------------------------------------------------------------- */
		Master: {
			
			init: function () {
				/*
				MM_preloadImages(
					mvtours.custommer.URL + "images/gui_2_2_contact_sel.gif",
					mvtours.custommer.URL + "images/gui_2_3_mboard_sel.gif",
					mvtours.custommer.URL + "images/gui_2_4_gallery_sel.gif",
					mvtours.custommer.URL + "images/gui_2_5_s_sel.gif",
					mvtours.custommer.URL + "images/gui_2_6_sitemap_sel.gif"
				);
				*/
			},
			
			mi_onMouseOver: function (id) {
				var img = document.getElementById(id);
				var url = img.getAttribute("src").split("/");
				var name = url.pop();
				if (name == mvtours.custommer.images[id][0]) {
					url.push(mvtours.custommer.images[id][1]);
					img.setAttribute("src", url.join("/"));
				}
			},
			
			mi_onMouseOut: function (id) {
				var img = document.getElementById(id);
				var url = img.getAttribute("src").split("/");
				var name = url.pop();
				if (name == mvtours.custommer.images[id][1]) {
					url.push(mvtours.custommer.images[id][0]);
					img.setAttribute("src", url.join("/"));
				}
			}
			
		},
/* ---------------------------------------------------------------- */
		Index: {
			
			form: null,
			
			getJourneys: function () {},
			
			init: function (form) {
				mvtours.custommer.Index.form = form;
				
				var journeys = mvtours.custommer.Index.getJourneys();
				var cbFrom = new ComboBox(form.sFrom);
				var opts = new Array();
				var i;
				var j = journeys.length;
				for (i=0; i<j; i++) {
					opts.push(journeys[i]._from.id);
				}
				util.Array.unique(opts);
				var tmp;
				var k = opts.length;
				var l;
				cbFrom.removeAllItems();
				for (i=0; i<k; i++) {
					for (l=0; l<j; l++) {
						if (journeys[l]._from.id == opts[i]) {
							tmp = new Option(journeys[l]._from._name);
							tmp.value = journeys[l]._from.id;
							cbFrom.addItem(tmp);
							break;
						}
					}
				}
				mvtours.custommer.Index.sFrom_onChange();
			},
			
			sFrom_onChange: function () {
				var form = mvtours.custommer.Index.form;
				
				var journeys = mvtours.custommer.Index.getJourneys();
				var cbFrom = new ComboBox(form.sFrom);
				var cbTo = new ComboBox(form.sTo);
				var opts = new Array();
				var i;
				var j = journeys.length;
				for (i=0; i<j; i++) {
					if (journeys[i]._from.id == cbFrom.getValue()) {
						opts.push(journeys[i]._to.id);
					}
				}
				util.Array.unique(opts);
				var tmp;
				var k = opts.length;
				var l;
				cbTo.removeAllItems();
				for (i=0; i<k; i++) {
					for (l=0; l<j; l++) {
						if (journeys[l]._to.id == opts[i]) {
							tmp = new Option(journeys[l]._to._name);
							tmp.value = journeys[l]._to.id;
							cbTo.addItem(tmp);
							break;
						}
		  		}
				}
			}
			
		},
/* ---------------------------------------------------------------- */
		Results: {
			
			dataGrid: null,
			
			init: function () {
				mvtours.custommer.Results.dataGrid = new DataGrid("datagrid", {
					colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
				});
				var fResults = new Form(document.fResults);
				fResults.onSubmitException(
					function () {
						return Message.say(2);
					}
				);
			},
			
			bShow_onClick: function () {
				var rgJourney = new RadioGroup(document.fResults.rJourney);
				var id = rgJourney.getValue();
				if (id != null) {
					var frame = new Frame("summary.php?id=" + id.toString(), {width: 400, height: 220});
					frame.show();
				} else {
					Message.say(2);
				}
			}
			
		},
/* ---------------------------------------------------------------- */
		Info: {
			
			init: function () {
				var fInfo = new Form(document.fInfo);
				fInfo.onSubmitException(
					function () {
						return Message.say(1);
					}
				);
			}
			
		}
/* ---------------------------------------------------------------- */
	},
	
	admin: {
		
		URL: "/mvtours/admin/",
/* ---------------------------------------------------------------- */
		Master: {
			
			init: function () {
				var hiColor = {hilightBgColor: "#3169B6"};
				var bar = new menubar.MenuBar();
				
				var mReserv = new menubar.Menu("Reservations");
				var mJourns = new menubar.Menu("Journeys");
				var mPlaces = new menubar.Menu("Places");
				var mClasse = new menubar.Menu("Classes");
				var mOption = new menubar.Menu("Extra Items");
				
				var miRShow = new menubar.MenuItem("Show", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "reservs/show.php");
					}
				});
				var miRDell = new menubar.MenuItem("Delete", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "reservs/delete.php");
					}
				});
				var miJShow = new menubar.MenuItem("Show", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "journeys/show.php");
					}
				});
				var miJAdd = new menubar.MenuItem("Add", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "journeys/add.php");
					}
				});
				var miJEdit = new menubar.MenuItem("Edit", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "journeys/edit.php");
					}
				});
				var miJDell = new menubar.MenuItem("Delete", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "journeys/delete.php");
					}
				});
				var miPShow = new menubar.MenuItem("Show", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "places/show.php");
					}
				});
				var miPAdd = new menubar.MenuItem("Add", {
					style: hiColor,
					onClick: mvtours.admin.Master.miPAdd_onClick
				});
				var miPEdit = new menubar.MenuItem("Edit", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "places/edit.php");
					}
				});
				var miPDell = new menubar.MenuItem("Delete", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "places/delete.php");
					}
				});
				var miCShow = new menubar.MenuItem("Show", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "classes/show.php");
					}
				});
				var miCAdd = new menubar.MenuItem("Add", {
					style: hiColor,
					onClick: mvtours.admin.Master.miCAdd_onClick
				});
				var miCEdit = new menubar.MenuItem("Edit", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "classes/edit.php");
					}
				});
				var miCDell = new menubar.MenuItem("Delete", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "classes/delete.php");
					}
				});
				var miOShow = new menubar.MenuItem("Show", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "options/show.php");
					}
				});
				var miOAdd = new menubar.MenuItem("Add", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "options/add.php");
					}
				});
				var miODell = new menubar.MenuItem("Delete", {
					style: hiColor,
					onClick: function () {
						mvtours.admin.Master.getURL(mvtours.admin.URL + "options/delete.php");
					}
				});
				
				mReserv.add(miRShow);
				mReserv.add(miRDell);
				
				mJourns.add(miJShow);
				mJourns.add(miJAdd);
				mJourns.add(miJEdit);
				mJourns.add(miJDell);
				
				mPlaces.add(miPShow);
				mPlaces.add(miPAdd);
				mPlaces.add(miPEdit);
				mPlaces.add(miPDell);
				
				mClasse.add(miCShow);
				mClasse.add(miCEdit);
				mClasse.add(miCAdd);
				mClasse.add(miCDell);
				
				mOption.add(miOShow);
				mOption.add(miOAdd);
				mOption.add(miODell);
				
				bar.add(mReserv);
				bar.add(mJourns);
				bar.add(mPlaces);
				bar.add(mClasse);
				//bar.add(mOption);
				
				bar.addInto("menubar");
			},
			
			getURL: function (url) {
				/*
				document.fAdmin.action = url;
				document.fAdmin.submit();
				*/
				window.open(url, "_self");
			},
			
			miPAdd_onClick: function () {
				var place;
				while (true) {
					place = prompt("* " + Message.description[3], "");
					if (place != null) {
						if (place != "") {
							var hPlace = document.createElement("input");
							hPlace.setAttribute("type", "hidden");
							hPlace.setAttribute("id", "hPlace");
							hPlace.setAttribute("name", "hPlace");
							hPlace.setAttribute("value", place);
							
							document.getElementById("fAdmin").appendChild(hPlace);
							
							document.fAdmin.action = mvtours.admin.URL + "places/add.php";
							document.fAdmin.submit();
							break;
						} else {
							Message.say(1);
						}
					} else {
						break;
					}
				}
			},
			
			miCAdd_onClick: function () {
				var type;
				while (true) {
					type = prompt("* " + Message.description[3], "");
					if (type != null) {
						if (type != "") {
							var hClass = document.createElement("input");
							hClass.setAttribute("type", "hidden");
							hClass.setAttribute("id", "hClass");
							hClass.setAttribute("name", "hClass");
							hClass.setAttribute("value", type);
							
							document.getElementById("fAdmin").appendChild(hClass);
							
							document.fAdmin.action = mvtours.admin.URL + "classes/add.php";
							document.fAdmin.submit();
							break;
						} else {
							Message.say(1);
						}
					} else {
						break;
					}
				}
			}
			
		},
/* ---------------------------------------------------------------- */
		Index: {
			
			init: function() {
				mvtours.admin.Master.init();
				
				document.getElementById("msg").innerHTML = Message.description[4];
			}
			
		},
/* ---------------------------------------------------------------- */
		reservation: {
/* ---------------------------------------------------------------- */
			Show: {
				
				dataGrid: null,
				
				getAssociations: function () {},
				
				init: function () {
					mvtours.admin.Master.init();
					
					mvtours.admin.reservation.Show.dataGrid = new DataGrid("datagrid", {
						colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
					});
				},
				
				bDet_onClick: function () {
					var assoc = mvtours.admin.reservation.Show.getAssociations();
					var rgShwId = new RadioGroup(document.fAdmin.rShwId);
					var id = rgShwId.getValue();
					if (id != null) {
						var frame = new Frame("../journeys/details.php?id=" + assoc[id].toString());
						frame.show();
					} else {
						Message.say(2);
					}
				},
				
				bMsg_onClick: function () {
					var rgShwId = new RadioGroup(document.fAdmin.rShwId);
					var id = rgShwId.getValue();
					if (id != null) {
						var frame = new Frame("message.php?id=" + id.toString(), {width: 400, height: 200});
						frame.show();
					} else {
						Message.say(2);
					}
				}
				
			},
/* ---------------------------------------------------------------- */
			Delete: {
				
				dataGrid: null,
				
				init: function () {
					mvtours.admin.Master.init();
					
					mvtours.admin.reservation.Delete.dataGrid = new DataGrid("datagrid", {
						colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
					});
					
					var fAdmin = new Form(document.fAdmin);
					fAdmin.onSubmitException(
						function () {
							return Message.say(2);
						}
					);
					fAdmin.onSubmitSuccess(
						function () {
							return Message.ask(7);
						}
					);
					
					var msg = null;
					var args = arguments[0];
					if (args) {
						msg = args.message ? args.message : msg;
					}
					if (msg != null) {
						Message.say(msg);
					}
				}
				
			}
/* ---------------------------------------------------------------- */
		},
		
		place: {
/* ---------------------------------------------------------------- */
			Show: {
		
				dataGrid: null,
				
				init: function () {
					mvtours.admin.Master.init();
					
					mvtours.admin.place.Show.dataGrid = new DataGrid("datagrid", {
						colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
					});
					
					var msg = null;
					var args = arguments[0];
					if (args) {
						msg = args.message ? args.message : msg;
					}
					if (msg != null) {
						Message.say(msg);
					}
				}
				
			},
/* ---------------------------------------------------------------- */
			Edit: {
				
				dataGrid: null,
				
				getPlaces: function () {},
				
				getPlaceById: function (id) {
					var places = mvtours.admin.place.Edit.getPlaces();
					var i;
					for (i in places) {
						if (places[i].id == id) {
							return places[i];
						}
					}
					return null;
				},
				
				init: function () {
					mvtours.admin.Master.init();
					
					mvtours.admin.place.Edit.dataGrid = new DataGrid("datagrid", {
						colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
					});
					
					var fAdmin = new Form(document.fAdmin);
					fAdmin.onSubmitException(
						function () {
							return Message.say(2);
						}
					);
					fAdmin.onSubmitSuccess(
						mvtours.admin.place.Edit.fAdmin_onSubmitSuccess
					);
					
					var msg = null;
					var args = arguments[0];
					if (args) {
						msg = args.message ? args.message : msg;
					}
					if (msg != null) {
						Message.say(msg);
					}
				},
				
				fAdmin_onSubmitSuccess: function () {
					var rgPlace = new RadioGroup(document.fAdmin.rPlace);
					var place = mvtours.admin.place.Edit.getPlaceById(rgPlace.getValue())._name;
					while (true) {
						place = prompt("* " + Message.description[3], place);
						if (place != null) {
							if (place != "") {
								var hPlace = document.createElement("input");
								hPlace.setAttribute("type", "hidden");
								hPlace.setAttribute("id", "hPlace");
								hPlace.setAttribute("name", "hPlace");
								hPlace.setAttribute("value", place);
								
								document.getElementById("fAdmin").appendChild(hPlace);
								
								return true;
							} else {
								Message.say(1);
							}
						} else {
							break;
						}
					}
					return false;
				}
				
			},
/* ---------------------------------------------------------------- */
			Delete: {
				
				dataGrid: null,
				
				init: function () {
					mvtours.admin.Master.init();
					
					mvtours.admin.place.Delete.dataGrid = new DataGrid("datagrid", {
						colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
					});
					
					var fAdmin = new Form(document.fAdmin);
					fAdmin.onSubmitException(
						function () {
							return Message.say(2);
						}
					);
					fAdmin.onSubmitSuccess(
						function () {
							return Message.ask(7);
						}
					);
					
					var msg = null;
					var args = arguments[0];
					if (args) {
						msg = args.message ? args.message : msg;
					}
					if (msg != null) {
						Message.say(msg);
					}
				}
				
			}
/* ---------------------------------------------------------------- */
		},
		
		type: {
/* ---------------------------------------------------------------- */
			Show: {
		
				dataGrid: null,
				
				init: function () {
					mvtours.admin.Master.init();
					
					mvtours.admin.type.Show.dataGrid = new DataGrid("datagrid", {
						colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
					});
					
					var msg = null;
					var args = arguments[0];
					if (args) {
						msg = args.message ? args.message : msg;
					}
					if (msg != null) {
						Message.say(msg);
					}
				}
				
			},
/* ---------------------------------------------------------------- */
			Edit: {
				
				dataGrid: null,
				
				getClasses: function () {},
				
				getClasseById: function (id) {
					var classes = mvtours.admin.type.Edit.getClasses();
					var i;
					for (i in classes) {
						if (classes[i].id == id) {
							return classes[i];
						}
					}
					return null;
				},
				
				init: function () {
					mvtours.admin.Master.init();
					
					mvtours.admin.type.Edit.dataGrid = new DataGrid("datagrid", {
						colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
					});
					
					var fAdmin = new Form(document.fAdmin);
					fAdmin.onSubmitException(
						function () {
							return Message.say(2);
						}
					);
					fAdmin.onSubmitSuccess(
						mvtours.admin.type.Edit.fAdmin_onSubmitSuccess
					);
					
					var msg = null;
					var args = arguments[0];
					if (args) {
						msg = args.message ? args.message : msg;
					}
					if (msg != null) {
						Message.say(msg);
					}
				},
				
				fAdmin_onSubmitSuccess: function () {
					var rgClasse = new RadioGroup(document.fAdmin.rClasse);
					var classe = mvtours.admin.type.Edit.getClasseById(rgClasse.getValue())._name;
					while (true) {
						classe = prompt("* " + Message.description[3], classe);
						if (classe != null) {
							if (classe != "") {
								var hClasse = document.createElement("input");
								hClasse.setAttribute("type", "hidden");
								hClasse.setAttribute("id", "hClasse");
								hClasse.setAttribute("name", "hClasse");
								hClasse.setAttribute("value", classe);
								
								document.getElementById("fAdmin").appendChild(hClasse);
								
								return true;
							} else {
								Message.say(1);
							}
						} else {
							break;
						}
					}
					return false;
				}
				
			},
/* ---------------------------------------------------------------- */
			Delete: {
				
				dataGrid: null,
				
				init: function () {
					mvtours.admin.Master.init();
					
					mvtours.admin.type.Delete.dataGrid = new DataGrid("datagrid", {
						colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
					});
					
					var fAdmin = new Form(document.fAdmin);
					fAdmin.onSubmitException(
						function () {
							return Message.say(2);
						}
					);
					fAdmin.onSubmitSuccess(
						function () {
							return Message.ask(7);
						}
					);
					
					var msg = null;
					var args = arguments[0];
					if (args) {
						msg = args.message ? args.message : msg;
					}
					if (msg != null) {
						Message.say(msg);
					}
				}
				
			}
/* ---------------------------------------------------------------- */
		},
		
		journey: {
/* ---------------------------------------------------------------- */
			Show: {
				
				dataGrid: null,
				
				init: function () {
					mvtours.admin.Master.init();
					
					mvtours.admin.journey.Show.dataGrid = new DataGrid("datagrid", {
						colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
					});
				},
				
				bShow_onClick: function () {
					var rgJourney = new RadioGroup(document.fAdmin.rJourney);
					var id = rgJourney.getValue();
					if (id != null) {
						var frame = new Frame("details.php?id=" + id.toString(), {width: 550, height: 400});
						frame.show();
					} else {
						Message.say(2);
					}
				}
				
			},
/* ---------------------------------------------------------------- */
			Add: {
				
				getPlaces: function () {},
				
				init: function () {
					mvtours.admin.Master.init();
					
					var fAdmin = new Form(document.fAdmin);
					fAdmin.onSubmitException(
						function () {
							return Message.say(1);
						}
					);
					fAdmin.onSubmitSuccess(
						function () {
							if (isNaN(document.fAdmin.tRate.value)) {
								document.fAdmin.tRate.focus();
								return Message.say(9);
							}
							return true;
						}
					);
					
					var places = mvtours.admin.journey.Add.getPlaces();
					var cbFrom = new ComboBox(document.fAdmin.sFrom);
					var opt;
					var i;
					var j = places.length;
					for (i=0; i<j; i++) {
						opt = new Option(places[i]._name);
						opt.value = places[i].id;
						cbFrom.addItem(opt);
					}
					mvtours.admin.journey.Add.sFrom_onChange();
					
					var now = new Date();
					var dcDate = new DateChooser("dcDate", {lastYear:now.getFullYear()+4});
					dcDate.show();
					
					var tcDeparture = new TimeChooser("tcDeparture");
					tcDeparture.addInto("departure");
					
					var date = new Date();
					date.setHours(0);
					date.setMinutes(0);
					date.setSeconds(0);
					var tcDuration = new TimeChooser("tcDuration", {time:date});
					tcDuration.addInto("duration");
				},
				
				sFrom_onChange: function () {
					var places = mvtours.admin.journey.Add.getPlaces();
					var cbFrom = new ComboBox(document.fAdmin.sFrom);
					var cbTo = new ComboBox(document.fAdmin.sTo);
					var opt;
					var i;
					var j = places.length;
					cbTo.removeAllItems();
					for (i=0; i<j; i++) {
						if (places[i].id != cbFrom.getValue()) {
							opt = new Option(places[i]._name);
							opt.value = places[i].id;
							cbTo.addItem(opt);
						}
					}
				}
				
			},
/* ---------------------------------------------------------------- */
			Edit: {
				
				dataGrid: null,
				
				init: function () {
					mvtours.admin.Master.init();
					
					mvtours.admin.journey.Edit.dataGrid = new DataGrid("datagrid", {
						colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
					});
										
					var fAdmin = new Form(document.fAdmin);
					fAdmin.onSubmitException(
						function () {
							return Message.say(2);
						}
					);
				}
				
			},
/* ---------------------------------------------------------------- */
			Save: {
				
				getPlaces: function () {},
				
				getJourney: function () {},
				
				init: function () {
					mvtours.admin.Master.init();
					
					var fAdmin = new Form(document.fAdmin);
					fAdmin.onSubmitException(
						function () {
							return Message.say(1);
						}
					);
					fAdmin.onSubmitSuccess(
						function () {
							if (isNaN(document.fAdmin.tRate.value)) {
								document.fAdmin.tRate.focus();
								return Message.say(9);
							}
							return true;
						}
					);
					
					var journey = mvtours.admin.journey.Save.getJourney();
					
					var places = mvtours.admin.journey.Save.getPlaces();
					var cbFrom = new ComboBox(document.fAdmin.sFrom);
					var cbTo = new ComboBox(document.fAdmin.sTo);
					var opt;
					var i;
					var j = places.length;
					for (i=0; i<j; i++) {
						opt = new Option(places[i]._name);
						opt.value = places[i].id;
						cbFrom.addItem(opt);
						if (places[i].id == journey._from.id) {
							cbFrom.setSelectedIndex(i);
						}
					}
					mvtours.admin.journey.Save.sFrom_onChange();
					
					var nowDate = new Date();
					var oldDate = journey._date;
					var fyear = Math.min(nowDate.getFullYear(), oldDate.getFullYear()-4);
					var dcDate = new DateChooser("dcDate", {date:oldDate, firstYear:fyear, lastYear:oldDate.getFullYear()+4});
					dcDate.show();
					
					var tcDeparture = new TimeChooser("tcDeparture", {time: journey._date});
					tcDeparture.addInto("departure");
					
					var tcDuration = new TimeChooser("tcDuration", {time: journey._duration});
					tcDuration.addInto("duration");
				},
				
				sFrom_onChange: function () {
					var journey = mvtours.admin.journey.Save.getJourney();
					var places = mvtours.admin.journey.Save.getPlaces();
					var cbFrom = new ComboBox(document.fAdmin.sFrom);
					var cbTo = new ComboBox(document.fAdmin.sTo);
					var opt;
					var i;
					var j = places.length;
					var k = 0;
					cbTo.removeAllItems();
					for (i=0; i<j; i++) {
						if (places[i].id != cbFrom.getValue()) {
							opt = new Option(places[i]._name);
							opt.value = places[i].id;
							cbTo.addItem(opt);
							if (places[i].id == journey._to.id) {
								cbTo.setSelectedIndex(k);
							}
							k++;
						}
					}
				}
				
			},
/* ---------------------------------------------------------------- */
			Delete: {
				
				dataGrid: null,
				
				init: function () {
					mvtours.admin.Master.init();
					
					mvtours.admin.journey.Show.dataGrid = new DataGrid("datagrid", {
						colors: {hilight: new Hex(0x31, 0x69, 0xB6)}
					});
					
					var fAdmin = new Form(document.fAdmin);
					fAdmin.onSubmitException(
						function () {
							return Message.say(2);
						}
					);
					fAdmin.onSubmitSuccess(
						function () {
							return Message.ask(7);
						}
					);
					
					var msg = null;
					var args = arguments[0];
					if (args) {
						msg = args.message ? args.message : msg;
					}
					if (msg != null) {
						Message.say(msg);
					}
				}
				
			}
/* ---------------------------------------------------------------- */
		}
		
	}
	
};
