extend(Pause, createjs.Container);

function Pause()
{	
	this.initialize();
	var th = this
//--------------------------------//WIDTHGAME, HEIGHTGAME

	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_pause");
	setCoor(title1, 256, 7)

	var pirot = new createjs.Sprite(jsons["JSON2"]);
	pirot.gotoAndStop("pirot")
	setCoor(pirot, 55, 455)
	// title1.x = 231;
	// title1.y = 222;
	// dragAndDrop(pirot);

	cont.addChild(t)
	// dragAndDrop(title1)
	// this.addChild(pirot)
	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)
	// dragAndDrop(btnsound)

	}

	// var btnback = new Button({pod: "btn", icon: "icon_right"});
	// setCoor(btnback, 379, 539)
	// // btnback.x = 374
	// // btnback.y = 524
	// btnback.addEventListener("click", function(){
	// 	m.slideOnBottom(function(){
	// 		par.hideModal(th)
	// 		par.resume()
	// 	})
	// });

	var btnmenu = new Button({pod: "btn", i: "icon_menu"});
	setCoor(btnmenu, 48, 222)
	// dragAndDrop(btnmenu)
	// btnmenu.x = 166
	// btnmenu.y = 524
	btnmenu.addEventListener("click", function(){v_choiseLocation("menu");});

	var btnback = new Button({pod: "btn_loop", i: "btn_next", iconX:19, iconY:21})
	// dragAndDrop(btnback)
	setCoor(btnback, 434, 494)
	btnback.addEventListener("click", function(){v_choiseLocation("game", {dont_update: true, unPause: true})})


	MusicCTRL.registerObserver(this);
	var btn_tut = new Button({pod: "btn_1", i: "icon_info"});
	setCoor(btn_tut, 394-18, 478-69)
	btn_tut.x = WIDTHGAME/2 - btn_tut.getBounds().width/2
	btn_tut.addEventListener("click", function(){v_choiseLocation("instructions", {pause: true});});

	var crown = new createjs.Sprite(jsons["JSON2"]);
	crown.gotoAndStop("window_crown")
	setCoor(crown, 19, 600)

	var btn_back = new Button({pod: "btn_loop", i: "btn_arrow", iconX:83, iconY:20, rotateIcon: 90})
	setCoor(btn_back, 102, 522)
	btn_back.addEventListener("click", function(){v_choiseLocation("yar", {par: "pause"});});

	var btn_play = new Button({pod: "btn_loop", i: "btn_next", iconX:24, iconY:20})
	setCoor(btn_play, 437, 522)
	btn_play.addEventListener("click", function(){v_choiseLocation("game", {dont_update: true, unPause: true})})

	var frame = new FloatFrame()
	frame.addToTopPlatform(cont, 0)
	frame.addToTopPlatform(title1)
	frame.addToTopPlatform(btn_tut)
	frame.addToTopPlatform(crown)
	frame.addToTopPlatform(btn_back)
	frame.addToTopPlatform(btn_play)

	this.addChild(frame)

	// dragAndDrop(btn_back)
	// dragAndDrop(btn_play)

	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")		
	}
}