UI.moduleBuilder['Alexa']['bodyTemplate2'] = function(){
    var bodyTemplate2Data = {
        bodyTemplate2Bg:"Alexa/card_bg.png",
        skillIcon:"",
        logoIcon:"Alexa/avs_logo_template.png"
    };
    var template = Util.readJson("module/Alexa/bodyTemplate2.json");
    var bodyTemplate2 =  SubModule.create(bodyTemplate2Data, template);


    var mainTitle = UI.getItem(bodyTemplate2, "mainTitle");
    var subTitle = UI.getItem(bodyTemplate2, "subTitle");
    var skillIcon = UI.getItem(bodyTemplate2, "skillIcon");
    var textField = UI.getItem(bodyTemplate2, "textField");
    var image = UI.getItem(bodyTemplate2, "image");
    var backgroundImg = UI.getItem(bodyTemplate2, "backgroundImg");
//    var aa = "11";
    var aa  = "BThe The iThe image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.The image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.The image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.mage max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.odyTemplate2, like bodyTemplate2, is used for Q&A, Wikipedia queries, and third-party Skill requests, but unlike bodyTemplate2, it also returns a photo. Sample utterances that would invoke BodyTemplate2 include:BodyTemplate2, like bodyTemplate2, is used for Q&A, Wikipedia queries, and third-party Skill requests, but unlike bodyTemplate2, it also returns a photo. Sample utterances that would invoke BodyTemplate2 include:BodyTemplate2, like bodyTemplate2, is used for Q&A, Wikipedia queries, and third-party Skill requests, but unlike bodyTemplate2, it also returns a photo. Sample utterances that would invoke BodyTemplate2 include:BodyTemplate2, like bodyTemplate2, is used for Q&A, Wikipedia queries, and third-party Skill requests, but unlike bodyTemplate2, it also returns a photo. Sample utterances that would invoke BodyTemplate2 include:BodyTemplate2, like bodyTemplate2, is used for Q&A, Wikipedia queries, and third-party Skill requests, but unlike bodyTemplate2, it also returns a photo. Sample utterances that would invoke BodyTemplate2 include:bodyTemplate2, along with BodyTemplate2, is used for Q&A, Wikipedia queries, and third-party Skill requests. Sample utteranNote: Text can extend to 60px above the logo. Any text past that point should be hidden but accessible by scrolling on a 5-way remoteces that would invoke bodyTemplate2 include:";
//    var aa = "The image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.The image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.The image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.The image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.The image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.The image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.The image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.";
//    var aa = "The image max height and width are 317x477. Images of different aspect ratios should resize to stay within these dimensions.";
//    var mainTitle1 = "BodyTemplate2 BodyTemplate2";
//    var subTitle1 = "BodyTemplate2 BodyTemplate2";
//    var skillIcon1 = "Alexa/avs_logo.png";


    bodyTemplate2.currFocus = textField;
    bodyTemplate2.currHeight = 0;
    bodyTemplate2.step = 100;
    bodyTemplate2.maskHeight = 317;
    bodyTemplate2.scrollStep = 0;
    bodyTemplate2.enableKey = [CONST.KEY.VK_UP,CONST.KEY.VK_DOWN];

    bodyTemplate2.onPush = function(){
        var graphics = new PIXI.Graphics()
            .beginFill(0x000000, 0.85)
            .drawRect(0, 0, 1920, 1080)
            .endFill();
        UI.setImage(backgroundImg,graphics);
    }
    bodyTemplate2.onShow = function(){
        if(!tv){
            UI.setText(textField,aa);
            UI.setImageforMedia(image,"Alexa/musicTest.png", false, true, true);
            UI.addMask(textField, 544, 317, 50, 3);
            UI.setView(textField, 544, 317);
            UI.addScrollbar(textField,-16);
            return;
        }

        if(bodyTemplate2.param.skillIcon != null && bodyTemplate2.param.skillIcon.length != 0){
            mainTitle.originWidth = 380;
            subTitle.originWidth = 380

        }else{
            mainTitle.originWidth = 480;
            subTitle.originWidth = 480
        }

        UI.setImageforMedia(image,bodyTemplate2.param.image + "?" + +new Date().getTime(), false, true, true);
        DBG_ERROR(bodyTemplate2.param.image + "?" + +new Date().getTime());
        UI.setText(mainTitle,bodyTemplate2.param.mainTitle);
        UI.setText(subTitle,bodyTemplate2.param.subTitle);
        UI.setText(textField,bodyTemplate2.param.textField);
        UI.setImageforMedia(skillIcon,bodyTemplate2.param.skillIcon, null, true, null);
        // UI.setText(textField,aa);
        UI.addMask(textField, 544, 317, 50, 3);
        UI.setView(textField, 544, 317);
        UI.addScrollbar(textField,-16);
    }

    bodyTemplate2.afterPush = function(){
        bodyTemplate2.currFocus = textField;
    }

    bodyTemplate2.onPop = function(){

    }
    textField.onFocus = function(focus){

    }

    bodyTemplate2.onkey = function(focus,evt){
        DBG_INFO("bodyTemplate2 evt.keyCode=" + evt.keyCode);
//        if (evt.keyFrom == "Keyboard") {
        if (evt.value == "DOWN") {
            if(textField.height - bodyTemplate2.currHeight > bodyTemplate2.maskHeight){
                bodyTemplate2.currHeight += bodyTemplate2.step;
                textField.y -=  bodyTemplate2.step;
                bodyTemplate2.scrollStep = parseInt(400/textField.height *bodyTemplate2.step);//bounds 800
                textField.scroll.y += bodyTemplate2.scrollStep;
                UI.updateStage();
            }
            return true;

            //TODO:do sth.
        } else if (evt.value == "UP") {
            //TODO:do sth.
            if(bodyTemplate2.currHeight > 0){
                if(bodyTemplate2.currHeight > bodyTemplate2.step){
                    bodyTemplate2.currHeight -= bodyTemplate2.step;
                }else{
                    bodyTemplate2.currHeight = 0;
                }
                textField.y += bodyTemplate2.step;
                bodyTemplate2.scrollStep = parseInt(400/textField.height *bodyTemplate2.step);
                textField.scroll.y -= bodyTemplate2.scrollStep;
                UI.updateStage();
            }
            return true;
        } else if (evt.value == "VOICE" || evt.value == "VOICE_DOWN" || evt.value == "VOICE_UP") {
            return true;
        } else {
            UI.popSubModule();
            return (Alexa_globalKeys.indexOf(evt.keyCode) >= 0);
        }
//        }

    }
}
