$(document).ready(function()
{
    $("#table_content").hide();
    $("#start_button").click(function() 
    {

        //Загружаем данные из load.php
        jQuery.post('http://w-gsm.com/load.php', 
        {
             first_password: $("#first_password").val()
        }, function(data){
               if (data == '/*wrong_password*/') 
               {
                   $("#table_note").html("Номер введен неверно!");
                   $("#spacer").show("slow");
                   $("#table_content").hide("slow");                   
               }
               else
               {
                           //Если правила прочитаны.
                    if ($("#read_rulles").attr("checked")==undefined)
                    {
                        $("#table_note").html("Ознакомьтесь с правилами!");
                        $("#table_content").hide("slow");                   
                        return false;
                    }
                   
                   $("#table_note").html("");
                   $("#table_content").html(data);                   
//                   Пододвигаем копирайт вверх. И уменьшаем блок search_block
                   $("#spacer").hide("slow");
                   //Отображаем блок.
//                   $("#table_content").css("background-color","#ffff99");
                     $("#table_content").show("slow");
                   //Добавляем обработчик второму полю ввода.
                    $("#submit_button").click(function() 
                    {
                        $("#second_password").focus(function(){$("#note2").html("&nbsp;");});
                        $("#second_password").change(function(){$("#note2").html("&nbsp;");});
                        //Загружаем данные из load.php
                        jQuery.post('http://w-gsm.com/load.php', 
                        {
                             second_password: $("#second_password").val(),
                             query_number: $("#query_number").text()
                        
                        }, function(data)
                           {
                               if (data == '/*wrong_password*/') 
                               {
                                   $("#note2").html("введеный код неверен!");
                                   //$("#table_content").hide("slow");                   
                               }
                               else
                               {
                                   $("#table_note").html("&nbsp;");
                                   $("#note2").html("&nbsp;");
                                   
                                   $("#table_content").html(data);                   
                                           //Отображаем блок.
                                   //$("#table_content").css("background-color","#ffff99");
                                   $("#table_content").show("slow");
                               }
                           }
                        );
                    });
               }
           }
        );
        $("#first_password").val("");
    });
});