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

function deleteImages(pList) {
    if(pList) {
        for (var i=0; i< pList.length; i++) {
            if(pList[i]) {
                pList[i].destroy();
                // console.log("Destroyed ", i);
            }
        }
    }
}


function createHelpScreen(list) {

    if(list != undefined) {
        hideImages(list, false);    
    }

    var bg = Crafty.e("2D, Canvas,Image, Mouse").attr({x:0, y:0, w: 320, h:440}).image("images/helpBg.png");

    
    var backBtnHover = Crafty.e("2D, Canvas, Image, Mouse").image("images/back_image.png");
    backBtnHover.x = bg._x+240; backBtnHover.y = bg._y+370;
    backBtnHover.alpha = 0.01;
    
    var backBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/back_image1.png");
    backBtn.x = bg._x+240; backBtn.y = bg._y+370;
   
    
     backBtn.bind("MouseDown", function(e) {
         backBtnHover.alpha = 1;
         backBtn.alpha = 0.01;
    });

    
    backBtn.bind("MouseUp", function(e) {
         backBtnHover.alpha = 0.01;
         backBtn.alpha = 1;
        deleteImages([bg, backBtn, backBtnHover]);
    });
    
     bg.bind("MouseUp", function(e) {
         backBtnHover.alpha = 0.01;
         backBtn.alpha = 1;
    });
    
    
    
}

