<?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]" verticalAlign="middle" color="#11E73E">
	<mx:states>
		<mx:State name="Home">
			<mx:RemoveChild target="{formitem1}"/>
			<mx:RemoveChild target="{formitem2}"/>
			<mx:RemoveChild target="{form1}"/>
			<mx:RemoveChild target="{linkbutton1}"/>
			<mx:RemoveChild target="{button1}"/>
			<mx:AddChild position="lastChild">
				<mx:Label x="581" y="55" text="Select Place:" fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" textAlign="center" color="#020802"/>
			</mx:AddChild>
			<mx:AddChild position="lastChild">
				<mx:ComboBox x="698" y="55"></mx:ComboBox>
			</mx:AddChild>
			<mx:AddChild position="lastChild">
				<mx:Text x="35" y="96" 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:AddChild>
			<mx:AddChild position="lastChild">
				<mx:Text x="35" y="127" text="holiday in a matter of minutes." fontFamily="Courier New" fontSize="14" fontWeight="bold" fontStyle="italic" color="#D0EB1D"/>
			</mx:AddChild>
			<mx:AddChild position="lastChild">
				<mx:Text x="35" y="164" 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:AddChild>
			<mx:AddChild position="lastChild">
				<mx:Text x="35" y="206" text="Holiday Trip Planner is an online travel management system." fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" color="#D0EB1D"/>
			</mx:AddChild>
			<mx:AddChild position="lastChild">
				<mx:Text x="35" y="248" text="It aimed to offer a range of best-value services to" fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" color="#D0EB1D"/>
			</mx:AddChild>
			<mx:AddChild position="lastChild">
				<mx:Text x="35" y="278" text="ensure that tour runs smoothly and efficiently." fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" color="#D0EB1D"/>
			</mx:AddChild>
			<mx:AddChild position="lastChild">
				<mx:Text x="35" y="316" 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:AddChild>
			<mx:RemoveChild target="{label1}"/>
		</mx:State>
	</mx:states>
<mx:Script>
	<![CDATA[
		//import Classes.Global;
		import mx.controls.Alert;
		import flash.net.navigateToURL;
		import mx.binding.utils.BindingUtils;
		import mx.rpc.events.FaultEvent;
		import mx.rpc.events.ResultEvent;
		[Bindable]
		
		
		private var result:String=new String;
		public function Insert():void
		{        
			 HolidayTripWebService.LoginUser(UName.text,Pwd.text);
		}
		public function getdata(event:ResultEvent):void
		{
			//Alert.show("Login Sucessful");
			//this.currentState="Home";
			result=event.result.toString();
			
			if(result.length==4)
			{
				var url:URLRequest = new URLRequest("Home.html#UserName="+UName.text);
				navigateToURL(url,"_self");
			}
			else
			if(result.length==5)
			{
				
			}
			
		}
		public function Error(event:FaultEvent):void
		{
			Alert.show("Error in Login");
		}
		public function navigate():void
		{
			var url:URLRequest = new URLRequest("Registration.html");
			//url="www.google.com";
				navigateToURL(url,"_self");
		
		}
		
		
	]]>
</mx:Script>
<mx:WebService 
		id="HolidayTripWebService" 
		wsdl="http://localhost:50854/HTWS/Service.asmx?WSDL"
		showBusyCursor="true">
		<mx:operation name="LoginUser" resultFormat="object" result="getdata(event)">
        </mx:operation>
</mx:WebService>


<mx:Label x="291" y="52" text="Login" fontFamily="Courier New" fontSize="20" fontWeight="bold" fontStyle="italic" color="#2AC85B" height="31" id="label1"/>
	<mx:Form x="146" y="114" width="422" height="100" id="form1">
	<mx:FormItem label="User Name:" width="383" height="27" horizontalAlign="center" fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" color="#DEE60E" id="formitem1">
		<mx:TextInput id="UName" color="#22230F"/>		
	</mx:FormItem>
	<mx:FormItem label="Password:" width="383" height="27" horizontalAlign="center" fontFamily="Courier New" fontSize="13" fontWeight="bold" fontStyle="italic" color="#DEE60E" id="formitem2">
		<mx:TextInput id="Pwd" displayAsPassword="true" color="#22230F"/>		
	</mx:FormItem>
	</mx:Form>
	<mx:Button x="300" y="303" label="Login" width="80" height="27" borderColor="#259DF1" fillAlphas="[1.0, 1.0]" fillColors="[#D62F2F, #190606]" color="#B6D2D8" cornerRadius="20" click="Insert()" id="button1"/>
	<mx:LinkButton x="407" y="236" label="New User" fontFamily="Courier New" fontSize="15" fontStyle="italic" cornerRadius="20" id="linkbutton1" click="Insert()"/>
</mx:Application>
