

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 blackBg = Crafty.e("2D, Canvas, Image, Mouse").image('images/pop_up.png');
    blackBg.x = bg._x+62; blackBg.y = bg._y+35;
    
    var helpTag = Crafty.e("2D, Canvas, Image").image("images/help3.png");
    helpTag.x = bg._x+205; helpTag.y = bg._y+7;

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

    var backBtnHover = Crafty.e("2D, Canvas, Image, Mouse").image("images/back2.png");
    backBtnHover.x = bg._x+418; backBtnHover.y = bg._y+225;    
    backBtnHover.alpha = 0.01;
    
    var backBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/back1.png");
    backBtn.x = bg._x+418; backBtn.y = bg._y+225;    


    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, helpTag, blackBg, backBtn, backBtnHover, helpText]);
    });
    
    bg.bind("MouseUp", function(e) { 
        backBtnHover.alpha = 0.01;
        backBtn.alpha = 1;
    });
    
    blackBg.bind("MouseUp", function(e) { 
        backBtnHover.alpha = 0.01;
        backBtn.alpha = 1;
    });
    
    helpText.bind("MouseUp", function(e) { 
        backBtnHover.alpha = 0.01;
        backBtn.alpha = 1;
    });

   
}

