<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#BF5DC5, #010708]" creationComplete="show(event)">
	<mx:Script>
		<![CDATA[
			import mx.managers.IBrowserManager;
			import mx.utils.URLUtil;
			import mx.managers.BrowserManager;
			import mx.collections.ArrayCollection;
			import mx.controls.Alert;
			import mx.rpc.events.ResultEvent;
			import mx.rpc.events.FaultEvent;
			import mx.collections.XMLListCollection;
			import mx.collections.CursorBookmark;
			import mx.managers.DragManager;
			import mx.managers.SystemManager;
				[Bindable]
		private var result:String=new String;
		private static var cid:int=new int;
		 private var bm:IBrowserManager;
       private var userid:String;
		
		
		public function init():void
		{
			getcountry();
		}
	public function show(e:Event):void
       {
       
        bm=BrowserManager.getInstance();
       	bm.init("?","Hello");
       	var o:Object=URLUtil.stringToObject(bm.fragment);
       	userid=o.UserName;
       	//Alert.show(userid);
        init();
       }
       
       
		public function fault(event:FaultEvent):void
		{
			Alert.show("Error in Insertion..");
		}
		public function GetCityNames():void
		{
			cid=parseInt(CmbCountry.selectedItem.CountryID);
			HolidayTripWebService.GetCityNames(parseInt(CmbCountry.selectedItem.CountryID));
		}
		public function city(event:ResultEvent):void
		{
			var query:XML=new XML(event.result);
			var queryresult:XMLListCollection=new XMLListCollection(query.CityNames);
			
			CmbCity.dataProvider = queryresult;
			CmbCity.labelField="CityName";
			CmbCity.data="CityId";
		}
		public function getcountry():void
		{
			//show(e);
			HolidayTripWebService.getcountry();
		}
		public function country(event:ResultEvent):void
		{
			var query:XML=new XML(event.result);
			var queryresult:XMLListCollection=new XMLListCollection(query.Country);
			
			CmbCountry.dataProvider = queryresult;
			CmbCountry.labelField="CountryName";
			CmbCountry.data="CountryID";

		}
		
		public function next():void
		{
			var url:URLRequest=new URLRequest("Tour.html#UserName="+userid+"&CityId="+CmbCity.selectedItem.CityId);
			navigateToURL(url,"_self");
		}
		]]>
	</mx:Script>
	
	
	<mx:WebService
		id="HolidayTripWebService" 
		wsdl="http://localhost:50854/HTWS/Service.asmx?wsdl"
		showBusyCursor="true" fault="mx.controls.Alert.show('Error loading WSDL', 'Webservice Error');" >
		
        <mx:operation name="getcountry" resultFormat="object" result="country(event)">
        </mx:operation>
        <mx:operation name="GetCityNames" resultFormat="object" result="city(event)">
        </mx:operation>
	</mx:WebService>
	
	<mx:Label x="63" y="24" text="Select Place:" fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" textAlign="center" color="#020802"/>
	<mx:Text x="35" y="190" text="Holiday Trip Planner travel planning functionality makes it easy for users to plan" fontFamily="Courier New" fontSize="14" fontWeight="bold" fontStyle="italic" color="#D0EB1D"/>
	<mx:Text x="35" y="231" text="holiday in a matter of minutes." fontFamily="Courier New" fontSize="14" fontWeight="bold" fontStyle="italic" color="#D0EB1D"/>
	<mx:Text x="35" y="262" text="By pre-planning your dream holiday, you can then proceed to book with ease." fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" color="#D0EB1D"/>
	<mx:Text x="35" y="292" text="Holiday Trip Planner is an online travel management system." fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" color="#D0EB1D"/>
	<mx:Text x="35" y="322" text="It aimed to offer a range of best-value services to" fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" color="#D0EB1D"/>
	<mx:Text x="35" y="366" text="ensure that tour runs smoothly and efficiently." fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" color="#D0EB1D"/>
	<mx:Text x="35" y="406" text="It offers a complete range of services for the business and individual traveller." fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" color="#D0EB1D"/>
	<mx:FormItem label="Country:" width="383" height="27" horizontalAlign="center" fontFamily="Courier New" fontSize="15" fontWeight="bold" fontStyle="italic" color="#6E2B6D" x="29" y="54">
		<mx:ComboBox height="22" id="CmbCountry" change="GetCityNames()"></mx:ComboBox>
	</mx:FormItem>
	<mx:FormItem label="City:" width="383" height="37" horizontalAlign="center" fontFamily="Courier New" fontSize="15" fontWeight="bold" fontStyle="italic" color="#6E2B6D" x="29" y="99">
		<mx:ComboBox height="22" id="CmbCity"></mx:ComboBox>
	</mx:FormItem>
	<mx:Button x="223" y="160" label="submit" click="next()" width="76"/>
	
	
	
	
</mx:Application>
