
function createPauseScreen(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 pauseTab = Crafty.e("2D, Canvas, Image, Mouse").image("images/pause_back.png");
    pauseTab.x = bg._x+132;   pauseTab.y = bg._y+20;
    
    var resumeHover2 = Crafty.e("2D, Canvas, Image, Mouse, PauseBack2");
    resumeHover2.x = bg._x+158;     resumeHover2.y = bg._y+34;
    
    var resumeHover1 = Crafty.e("2D, Canvas, Image, Mouse, PauseBack1");
    resumeHover1.x = bg._x+158;     resumeHover1.y = bg._y+34;
    
    var resumeBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/resume_button.png");
    resumeBtn.x = bg._x+182;       resumeBtn.y = bg._y+43;
	    
    var optionHover2 = Crafty.e("2D, Canvas, Image, Mouse, PauseBack2");
    optionHover2.x = bg._x+158;      optionHover2.y = bg._y+93;
    
    var optionHover1 = Crafty.e("2D, Canvas, Image, Mouse, PauseBack1");
    optionHover1.x = bg._x+158;      optionHover1.y = bg._y+93;
   
    var optionBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/options_button.png");
    optionBtn.x = bg._x+190;        optionBtn.y = bg._y+102;
   
    var helpBtnHover2 = Crafty.e("2D, Canvas, Image, Mouse, PauseBack2");
    helpBtnHover2.x = bg._x+158;     helpBtnHover2.y = bg._y+153;
    
    var helpBtnHover1 = Crafty.e("2D, Canvas, Image, Mouse, PauseBack1");
    helpBtnHover1.x = bg._x+158;     helpBtnHover1.y = bg._y+153;
    
    var helpBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/help1.png");
    helpBtn.x = bg._x+204;          helpBtn.y = bg._y+162;
    
    var mainmenuHover2 = Crafty.e("2D, Canvas, Image, Mouse, PauseBack2");
    mainmenuHover2.x = bg._x+158;    mainmenuHover2.y = bg._y+213;
    
    var mainmenuHover1 = Crafty.e("2D, Canvas, Image, Mouse, PauseBack1");
    mainmenuHover1.x = bg._x+158;    mainmenuHover1.y = bg._y+213;
    
    var mainmenuBtn = Crafty.e("2D, Canvas, Image, Mouse").image("images/main_menu.png");
    mainmenuBtn.x = bg._x+166;      mainmenuBtn.y = bg._y+222;


    
    helpBtn.bind("MouseDown", function(e) { 
        helpBtnHover1.alpha = 0.01;
    });
    helpBtnHover1.bind("MouseDown", function(e) { 
        helpBtnHover1.alpha = 0.01;
    });
        
	helpBtn.bind("MouseUp", function(e) { 
        helpBtnHover1.alpha = 1;
        createHelpScreen();
    });
    helpBtnHover1.bind("MouseUp", function(e) { 
        helpBtnHover1.alpha = 1;
        createHelpScreen();
    });
    
    
    optionBtn.bind("MouseDown", function(e) { 
        optionHover1.alpha = 0.01;
    });
    optionHover1.bind("MouseDown", function(e) { 
        optionHover1.alpha = 0.01;
    });
    
    optionBtn.bind("MouseUp", function(e) { 
        optionHover1.alpha = 1;
        createOptionScreen();
    });
    optionHover1.bind("MouseUp", function(e) { 
        optionHover1.alpha = 1;
        createOptionScreen();
    });
    

    
    resumeBtn.bind("MouseDown", function(e) { 
        resumeHover1.alpha = 0.01;
    });
    resumeHover1.bind("MouseDown", function(e) { 
        resumeHover1.alpha = 0.01;
    });
    
    resumeBtn.bind("MouseUp", function(e) {
        resumeHover1.alpha = 1;
        deleteImages([bg, resumeBtn, resumeHover1, resumeHover2, helpBtn, helpBtnHover1, helpBtnHover2, pauseTab, optionBtn, optionHover1, optionHover2, mainmenuBtn, mainmenuHover1, mainmenuHover2]);
        compCarMoveX = 30;
        if(compRaceCompleted == 1){
            pausebackGame();
        }
        else{
            compCarBeginMove();
        }
        resumeRace();
        
        playBgMusic("GameMusic")
    });
    
    resumeHover1.bind("MouseUp", function(e) { 
        resumeHover1.alpha = 1;
        deleteImages([bg, resumeBtn, resumeHover1, resumeHover2, helpBtn, helpBtnHover1, helpBtnHover2, pauseTab, optionBtn, optionHover1, optionHover2, mainmenuBtn, mainmenuHover1, mainmenuHover2]);
        compCarMoveX = 30;
        if(compRaceCompleted == 1){
            pausebackGame();
        }
        else{
            compCarBeginMove();
        }
        resumeRace();
        
        playBgMusic("GameMusic")
    });


    mainmenuBtn.bind("MouseDown", function(e) { 
        mainmenuHover1.alpha = 0.01;
    });
    mainmenuHover1.bind("MouseDown", function(e) { 
        mainmenuHover1.alpha = 0.01;
    });
    
    mainmenuBtn.bind("MouseUp", function(e) { 
        mainmenuHover1.alpha = 1;
        boardBack = true;
        createExitScreen();
    });
    mainmenuHover1.bind("MouseUp", function(e) { 
        mainmenuHover1.alpha = 1;
        boardBack = true;
        createExitScreen();
    });
    
  
    bg.bind("MouseUp", function(e) { 
        resumeHover1.alpha = 1;
        optionHover1.alpha = 1;
        helpBtnHover1.alpha = 1;
        mainmenuHover1.alpha = 1;
    });
    
    pauseTab.bind("MouseUp", function(e) { 
        resumeHover1.alpha = 1;
        optionHover1.alpha = 1;
        helpBtnHover1.alpha = 1;
        mainmenuHover1.alpha = 1;
    });
    
    
}
