extend(Setting, createjs.Container);

function Setting()
{	
	this.initialize();
	var th = this
//--------------------------------//
	var cont = new createjs.Container()

	var t = new createjs.Sprite(jsons["JSON2"]);
	t.gotoAndStop("window")
	t.x = WIDTHGAME/2 - t.getBounds().width/2
	t.y = HEIGHTGAME/2 - t.getBounds().height/2

	var title1 = new createjs.Sprite(jsons["JSON2"]);			/// Заголовок
	title1.gotoAndStop("text_red_settings");
	setCoor(title1, 212, 4)
	// dragAndDrop(title1)
	title1.x = WIDTHGAME/2 - title1.getBounds().width/2

	cont.addChild(t)
	// cont.addChild(title1)
	
	if(__audio_supported){
		var btnmusic = new Button({pod: "btn_1", i: "icon_music_on", i2: "icon_music_off"});
		btnmusic.changeFrame("off")
		setCoor(btnmusic, 394-18, 240-69)
		btnmusic.addEventListener("click", function(){
														var cur = btnmusic.changeBeetweenAnim("off", "on");
														if(cur == "off")
															MusicCTRL.off("music");
														else{
															MusicCTRL.on("music");
															MusicCTRL.play("music");
														}
													})
		cont.addChild(btnmusic)
		// dragAndDrop(btnmusic)

		var btnsound = new Button({pod: "btn_1", i: "icon_sound_on", i2: "icon_sound_off"});
		btnsound.changeFrame("off")
		// btnsound.alpha = .5
		setCoor(btnsound, 128-18, 240-69)
		btnsound.addEventListener("click", function(){
														var cur = btnsound.changeBeetweenAnim("off", "on");
														if(cur == "off")
															MusicCTRL.off("sound");
														else
															MusicCTRL.on("sound", 1);
													})
		cont.addChild(btnsound)
	// dragAndDrop(btnsound)

	}

	var btnabout = new Button({pod: "btn_1", i: "icon_about"});
	setCoor(btnabout, 128-18, 478-69)
	btnabout.addEventListener("click", function(){v_choiseLocation("about");});


	var btn_tut = new Button({pod: "btn_1", i: "icon_info"});
	setCoor(btn_tut, 394-18, 478-69)
	btn_tut.addEventListener("click", function(){v_choiseLocation("instructions");});

	var btn_back = new Arrow("left")
	setCoor(btn_back, 54, 19)
	btn_back.addEventListener("click", function(){
		v_choiseLocation("menu");		
	})

	var frame = new FloatFrame()
	frame.addToTopPlatform(cont, 0)
	frame.addToTopPlatform(title1)
	frame.addToTopPlatform(btn_back)
	// dragAndDrop(btnabout)
	// dragAndDrop(btn_tut)
	// dragAndDrop(btn_back)

	MusicCTRL.registerObserver(this);

	// this.addChild(btnback)
	cont.addChild(btnabout)
	cont.addChild(btn_tut)
	// this.addChild(btn_back)
	this.addChild(frame)

	this.off = function(v){
		if(v == "music")
			btnmusic.changeFrame("off")
		if(v == "sound")
			btnsound.changeFrame("off")
	},

	this.on = function(v){
		if(v == "music")
			btnmusic.changeFrame("on")
		if(v == "sound")
			btnsound.changeFrame("on")		
	}
}