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

var WelcomeAssistant = Class.create({
  initialize : function() {
  	
  },
  
  setup: function() {
    // Set up the attributes & model for this widget:
    this.welcomeModel = {listTemplateAttr: {listTitle:''}, items:welcomeMessages};    
    this.controller.setupWidget('welcomeList', 
                  {itemTemplate:'welcome/welcome-message', listTemplate:'welcome/welcome-container'},
                  this.welcomeModel);
    
	$('welcomeList').observe(Mojo.Event.listTap, this.showLanguagePicker.bindAsEventListener(this));
	
	saveCurrentState("welcome");

	new PeriodicalExecuter(function(pe) {
		if (Account.platformType != "") {
			Mojo.Log.info("----------- Account.platformType has value, stopping pe --------------");
			pe.stop();
			Mojo.Controller.stageController.pushScene("language");
		}	
	}, 2);
    // Listen to ## key presses
	this.controller.listen(this.controller.sceneElement, Mojo.Event.keydown, FirstUseUtil.handleKeyPressEvent.bind(this));
  },
  
  cleanup: function() {
  	
  },

  activate: function() {
    
  },
  
  deactivate: function() {
   	
  },
  
  showLanguagePicker: function(event) {
  	// NOV-42880 - disabled tapping on list to get to language screen
	// Not sure if this causes the blank screen in languages, testing it now
	//Mojo.Controller.stageController.pushScene("language");
  }
  
})

