<?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]" xmlns:net="flash.net.*" creationComplete="GetPhoto()">
	<mx:Script>
		<![CDATA[
			import mx.utils.URLUtil;
			import mx.managers.BrowserManager;
			import mx.managers.IBrowserManager;
			import mx.rpc.events.ResultEvent;
				[Bindable]
		private var po:int=0;
		private var bm:IBrowserManager;
		private var UName:String;
		private var CityId:String;
		
		
		public function show(e:Event):void
		{
			bm:BrowserManager.getInstance();
			bm.init("","Welcome");
			var	o:Object=URLUtil.stringToObject(bm.fragment,"&");
			
			UName=o.UserName;
			CityId=o.CityId;
			init();
		}
		
		
		public function init():void
		{
			GetPhoto();
		}
			public function GetPhoto():void
			{
				myWebService.GetPhotoName(CityId,po);
				po=po+1;
			
			}
			
			public function GetPhoto1():void
			{
				myWebService.GetPhotoName(CityId,po);
				po=po+1;
			}
			
			public function GetPhoto2():void
			{
				po=po-1;
				myWebService.GetPhotoName(CityId,po);
				
			}
			public function handleresult(event:ResultEvent):void
			{
			Photo.source=event.result.toString();	
			}
			
			public function Booking():void
		{
			var url:URLRequest=new URLRequest("Booking.html#UserName="+UName+"&CityId="+CityId);
			navigateToURL(url,"_self");
		}
		
		public function Logout():void
		{
			var url:URLRequest=new URLRequest("Login.html");
			navigateToURL(url,"_self");
		}
		]]>
	</mx:Script>
	 <mx:WebService 
		id="myWebService" 
		wsdl="http://localhost:50854/HTWS/Service.asmx?WSDL"
		showBusyCursor="true"
		fault="mx.controls.Alert.show('Error loading WSDL', 'Webservice Error');" >
        <mx:operation name="GetPhotoName" resultFormat="object" result="handleresult(event)">
        </mx:operation>
    </mx:WebService>
	
	<mx:Image x="82" y="108" width="253" height="284" id="Photo"/>
	<mx:Button x="21" y="238" label="Next" click="GetPhoto1()"/>
	<mx:Button x="343" y="238" label="Previous" click="GetPhoto2()"/>
	<mx:Button x="264" y="36" label="Home" click="Booking()"/>
	<mx:Button x="354" y="36" label="Logout" click="Logout()"/>
	
	
	
</mx:Application>
