
function hideImages(pList, pResult) {
  if(pList) {
    for (var i=0; i < pList.length; i++) {
        pList[i].visible = pResult;
    }
  }
}



function createHelpScreen(list) {
    setScreenScale();

    if(list != undefined) {
        hideImages(list, false);    
    }
     // Crafty.load([ "images/bg.png", "images/help_Tag.png", "images/help_text.png", "images/back_btn.png"],
        // function() {
             //when loaded
            var bg = Crafty.e("2D, Canvas, Image, Mouse").image("images/bg.png");
            bg.x = Crafty.viewport.width/2-320/2; bg.y = Crafty.viewport.height/2-480/2;

            var hoverEffect = Crafty.e("2D, Canvas, Image").image("images/onclick_next.png");
            hoverEffect.x = bg._x+20; hoverEffect.y = bg._y+200;  hoverEffect.alpha=0.01

            var helpTag = Crafty.e("2D, Canvas, Image").image("images/help_Tag.png");
            helpTag.x = bg._x; helpTag.y = bg._y+2;

            var helpText = Crafty.e("2D, Canvas, Image").image("images/helpText.png");
            helpText.x = bg._x+2.5; helpText.y = bg._y+72;

            var backBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/back_btn.png");
            backBtn.x = bg._x+221; backBtn.y = bg._y+418;

            bg.bind("MouseDown", function(e) {
                console.log("help bg mouse down ")
                return true;
            })

            bg.bind("MouseMove", function(e) {
                hoverEffect.alpha=0.01;
            })


            backBtn.bind("MouseDown", function(e) { 
                console.log("back button button clicked");
               this.unbind('Click', this.backBtn);
               hoverEffect.alpha=0.01;
               if(list != undefined) {
                    hideImages(list, true);
               }
               
               deleteImages([bg,helpTag, hoverEffect, helpText, backBtn]);
            });

            // backBtn.bind("MouseDown", function(e) {
            //     hoverEffect.alpha=1.0; hoverEffect.x=this._x; hoverEffect.y= this._y;
            // })
            
         // }
     // );
    
    

}





