
function createPauseScreen(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/menubg.png");

    var restartHover = Crafty.e("2D, Canvas, Image, Mouse").image("images/restart_2.png");
    restartHover.x = bg._x+70;     restartHover.y = bg._y+110;
    restartHover.alpha = 0.01;
    
    var restartBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/restart_1.png");
    restartBtn.x = bg._x+70; restartBtn.y = bg._y+110;
    
    var resumeHover = Crafty.e("2D, Canvas, Image, Mouse").image("images/resume_1.png");
    resumeHover.x = bg._x+70;     resumeHover.y = bg._y+40;
    resumeHover.alpha = 0.01;
    
    var resumeBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/resume_2.png");
    resumeBtn.x = bg._x+70; resumeBtn.y = bg._y+40;
                
    var offBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/sound_off.png");
    offBtn.x = bg._x+70; offBtn.y = bg._y+180;
    offBtn.originX = offBtn._x;
    
    var onBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/sound_on.png");
    onBtn.x = bg._x+70; onBtn.y = bg._y+180;
    onBtn.originX = onBtn._x;

    var helpHover = Crafty.e("2D, Canvas, Image, Mouse").image("images/help_2.png");
    helpHover.x = bg._x+70;     helpHover.y = bg._y+250;
    helpHover.alpha = 0.01;
    
    var helpBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/help_1.png");
    helpBtn.x = bg._x+70; helpBtn.y = bg._y+250;

    var mainMenuHover = Crafty.e("2D, Canvas, Image, Mouse").image("images/Main_menu_2.png");
    mainMenuHover.x = bg._x+70;   mainMenuHover.y = bg._y+320;
    mainMenuHover.alpha = 0.01;
    
    var mainMenuBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/Main menu.png");
    mainMenuBtn.x = bg._x+70; mainMenuBtn.y = bg._y+320;

    
    
    if(getAudioIsMuted()) {
        offBtn.visible = true;
        onBtn.visible = false;
        onBtn.x = -1000;
    } else {
        offBtn.visible = false;
        onBtn.visible = true;
        offBtn.x = -1000;
    }

    

    offBtn.bind("MouseDown", function(e) {
        console.log("off btn clicked");
       setAudioIsMuted(false)
        onBtn.visible = true;
        offBtn.visible = false;
        offBtn.x = -1000;
        onBtn.x = onBtn.originX
        soundDown = false;
        playBgMusic("BgmMenu")
    });

    onBtn.bind("MouseDown", function(e) {
        console.log("on btn clicked");
       setAudioIsMuted(true)
        offBtn.visible = true;
        onBtn.visible = false;
        offBtn.x = offBtn.originX
        onBtn.x = -1000;
        soundDown = true;
        Crafty.audio.stop();
        setBgMusicPlaying();
    });

    
    restartBtn.bind("MouseDown", function(e) {
        restartHover.alpha = 1;
        restartBtn.alpha = 0.01;
    })
    
    restartBtn.bind("MouseUp", function(e) {
        winCheck = 0;
        cardLoadingIndex=0;
        generalGraphicsLoadingIndex = 0;
        cardArray = [];
        cardNameArray = [];
        generalGraphicsArray = [];

        deskCanvasID = "deskCanvas"+(deskCanvas+1);
        $("#mainDiv").show();
        document.getElementById("mainDiv").innerHTML = "";
        cardArray.length = 0;
        generalGraphicsArray.length = 0;
        cardNameArray.length= 0;
        Crafty.scene('GamePlay');
        
    })
    
    
    
    resumeBtn.bind("MouseDown", function(e) {
        resumeHover.alpha = 1;
        resumeBtn.alpha = 0.01;
    })
    
    resumeBtn.bind("MouseUp", function(e) {
        deleteImages([bg, resumeBtn, resumeHover, onBtn, offBtn, helpBtn, helpHover, mainMenuHover, restartBtn, restartHover, mainMenuBtn]);
        playBgMusic("GameMusic")
        $("#mainDiv").show();
    })

  
    
    helpBtn.bind("MouseDown", function(e) { 
        helpHover.alpha = 1;
        helpBtn.alpha = 0.01;
    });
           
      
    helpBtn.bind("MouseUp", function(e) { 
        helpHover.alpha = 0.01;
        helpBtn.alpha = 1;
        createHelpScreen();
    });
                
    mainMenuBtn.bind("MouseDown", function(e) {
        mainMenuHover.alpha = 1;
        mainMenuBtn.alpha = 0.01;
    });
    
    mainMenuBtn.bind("MouseUp", function(e) {
        mainMenuHover.alpha = 0.01;
        mainMenuBtn.alpha = 1;
        createExitScreen();
    });
       
    
    bg.bind("MouseUp", function(e) { 
        restartHover.alpha = 0.01;
        restartBtn.alpha = 1;
        mainMenuHover.alpha = 0.01;
        mainMenuBtn.alpha = 1;
        helpHover.alpha = 0.01;
        helpBtn.alpha = 1;
        resumeHover.alpha = 0.01;
        resumeBtn.alpha = 1;
                
    });
    
    onBtn.bind("MouseUp", function(e) { 
        restartHover.alpha = 0.01;
        restartBtn.alpha = 1;
        mainMenuHover.alpha = 0.01;
        mainMenuBtn.alpha = 1;
        helpHover.alpha = 0.01;
        helpBtn.alpha = 1;
        resumeHover.alpha = 0.01;
        resumeBtn.alpha = 1;
                
    });
    
    offBtn.bind("MouseUp", function(e) { 
        restartHover.alpha = 0.01;
        restartBtn.alpha = 1;
        mainMenuHover.alpha = 0.01;
        mainMenuBtn.alpha = 1;
        helpHover.alpha = 0.01;
        helpBtn.alpha = 1;
        resumeHover.alpha = 0.01;
        resumeBtn.alpha = 1;
                
    });
    

}


