
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();
            }
        }
    }
}



function createHelpScreen(list) {
    if(list != undefined) {
        hideImages(list, false);    
    }
    
    var bg = Crafty.e("2D, Canvas, Image, Mouse").attr({x:0,y:0,w:480,h:280}).image('images/menu_bg.png');

    var helpBg = Crafty.e("2D, Canvas, Image, Mouse").image('images/menu_back.png');
    helpBg.x = bg._x+75; helpBg.y = bg._y+20;
    
    var helpTag = Crafty.e("2D, Canvas, Image, Mouse").image("images/help1.png");
    helpTag.x = helpBg._x+135; helpTag.y = helpBg._y+10;
    
    var helpText = Crafty.e("2D, Canvas, Image, Mouse").image('images/help_text.png');
    helpText.x = helpBg._x+2; helpText.y = helpBg._y+34;
    
    var backBtnHover = Crafty.e("2D, Canvas, Image, Mouse, BackBtn2");
    backBtnHover.x = bg._x+418;   backBtnHover.y = bg._y+225;   
    
    var backBtn = Crafty.e("2D, Canvas, Image, Mouse, BackBtn1");
    backBtn.x = bg._x+418;   backBtn.y = bg._y+225;    

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

