/* Copyright 2009 Palm, Inc.  All rights reserved. */

var AirplaneArrivalAssistant = Class.create({
	initialize: function(params){
		Object.extend(this, params);
	},
	
	setup: function(){
		// var titles = this.interests.collect(function(interest){
		// 	return interest.title;
		// });
		// titles = titles.join(", ");
		// var titles = "Sunnyvale - Simla Junction - AMD Micro Processors - Moffett Airspace";
		//this.titles = titles;
		var renderedInfo = Mojo.View.render({object: this, template: 'airplaneArrival/arrivalInfo'});

	  // Insert the HTML into the DOM, replacing the existing content.
	  Element.update(this.controller.get('message_info'),renderedInfo);
	  this.controller.listen("message_info", Mojo.Event.tap, this.launchLocation.bind(this));
	},
	
	launchLocation: function(){
		var openParams = {
		  scene: 'page',
		  url: this.url
		};
		new Mojo.Service.Request('palm://com.palm.applicationManager', {
		  method: 'open',
		  parameters: {
		      id: 'com.palm.app.browser',
		      params: openParams
		  }
		});
		this.controller.window.close();
	}
});