extend(BonusWnd, createjs.Container);

function BonusWnd()
{	
	this.initialize();
	var th = this
	this.mouseChildren = false
//--------------------------------//WIDTHGAME, HEIGHTGAME
	var t

	var tit = new createjs.Sprite(jsons["JSON1"]);

	var o = new createjs.Sprite(jsons["JSON2"]);
	setCoor(o, 164, 334)

	var podl = new createjs.Sprite(jsons["JSON2"]);
	podl.gotoAndStop("window_rewards")
	setCoor(podl, 2, -80)

	var sh = new Button({pod:"btn_loop", i:"btn_arrow", iconX: 84, iconY: 20, iconScaleX:-1})
	setCoor(sh, 522, 604)
	// sh.addEventListener("click", function(){
	// 	returnToGame()
	// 	t_delInTicker(t)
	// })

	var area = new createjs.Shape()
	area.graphics.beginFill("#000000").drawRect(0, 0, WIDTHGAME, HEIGHTGAME)
	this.hitArea = area

	this.addEventListener("click", function(){
		returnToGame()
		t_delInTicker(t)
	})

	this.registerObservers = function(v){

	}

	var up = new TopInterface(this)
	up.mouseChildren = false
	up.setVisibleRandom(false)

	var frame = new FloatFrame()
	frame.addToTopPlatform(up)

	
	this.addChild(frame)
	this.addChild(podl)
	this.addChild(o)
	this.addChild(sh)
	this.addChild(tit)

	// dragAndDrop(o)
	// dragAndDrop(podl)
	// dragAndDrop(sh)

	this.update = function(par){
		if(!par && !par.name)
			return
		if(par.life)
			up.setLife(par.life)
		frame.addToTopPlatform(up)

		console.log(par.name)
		tit.gotoAndStop(par.name)
		// dragAndDrop(tit)
		setCoor(tit, coors[par.name][0], coors[par.name][1])

		t_allInPause()
		o.gotoAndStop("reward_" + par.name)
		t = t_delayOn(10, returnToGame)

	}


	function returnToGame(){
		v_choiseLocation("game", {dont_update: true})
		t_delAllInPause()
	}

	var coors = {
		"bombs": [160, 245],
		"air_strike": [165, 244],
		"submarine": [163, 243],
		"life": [162, 237],
		"torpedo": [161, 245]
	}
}