(function (lib, img, cjs) {

var p; // shortcut to reference prototypes
var rect; // used to reference frame bounds

// library properties:
lib.properties = {
	width: 1732,
	height: 987,
	fps: 30,
	color: "#FFFFFF",
	manifest: [
		{src:"images/drag_1.png", id:"drag_1"},
		{src:"images/drag_2.png", id:"drag_2"},
		{src:"images/drag_3.png", id:"drag_3"},
		{src:"images/drag_4.png", id:"drag_4"},
		{src:"images/drag_5.png", id:"drag_5"},
		{src:"images/drag_6.png", id:"drag_6"},
		{src:"images/drag_7.png", id:"drag_7"},
		{src:"images/drag_8.png", id:"drag_8"},
		{src:"images/gfx_bg.png", id:"gfx_bg"}
	]
};

// stage content:
(lib.index = function() {
	this.initialize();

	// exercise
	this.container = new lib.exerciseContainer();
	this.container.setTransform(916.5,389,1,1,0,0,0,916.5,389);

	this.addChild(this.container);
}).prototype = p = new cjs.Container();
p.nominalBounds = rect = new cjs.Rectangle(866,493.5,1732.9,976.6);
p.frameBounds = [rect];


// symbols:
(lib.drag_1 = function() {
	this.initialize(img.drag_1);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,346,461);


(lib.drag_2 = function() {
	this.initialize(img.drag_2);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,452,408);


(lib.drag_3 = function() {
	this.initialize(img.drag_3);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,415,408);


(lib.drag_4 = function() {
	this.initialize(img.drag_4);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,554,455);


(lib.drag_5 = function() {
	this.initialize(img.drag_5);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,415,436);


(lib.drag_6 = function() {
	this.initialize(img.drag_6);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,566,355);


(lib.drag_7 = function() {
	this.initialize(img.drag_7);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,431,478);


(lib.drag_8 = function() {
	this.initialize(img.drag_8);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,403,317);


(lib.gfx_bg = function() {
	this.initialize(img.gfx_bg);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,974,892);


(lib.place = function() {
	this.initialize();

	// Layer 2
	this.instance = new lib.gfx_bg();
	this.instance.setTransform(-1.5,-2.5);

	this.addChild(this.instance);
}).prototype = p = new cjs.Container();
p.nominalBounds = rect = new cjs.Rectangle(-1.5,-2.5,974,892);
p.frameBounds = [rect];


(lib.drag_8_1 = function() {
	this.initialize();

	// Layer 1
	this.instance = new lib.drag_8();
	this.instance.setTransform(-201.5,-158.5);

	this.addChild(this.instance);
}).prototype = p = new cjs.Container();
p.nominalBounds = rect = new cjs.Rectangle(-201.5,-158.5,403,317);
p.frameBounds = [rect];


(lib.drag_7_1 = function() {
	this.initialize();

	// Layer 1
	this.instance = new lib.drag_7();
	this.instance.setTransform(-215.5,-239);

	this.addChild(this.instance);
}).prototype = p = new cjs.Container();
p.nominalBounds = rect = new cjs.Rectangle(-215.5,-239,431,478);
p.frameBounds = [rect];


(lib.drag_6_1 = function() {
	this.initialize();

	// Layer 1
	this.instance = new lib.drag_6();
	this.instance.setTransform(-283,-177.5);

	this.addChild(this.instance);
}).prototype = p = new cjs.Container();
p.nominalBounds = rect = new cjs.Rectangle(-283,-177.5,566,355);
p.frameBounds = [rect];


(lib.drag_5_1 = function() {
	this.initialize();

	// Layer 1
	this.instance = new lib.drag_5();
	this.instance.setTransform(-207.5,-218);

	this.addChild(this.instance);
}).prototype = p = new cjs.Container();
p.nominalBounds = rect = new cjs.Rectangle(-207.5,-218,415,436);
p.frameBounds = [rect];


(lib.drag_4_1 = function() {
	this.initialize();

	// Layer 1
	this.instance = new lib.drag_4();
	this.instance.setTransform(-277,-227.5);

	this.addChild(this.instance);
}).prototype = p = new cjs.Container();
p.nominalBounds = rect = new cjs.Rectangle(-277,-227.5,554,455);
p.frameBounds = [rect];


(lib.drag_3_1 = function() {
	this.initialize();

	// Layer 1
	this.instance = new lib.drag_3();
	this.instance.setTransform(-207.5,-204);

	this.addChild(this.instance);
}).prototype = p = new cjs.Container();
p.nominalBounds = rect = new cjs.Rectangle(-207.5,-204,415,408);
p.frameBounds = [rect];


(lib.drag_2_1 = function() {
	this.initialize();

	// Layer 1
	this.instance = new lib.drag_2();
	this.instance.setTransform(-226,-204);

	this.addChild(this.instance);
}).prototype = p = new cjs.Container();
p.nominalBounds = rect = new cjs.Rectangle(-226,-204,452,408);
p.frameBounds = [rect];


(lib.drag_1_1 = function() {
	this.initialize();

	// Layer 1
	this.instance = new lib.drag_1();
	this.instance.setTransform(-173,-230.5);

	this.addChild(this.instance);
}).prototype = p = new cjs.Container();
p.nominalBounds = rect = new cjs.Rectangle(-173,-230.5,346,461);
p.frameBounds = [rect];


(lib.exerciseContainer = function(mode,startPosition,loop) {
if (loop == null) { loop = false; }	this.initialize(mode,startPosition,loop,{});

	// timeline functions:
	this.frame_0 = function() {
		/* Sortowanie */
		var config = {
			id: '3451',
			title: 'Ułóż puzzle, żeby dowiedzieć się, jaka zabawka kryje się na obrazku.',
			type: 'drag',
			container: this,
			/*
			groups: {		
				1: [1,2,3,4],
				2: [5,6],
				3: [7,8]
			},
			*/
			prefix: 'drag_',
			prefix2: 'drop_',
			results: [
				/*drop_1:*/ '1',
				/*drop_2:*/ '2',
				/*drop_3:*/ '3',
				/*drop_4:*/	'4',
				/*drop_5:*/	'5',
				/*drop_6:*/	'6',
				/*drop_7:*/	'7',
				/*drop_8:*/	'8',
			],
			range: 100,
			alpha: 0,
			alpha2: 0,
			//scale: 0.8,
			//rotation: 'auto',
			//size: 'auto',
			//zindex: 0,
			exerciseAfterInit: function (container) {
			},
			exerciseBeforeFinish: function(container) {		
			},
			exerciseExtraCheck: function(container) {		
			},
		}
		
		exerciseOnInit(config);
		
		this.stop();
		
		/* Help */
		
		/* 
		id - Id cwiczenia
		title - Tytul cwiczenia
		type - Typ Cwiczenia
		contanier - Kontener cwiczenia
		groups - Lista grup oraz przypisane do nich identyfikatory (unikatowa liczba) obiektow bez prefixow
		prefix - Prefixy w nazwach obiektow
		results - Rozwiazanie jako tablica identyfikatorow. Znak '|' definuje alternatywe, a '&' oznacza sume.	
		Przyklad:
		Cwiczenie typu sort.
		Odpowiedzi: [5,2,1,4,5] - tablica z ulozonymi w odpowiedniej kolejnisci identyfikatorami obiektow sortowanych.
		Cwiczenie typu drag.
		Odpowiedzi: [5,1|3,2&4] - tablica z id obiektow przeciaganych lub grup. W tym wariancie kazdy kolejny element z indexem 'i' w tablicy odpowiada targetowi o nazwie 'prefix+i'.
		np. prawidlowa odpowiedzia dla drop_1 jest obiekt drag_5, dla drop_2 obiekt drag_1 lub drag_3, dla drop_3 obiekt drag_2 oraz drag_4.
		range - Zakres dociagania
		alpha - Przezroczystosc targetu
		alpha2 - Przezroczystosc targetu po najechaniu
		scale - Skalowanie obiektu po upuszczeniu
		zindex - Warstwa obiektu
		*/
	}

	// actions tween:
	this.timeline.addTween(cjs.Tween.get(this).call(this.frame_0).wait(1));

	// drop
	this.drop_7 = new lib.drag_7_1();
	this.drop_7.setTransform(567,642.8);
	this.drop_7.alpha = 0;

	this.drop_8 = new lib.drag_8_1();
	this.drop_8.setTransform(764,722.6);
	this.drop_8.alpha = 0;

	this.drop_6 = new lib.drag_6_1();
	this.drop_6.setTransform(284,704.4);
	this.drop_6.alpha = 0;

	this.drop_5 = new lib.drag_5_1();
	this.drop_5.setTransform(757.7,480.3);
	this.drop_5.alpha = 0;

	this.drop_4 = new lib.drag_4_1();
	this.drop_4.setTransform(278,400.1);
	this.drop_4.alpha = 0;

	this.drop_3 = new lib.drag_3_1();
	this.drop_3.setTransform(757.9,205);
	this.drop_3.alpha = 0;

	this.drop_2 = new lib.drag_2_1();
	this.drop_2.setTransform(439,205);
	this.drop_2.alpha = 0;

	this.drop_1 = new lib.drag_1_1();
	this.drop_1.setTransform(174,231.5);
	this.drop_1.alpha = 0;

	this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.drop_1},{t:this.drop_2},{t:this.drop_3},{t:this.drop_4},{t:this.drop_5},{t:this.drop_6},{t:this.drop_8},{t:this.drop_7}]}).wait(1));

	// content
	this.drag_3 = new lib.drag_3_1();
	this.drag_3.setTransform(1223.9,716.5);

	this.drag_6 = new lib.drag_6_1();
	this.drag_6.setTransform(1422.5,799.1);

	this.drag_7 = new lib.drag_7_1();
	this.drag_7.setTransform(1202.5,273.5);

	this.drag_8 = new lib.drag_8_1();
	this.drag_8.setTransform(1504,518.2);

	this.drag_5 = new lib.drag_5_1();
	this.drag_5.setTransform(1525.4,265.4);

	this.drag_4 = new lib.drag_4_1();
	this.drag_4.setTransform(1428.5,299.9);

	this.drag_2 = new lib.drag_2_1();
	this.drag_2.setTransform(1303.9,563.7);

	this.drag_1 = new lib.drag_1_1();
	this.drag_1.setTransform(1189.4,618.9);

	this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.drag_1},{t:this.drag_2},{t:this.drag_4},{t:this.drag_5},{t:this.drag_8},{t:this.drag_7},{t:this.drag_6},{t:this.drag_3}]}).wait(1));

	// bg
	this.instance = new lib.place("synched",0);
	this.instance.setTransform(480.6,440.2,1,1,0,0,0,479.1,437.6);

	this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));

}).prototype = p = new cjs.MovieClip();
p.nominalBounds = rect = new cjs.Rectangle(0,0,1732.9,976.6);
p.frameBounds = [rect];

})(lib = lib||{}, images = images||{}, createjs = createjs||{});
var lib, images, createjs;