var original;
$(document).ready(function(){
    original = $("#press").html();
    $("#press_enter").click(function(){
        $.ajax({
          type: "POST",
          url: "check_press.php",
          data: "password="+$("#pbox").val(),
          beforeSend: function(){
              // alert("Before");
          },
          error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert(XMLHttpRequest+":"+textStatus+":"+errorThrown);
          },
          success: function(msg){
            if(msg=="passed"){
                $("#press_text").text("PASSWORD CORRECT");
                $("#passwordForm input").remove();
                $("#passwordForm a").text("CLICK HERE TO ENTER");
                $("#press_enter").click(function(){
                    film = window.open("screen_test.html", "st", "width=768,height=527");
                    film.focus();
                     $("#press").html(original);
                });
               
            }else{
                $("#press_text").text("PLEASE TRY AGAIN")
            }
          }
        });
        return false;
    });
    
})