var tut = -1;

function WindowTut()
{
    this.name = "tut";
    this.layer = 0;
    this.a = [{x:12, y:76}, {x:60, y:74}, {x:62, y:74}];
    this.num_tut = 1;

    var bg = new createjs.Bitmap(load.queue.getResult("bg_menu"));
    this.getImg.addChild(bg);

    this.tut = ss_data.clone();
    this.tut.gotoAndStop("instructions1");
    this.tut.x = this.a[this.num_tut-1].x * devise_size;
    this.tut.y = this.a[this.num_tut-1].y * devise_size;
    this.getImg.addChild(this.tut);

    this.btn_left = new createjs.Container();
    this.btn_left.on("mousedown", function(){ window_controller.windows[window_controller.getIDbyName("tut")].Add(-1); });
    this.btn_left.x = 5*devise_size;
    this.btn_left.y = 421*devise_size;
    this.btn_left.regY = 52*devise_size;
    var btn_left_bg = ss_data.clone();
    btn_left_bg.gotoAndStop("btn");
    this.btn_left.addChild(btn_left_bg);
    var btn_left_up = ss_data.clone();
    btn_left_up.gotoAndStop("icon_left");
    this.btn_left.addChild(btn_left_up);
    this.getImg.addChild(this.btn_left);

    this.btn_right = new createjs.Container();
    this.btn_right.on("mousedown", function(){ window_controller.windows[window_controller.getIDbyName("tut")].Add(1); });
    this.btn_right.x = 263*devise_size;
    this.btn_right.y = 421*devise_size;
    this.btn_right.regY = 52*devise_size;
    var btn_right_bg = ss_data.clone();
    btn_right_bg.gotoAndStop("btn");
    this.btn_right.addChild(btn_right_bg);
    var btn_right_up = ss_data.clone();
    btn_right_up.gotoAndStop("icon_right");
    this.btn_right.addChild(btn_right_up);
    this.getImg.addChild(this.btn_right);
}
WindowTut.prototype = new ClassWindow();

WindowTut.prototype.Add = function(a)
{
    this.num_tut += a;
    if(this.num_tut < 1)
    {
        if(tut == -2)
        {
            window_controller.Show("location");
        }
        else {
            if (tut == -1)
                window_controller.Show("setting");
            else
                window_controller.Show("map");
        }
    }
    else
    {
        if(this.num_tut > 3)
        {
            if(tut == -2)
            {
                window_controller.Show("location");
            }
            else {
                if (tut == -1)
                    window_controller.Show("setting");
                else {
                    game.save.tut = false;
                    game.save.SaveTut();
                    game.CreateLvl(tut);
                    window_controller.Show("location");
                    if (config.lvls[tut].bonus_lvl)
                        window_controller.Show("bonuslvl");
                    else
                        window_controller.Show("job");
                }
            }
        }
        else
        {
            this.tut.gotoAndStop("instructions" + this.num_tut);
            this.tut.x = this.a[this.num_tut-1].x * devise_size;
            this.tut.y = this.a[this.num_tut-1].y * devise_size;
        }
    }
};

WindowTut.prototype.Show = function()
{
    this.num_tut = 1;
    this.tut.gotoAndStop("instructions" + this.num_tut);
    this.tut.x = this.a[this.num_tut-1].x * devise_size;
    this.tut.y = this.a[this.num_tut-1].y * devise_size;
};