function QuestInfo()
{
   this.user_name = "";
   this.book_name = "";
   this.page_number = 0;
   this.page_progress = 0;
   this.page_time = 0;

   this.rebuild = function(jq_node)
   {
      this.parse(jq_node);
      this.build();
   }

   this.parse = function(jq_node)
   {
      this.user_name = jq_node.attr("user_name");
      this.book_name = jq_node.attr("book_name");
      this.book_color = jq_node.attr("book_color");
      this.book_pages_count = jq_node.attr("book_pages_count");
      this.page_number = Number(jq_node.attr("page_number"));
      this.page_progress = Number(jq_node.attr("page_progress"));
      this.page_time = Number(jq_node.attr("page_time"));
      this.coins = Number(jq_node.attr("coins"));
      this.repeat_mode = Number(jq_node.attr("repeat_mode"));

      this.total_score = Number(jq_node.attr("total_score"));
      this.day_score = Number(jq_node.attr("day_score"));
      this.week_score = Number(jq_node.attr("week_score"));

      this.total_place = Number(jq_node.attr("total_place"));
      this.day_place = Number(jq_node.attr("day_place"));
      this.week_place = Number(jq_node.attr("week_place"));

      this.rating_kind = jq_node.attr("rating_kind");
   }

   this.turnSound = function()
   {
      ENABLE_SOUND = !ENABLE_SOUND;
      this.showSettings();
      $.get(HOME + "/serv/store_option.php?" + Math.random(), { sound: (ENABLE_SOUND ? 1 : 0) });
   }

   this.changeRatingKind = function()
   {
      switch(this.rating_kind)   {
         case "day":
         default:
            this.rating_kind = "week";
            break;
         case "week":
            this.rating_kind = "total";
            break;
         case "total":
            this.rating_kind = "day";
            break;
      }
      this.showRating();
   }

   this.showRating = function()
   {
      var score, place, text;
      switch(this.rating_kind)   {
         case "day":
         default:
            score = this.day_score;
            place = this.day_place;
            text = "за день";
            this.rating_kind = "day";
            break;
         case "week":
            score = this.week_score;
            place = this.week_place;
            text = "за неделю";
            break;
         case "total":
            score = this.total_score;
            place = this.total_place;
            text = "вообще";
            break;
      }

      $("#score b").text(score);
      $("#score a:eq(0)").text(place + " место");
      $("#score a:eq(0)").attr("href", HOME + "/rating/" + this.rating_kind + "/my");
      $("#score a:eq(1)").text(text);
   }

   this.showSettings = function()
   {
      if (ENABLE_SOUND) {
         $("#sound-setting").text("Звук: включен");
         $("#sound-setting").addClass("on");
      }  else  {
         $("#sound-setting").text("Звук: выключен");
         $("#sound-setting").removeClass("on");
      }
   }

   this.build = function(jq_node)
   {
      //$("#game-info-user").text(this.user_name);
      page_time = this.page_time;
      this.showRating();
      this.showSettings();
      $("#score").add("#game-info-settings").removeClass("hidden");

      $("#game-info-progress h3").text("стр. " + this.page_number);
      
      $("#game-info-progress #percent-progress").text(this.page_progress + "%");
      $("#game-info-progress #progress-bar img").css("width", 204*this.page_progress/100 + "px");
      $("#game-info-progress #progress-bar img").css("background-color", "#" + this.book_color);
      $("#game-info-progress #coins").text(this.coins);

      $("#game-info-book h2").text(this.book_name.toUpperCase());
      $("#game-info-book-img").attr("src", HOME + "/images/books/"+ this.book_name.toLowerCase() + "-active.png");
      $("#game-info-book div").text("стр. " + this.page_number + "/" + this.book_pages_count);
      
      //$("#game-info").removeClass("hidden");
      if (this.repeat_mode)   {
         $("#repeat-mode").removeClass("none");
      }  else  {
         $("#repeat-mode").addClass("none");
      }
   }
}