window.onload = function(){
	new Ajax.Updater(
		'toAreaField',
		'/en/tops/getareaBack/to',
		{ 
			method: 'post',
			onSuccess:function(){
				new Ajax.Updater(
						'toBusStopField',
						'/en/tops/getBusStopListBack/to',
						{ method: 'post',
							onSuccess:function(){
							new Ajax.Request(
									'/en/tops/getAirportID/to', 
									{
										method: 'post',
										onComplete: function(req){
										var torRadio = $$('input[name="data[BusStopTo][lineId]"]');
											if(req.responseText == 2){
												if(torRadio[0] != undefined)torRadio[0].checked = true;
											}else if(req.responseText == 4){
												if(torRadio[1] != undefined)torRadio[1].checked = true;
											}else{
												if(torRadio[0] != undefined)torRadio[0].checked = true;
											}
											
											new Ajax.Updater(
													'fromAreaField',
													'/en/tops/getareaBack/from',
													{ 
														method: 'post',
														onSuccess:function(){
															new Ajax.Updater(
																	'fromBusStopField',
																	'/en/tops/getBusStopListBack/from',
																	{ method: 'post',
																		onSuccess:function(){
																		new Ajax.Request(
																				'/en/tops/getAirportID/from', 
																				{
																					method: 'post',
																					onComplete: function(req){
																					var torRadio = $$('input[name="data[BusStopFrom][lineId]"]');
																						if(req.responseText == 1){
																							torRadio[0].checked = true;
																						}else if(req.responseText == 3){
																							torRadio[1].checked = true;
																						}else{
																							torRadio[0].checked = true;
																						}
																					}
																				});
																	}
																	}
																);				
														}		
													}
												);
										}
									});
						}
						}
					);				
			}		
		}
	);
	
	
	
	
	 
	
}

