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

var OtaspIntroAssistant = Class.create({
	
	initialize: function() {
		FirstUseUtil.addDashboardBig($('target'));
	},
	
	handleCommand: function(event) {
		if (event.type == Mojo.Event.back) {
			event.preventDefault();
			event.stopPropagation();
			Mojo.Controller.stageController.swapScene("language");
		}	
	},	
	
	setup: function(){
		
		$('target').addEventListener(Mojo.Event.tap, FirstUseUtil.tapHandler.bindAsEventListener(this));
				
		// Listen to ## key presses
		this.controller.listen(this.controller.sceneElement, Mojo.Event.keydown, FirstUseUtil.handleKeyPressEvent.bind(this));
		
		this.message = $L("Your phone will now call #{carrier} and automatically activate your phone.").interpolate({
					carrier: Mojo.Environment.DeviceInfo.carrierName
		});
		
		this.controller.get('otaspMessage').update(this.message);
				
		this.nextModel = {
			buttonLabel : $L('Next'),
			buttonClass: 'palm-button'
		};
		this.controller.setupWidget('startActivation', undefined, this.nextModel);
		Mojo.listen(this.controller.get('startActivation'), Mojo.Event.tap, this.startActivation.bindAsEventListener(this));
			
	},
	
	startActivation: function (event) {
		Mojo.Controller.stageController.pushScene('otasp-provision');
	}
	
});	