<?xml version="1.0" encoding="Win-1251"?>
<rmml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="L:\collaborative-nir\program\Cscl3DWS\rmml\RMML.xsd">
	<include src="dragDrop.xml"/>
	<include src="resimage.xml"/>
	<include src="lists_.xml"/>

<!-- Список элементов-->

	<composition name="cOverComp">
		<composition name="imNormal" class="CResizablePaper"/>
		<composition name="imOver" class="CResizablePaper" depth="-1"/>
		<composition name="imSelect" class="CResizablePaper" depth="-1"/>
		<script>
			this.srcArr = null;
		</script>
		<script>
			function init(w,h)
				{
					imNormal.visible = true;
					imNormal.init(this.srcArr[0], 1, 1, 1, 1);
					imOver.init(this.srcArr[1], 1, 1, 1, 1);
					imSelect.init(this.srcArr[2], 1, 1, 1, 1);
					imNormal.resize(w,h);
					imOver.resize(w,h);
					imSelect.resize(w,h);
					imOver.hide();
					imSelect.hide();
					this.onRollOver = function()
						{
							this.imOver.visible = true;
						}
					this.onRollOut = function()
						{
							this.imOver.visible = false;
						}
				}
		</script>
	</composition>

 	<composition name="cItemCell" enabled="true">
		<composition name="fon" class="cOverComp" depth="0">
			<script>
				this.srcArr = new Array ("rmgr:fConstruct/table/stNormal.png","rmgr:fConstruct/table/stOver.png","rmgr:fConstruct/table/stSelect.png");
				this.onRelease = function()
					{
						this.imSelect.visible = true;
						this.imOver.visible = false;
					}
			</script>
		</composition>
		<text name="txCaption" depth="-10"/>
		<script>
			function cellInit(w,h)
				{
					fon.init(w,h);
				}

			function setStyle(arrSrc,arrSty)
				{
					if (arrSrc!=null)
						{
							this.fon.srcArr = arrSrc;
						}
					if (arrSty!=null)
						{
							this.stNormal = arrSty[0];
							this.stOvered = arrSty[1];
							this.stSelected = arrSty[2];
							this.txCaption.style = this.stNormal;
						}
				}

		</script>
	</composition>

	<composition name="cItemRow" visible="true" enabled="true">
		<script>
			this.data = null;
	 		this.cells = new Array();
			this.overed = false;
		</script>
		<script event="onRelease"><![CDATA[
			if (this.parent.curRow!=this)
				{
					if (this.parent.curRow!=null)
						{
							for (var i=0; i<this.parent.curRow.cells.length; i++)
								{
									this.parent.curRow.cells[i].txCaption.style = this.parent.curRow.cells[i].stNormal;
									this.parent.curRow.cells[i].fon.imSelect.visible = false;
								}
							this.overed = true;
						}
					this.parent.curRow = this;
					for (var i=0; i<this.cells.length; i++)
						{
							this.cells[i].txCaption.style = this.cells[i].stSelected;
							this.cells[i].fon.fireEvent("onRelease");
						}
					parent.rowSelect();
				}
		]]></script>
		<script event="onRollOver"><![CDATA[
			if (!this.overed&&this.parent.curRow!=this)
				{
					this.overed = true;
					for (var i=0; i<this.cells.length; i++)
						{
								this.cells[i].txCaption.style = this.cells[i].stOvered;
								this.cells[i].fon.fireEvent("onRollOver");
						}
				}
		]]></script>
		<script event="onRollOut"><![CDATA[
			if (this.overed&&this.parent.curRow!=this)
				{
					this.overed = false;
					for (var i=0; i<this.cells.length; i++)
						{
								this.cells[i].txCaption.style =this.cells[i].stNormal;
								this.cells[i].fon.fireEvent("onRollOut");
						}
				}
		]]></script>
		<script><![CDATA[
			function addCells(arrCells)
				{
					for (var i=0; i<arrCells.length; i++)
						{
							var newCell = new Composition();
							newCell._class ="cItemCell";
							newCell.name = "cell_"+i;
							newCell.parent = this;

							newCell.txCaption.style = this.stNormal;
							newCell.txCaption.value = arrCells[i];
							newCell.txCaption.x = parent.paddingX;
							newCell.txCaption.y = parent.paddingY;
							this.cells.push(newCell);
						}
				}

			function setRowStyle(arrCollSrc,arrCollStyle)
			{
				for (var i=0; i<this.cells.length; i++)
				{
					this.cells[i].setStyle(arrCollSrc,arrCollStyle[i]);
				}
			}


		]]></script>
	</composition>

	<composition name="cTableBase" visible="false" enabled="true">
		<styles name="stTitle" fontFamily="Arial" fontSize="20" color="#000066"/>
		<styles name="stNormal1" fontFamily="Arial" fontSize="20" color="#FF0000"/>
		<styles name="stOvered1" fontFamily="Arial" fontSize="20" color="#00FF00"/>
		<styles name="stSelected1" fontFamily="Arial" fontSize="20" color="#0000FF"/>
		<styles name="stNormal2" fontFamily="Times New Roman" fontSize="20" color="#FF0000"/>
		<styles name="stOvered2" fontFamily="Times New Roman" fontSize="20" color="#00FF00"/>
		<styles name="stSelected2" fontFamily="Times New Roman" fontSize="20" color="#0000FF"/>
		<script><![CDATA[
			this.rows = new Array();
			this.padding = 2;
			this.paddingX = 3;
			this.paddingY = -2;
			this.curRow = null;
			this.rowsHeight = new Array();
			this.cellsWidth = new Array();
			this.fonImgs = new Array("rmgr:fConstruct/table/stNormal.png","rmgr:fConstruct/table/stNormal.png","rmgr:fConstruct/table/stSelect.png");
			this.arrCellStyles = null;

		function Centred(centerX,ailgnY)
			{
				this.x = centerX - this.width/2;
				this.y =  ailgnY - 20 - this.height;
			}


		function addRow(arrCells)
			{
				var newRow = new Composition();
				newRow._class = "cItemRow";
				newRow.name = "row_" +this.rows.length;
				newRow.parent = this;
				newRow.addCells(arrCells);
				this.rows.push(newRow);
				return newRow;
			}

			function getFormula(arr)
			{
				var formula ="";
				for (var i=0; i<arr.length; i+=3)
				{
					if (arr[i+2]!="1" )
						formula += arr[i] + "<sub>" + arr[i+2] +"</sub>";
					else
						formula += arr[i];
				}
				return formula;
			}

			function setTitle(row)
			{
				for (var i=0; i<row.cells.length; i++)
				{
					row.cells[i].txCaption.style = row.parent.stTitle;
					row.cells[i].txCaption.visible = true;
					row.cells[i].fon.srcArr =this.fonImgs;
				}
				row.enabled = false;
			}



			function init(arrRows)
			{
				this.arrCellStyles = new Array([this.stNormal1,this.stOvered1,this.stSelected1],[this.stNormal2,this.stOvered2,this.stSelected2]);
				var newRow = addRow(["Название вещества","Формула"]);
				setTitle(newRow);
 				for (var i=0; i<arrRows.length; i++)
 					{
						var arrCells = arrRows[i];
						var newRow = addRow(arrCells);
						newRow.data = arrCells[1];
						newRow.cells[1].txCaption.value = getFormula(arrCells[1]);
						newRow.setRowStyle(this.fonImgs,this.arrCellStyles);
					}
				if (this.cellsWidth.length != 0)
					setSize(true,false);
				else
					setSize(true,true);
				this.visible = true;
			}

			function setSize(setHeight,setWidth)
			{
				if (setHeight||setWidth)
					{
						for (var i=0; i< this.rows.length; i++)
							{
								var row =this.rows[i];
								for (var j=0; j< row.cells.length; j++)
									{
										var cell = row.cells[j];
										if (setWidth)
											{
												var w = cell.txCaption.getMediaSize().width + 2*this.paddingX;
												if (this.cellsWidth.length<=j)
													this.cellsWidth[j] =w ;
												else
													if (this.cellsWidth[j]<w)
														this.cellsWidth[j]=w;
											}
										if (setHeight)
											{

												var h = cell.txCaption.getMediaSize().height + 2*this.paddingY;
												if (this.rowsHeight.length<=i)
													this.rowsHeight[i] =h ;
												else
													if (this.rowsHeight[i] < h)
														this.rowsHeight[i] =h;
											}
									}
							}

						for (var i=0; i< this.rows.length; i++)
							{
								var row =this.rows[i];
								var x = 0;
								for (var j=0; j< row.cells.length; j++)
									{
										var cell = row.cells[j];
										if (j!=0)
											{
												if (i!=0) cell.txCaption.visible = false;
												cell.x = row.cells[j-1].x +this.cellsWidth[j-1] - 1;
											}
										cell.cellInit(this.cellsWidth[j],this.rowsHeight[i]);
									}
								if (i!=0) row.y = this.rows[i-1].y +this.rowsHeight[i-1] - 1;
							}

					}
			}
		function setFinish()
			{
				for (var i=0; i<this.curRow.cells.length; i++)
					{
						this.curRow.cells[i].txCaption.visible = true;
					}
			}

			function rowSelect()
				{
					//trace("rowSelect");
				}

		]]></script>
	</composition>

	<composition name="cBorderComp" visible="false" depth="-100">
		<image name="anOverHorz1" src="rmgr:fConstruct/border.png"/>
		<image name="anOverHorz2" src="rmgr:fConstruct/border.png"/>
		<image name="anOverVert1" src="rmgr:fConstruct/border.png"/>
		<image name="anOverVert2" src="rmgr:fConstruct/border.png"/>
		<script>
		this.anOverHorz1.crop(0,0,2,2);
		this.anOverHorz2.crop(0,0,2,2);
		this.anOverVert1.crop(0,0,2,2);
		this.anOverVert2.crop(0,0,2,2);
		function borderCreate(x,y,w,h){

				this.anOverHorz1.x = x;
				this.anOverHorz1.y = y;
				this.anOverHorz1.width =w+2;

				this.anOverVert1.x = x;
				this.anOverVert1.y = y;
				this.anOverVert1.height=h+2;

				this.anOverHorz2.x = this.anOverHorz1.x+2;
				this.anOverHorz2.y = this.anOverHorz1.y+this.anOverVert1.height-2;
				this.anOverHorz2.width =w+1;

				this.anOverVert2.x = this.anOverVert1.x+this.anOverHorz2.width;
				this.anOverVert2.y = this.anOverVert1.y;
				this.anOverVert2.height=h+2;
			}
	</script>
	</composition>

	<!--кнопка с выделением-->
	<button name="cOverButton">
		<script event="onRollOver">
 			this.funcOnOver(true,this);
		</script>
		<script event="onRollOut">
 			this.funcOnOver(false,this);
	</script>
		<script event="onPress">
			parent.borderComp.hide();
	</script>
		<script><![CDATA[
			function funcOnOver(bflag,curButton){
				if (bflag){
					var myHitArea=ParseString(curButton.hitArea);
					parent.borderComp.borderCreate(myHitArea[0],myHitArea[1],myHitArea[2],myHitArea[3]);
				}
				parent.borderComp.visible=bflag;
			}

			function ParseString(SomeString)
					{
						_f = SomeString.split("[");
						ParseArray=_f[1].split(",");
						var tempVar = ParseArray[3];
						var _tempVar = tempVar.split("]");
						ParseArray[3] = _tempVar[0];

						// преобразование типов
						ParseArray[0]=parseInt(ParseArray[0]);
						ParseArray[1]=parseInt(ParseArray[1]);
						ParseArray[2]=parseInt(ParseArray[2]);
						ParseArray[3]=parseInt(ParseArray[3]);
						// преобразование типов
						return ParseArray;
			}

	]]></script>
	</button>
	<!--таблица Менделеева с горячими зонами-->
	<composition name="cTMendeleev">
		<image name="fon" src="rmgr:fConstruct/table.png"/>
		<composition name="borderComp" class="cBorderComp" visible="false" depth="-100"/>
		<script><![CDATA[
			this.arrBut = new Array();
			this.params = new Array(24,19,37,29);
			this.arrOfTElems = new Array(["H<sub>2</sub>",0,0],["He",9,0],
															["Li",0,1],["Be",1,1],["B",2,1],["C",3,1],["N",4,1],["O",5,1],["F",6,1],["Ne",9,1],
															["Na",0,2],["Mg",1,2],["Al",2,2],["Si",3,2],["P",4,2],["S",5,2],["Cl",6,2],["Ar",9,2],
															["K",0,3],["Ca",1,3],["Sc",2,3],["Ti",3,3],["V",4,3],["Cr",5,3],["Mn",6,3],["Fe",7,3],["Co",8,3],	["Ni",9,3],
															["Cu",0,4],["Zn",1,4],["Ga",2,4],["Ge",3,4],["As",4,4],["Se",5,4],["Br",6,4],["Kr",9,4],
															["Rb",0,5],["Sr",1,5],["Y",2,5],["Zr",3,5],["Nb",4,5],["Mo",5,5],["Tc",6,5],["Ru",7,5],["Rh",8,5],["Pd",9,5],
															["Ag",0,6],["Cd",1,6],["In",2,6],["Sn",3,6],["Sb",4,6],["Te",5,6],["I",6,6],["Xe",9,6],
															["Cs",0,7],["Ba",1,7],["La",2,7],["Hf",3,7],["Ta",4,7],["W",5,7],["Re",6,7],["Os",7,7],["Ir",8,7],["Pt",9,7],
															["Au",0,8],["Hg",1,8],["Tl",2,8],["Pb",3,8],["Bi",4,8],["Po",5,8],["At",6,8],["Rn",9,8],
															["Fr",0,9],["Ra",1,9],["Ac",2,9],["Rf",3,9],["Db",4,9],["Sg",5,9],["Bh",6,9],["Hs",7,9],["Mt",8,9],["Ds",9,9],
															["Rg",0,10],["Uub",1,10],["Uut",2,10]);
			function createButtons()
				{
					var num = arrOfTElems.length;
					if (this.smallVariant) num= 36;
					for( i=0; i<num; i++)
						{
							var butParams = arrOfTElems[i];
							var but=new Button();
							but._class="cOverButton";
							but.name="chemEl_l"+i;
							but.depth="-30";
							but.data = butParams[0];
							but.enabled=true;
							but.hitArea   ="["+(params[0]+params[2]*butParams[1]) + ","+(params[1]+params[3]*butParams[2]) + ","+(params[2]+","+params[3])+"]";
							but.parent=this;
							this.arrBut.push(but);
 							but.onPress = function(){
								this.parent.pressElement(this.data);
 								}
						}
				}
			function pressElement(elemData)
				{
					parent.elemStapel.elemforDrag.elemName.value = elemData;
					parent.elemStapel.elemforDrag.elemName.style = parent.elemStapel.styleDragEl;
					parent.elemStapel.elemforDrag.data = elemData;
					parent.objDrag.startDrag(parent.elemStapel.elemforDrag);
					parent.elemStapel.elemforDrag.elemName.value ="";
				}
		]]></script>
	</composition>

	<composition name="cAnionsAndKations">
		<composition name="fon" class="CResizablePaper"/>
		<composition name="borderComp" class="cBorderComp" visible="false" depth="-100"/>
		<styles  name="txtStyle" fontFamily="Arial" fontSize="16"  fontWeight="bold" color="#000066"/>
		<script><![CDATA[
			fon.init("rmgr:fConstruct/anionsfon.png", 1, 1, 1, 1);
			//регулируемые параметры
			this.paddingX =2;
			this.paddingY =4;
			this.top =5;
			this.allign = "center";
			//при желании регулируемые величины
			this.w = 360;
			this.h = 80;
			this.numColl = 0;
			this.arrOfTElems = new Array();
			this.left =5;
			this.dx = 2;// погрешность на ширину рамки выделяемоой области
			//нерегулируемые величины
			this.cellHeight =0;
			this.cellWith =0;
			this.left =5;
			this.arrButs =new Array();
			this.txts = new Array();

			function createButtons()
				{
					this.cellHeight = 0
					this.cellWith = 0
					fon.resize(this.w,this.h);
					for( i=0; i<this.arrOfTElems.length; i++)
						{
							if (txts.length<=i)
								{
									var txt = new Text();
									txt.name="txt"+i;
									txt.style = this.txtStyle;
									txt.parent=this;
									this.txts.push(txt);
								}
							this.txts[i].value = this.arrOfTElems[i];
							var hCell = this.txts[i].getMediaSize().height;
							var wCell = this.txts[i].getMediaSize().width;
							if (hCell > this.cellHeight) this.cellHeight=hCell;
							if (wCell > this.cellWith) this.cellWith=wCell;
						}
					if (this.numColl!=0)
						{
							this.cellWith = this.w/this.numColl;
						}
					else
						{
							this.cellWith += 2*this.paddingX;
							this.numColl = Math.floor((w-2*this.left)/this.cellWith);
						}
					this.cellHeight += 2*this.paddingY;
					this.numRow = Math.ceil(arrOfTElems.length/this.numColl) ;
					if (this.arrOfTElems.length<this.numColl)
						{
							this.numColl = this.arrOfTElems.length;
							this.left = Math.floor((this.w- this.cellWith*this.numColl)/2);
						}
					else
						{
							this.left  =(this.w - this.cellWith * this.numColl)/2 - this.dx ;//учитываем ширину рамки
						}

					for( i=0; i<txts.length; i++)
						{
							var nRow = Math.floor(i/this.numColl);
							var  nCol= i - this.numColl*nRow;
							this.txts[i].y = this.top + this.paddingY + nRow*this.cellHeight;
							this.txts[i].x = this.left + nCol*this.cellWith ;
							if (txts[i].value!="")
								{
									var hitArea = "[" +this.txts[i].x  + ","+( this.txts[i].y - this.paddingY)+","+this.cellWith+","+this.cellHeight+"]";
									createButton(i,this.txts[i].value,hitArea);
								}
							else
									createButton(i,this.txts[i].value,"[0,0,0,0]");
							switch(this.allign)
								{
									case "left":{
											txts[i].x += this.paddingX;
										}break;
									case "center":{
											txts[i].x += (this.cellWith-txts[i].getMediaSize().width)/2;
										}break;
									case "right":{
											txts[i].x += this.cellWith-txts[i].getMediaSize().width - this.paddingX ;
										}break;
								}
						}
						this.visible =true;
				}

			function createButton(i,data,hitAr)
				{
					if (this.arrButs.length<=i)
						{
							var but=new Button();
							but._class="cOverButton";
							but.name="ion_"+i;
							but.depth="-30";
							but.parent=this;
							this.arrButs.push(but);
							but.onPress = function(){
										this.parent.pressElement(this.data);
								}
						}
					this.arrButs[i].data = data;
					this.arrButs[i].hitArea  = hitAr;
					this.arrButs[i].enabled=true;
				}

			function pressElement(elemData)
				{
					parent.elemStapel.elemforDrag.elemName.value = elemData;
					parent.elemStapel.elemforDrag.elemName.style = parent.elemStapel.styleDragEl;
					parent.elemStapel.elemforDrag.data = elemData;
					parent.objDrag.startDrag(parent.elemStapel.elemforDrag);
					parent.elemStapel.elemforDrag.elemName.value ="";
				}
		]]></script>
	</composition>


	<composition name="cLevelOxidation">
		<image name="fon" src="rmgr:fConstruct/level_oxi.png"/>
		<composition name="borderComp" class="cBorderComp" visible="false" depth="-100"/>
		<script><![CDATA[
			this.params = new Array(10,-1,29,27);
			this.arrBut = new Array();
			this.arrOfTElems = new Array("-4","-3","-2","-1","+1","+2","+3","+4","+5","+6","+7");
			this.delta = new Array(0,0,0,0,5,5,5,5,5,5,5);
			function createButtons()
				{
					var left = params[0];
					for( i=0; i<arrOfTElems.length; i++)
						{
							var but=new Button();
							but._class="cOverButton";
							but.name="level"+i;
							but.data = arrOfTElems[i];
							but.depth="-30";
							but.enabled=true;
							var s = params[2] + delta[i];
							but.hitArea   ="["+left + ","+params[1] + ","+s+","+params[3]+"]";
							 left += s;
							but.parent=this;
							this.arrBut.push(but);
 							but.onPress = function(){
								this.parent.pressElement(this.data);
 								}
						}
				}
			function pressElement(elemData)
				{
					parent.elemStapel.elemforDrag.elemName.value = elemData;
					parent.elemStapel.elemforDrag.data = elemData;
					parent.elemStapel.elemforDrag.elemName.style = parent.elemStapel.styleDragLev;
					parent.objDrag.startDrag(parent.elemStapel.elemforDrag);
					parent.elemStapel.elemforDrag.elemName.value ="";
				}
		]]></script>
	</composition>

	<composition name="cOverTextComp" class="cOverComp">
		<text name="txt" depth="-1"/>
		<script>
			this.srcArr = new Array ("rmgr:fConstruct/overComp/stNormal.png","rmgr:fConstruct/overComp/stOver.png","rmgr:fConstruct/overComp/stSelect.png");
		</script>
	</composition>

	<composition name="cCmpAnsw">
		<text name="txt"/>
		<text name="txt_ind"/>
		<text name="txt_egual" value="="/>
		<composition name="fon" class="CResizablePaper" depth="0" />
		<composition name="XEl" class="CResizablePaper" depth="-10" />
		<input name="inp" width="26" height="18" depth="+1">
			<script>
				this.data = null;
			</script>
			<script event="onKeyDown"><![CDATA[
				ascii = Key.getAscii();
				if (this.visible&&this.enabled)
				{
					if (ascii == 27)
					{
						this.value = "";
					}
					else if (ascii == 13)
					{
						if (this.parent.data == this.value)
							{
								this.visible = false;
								parent.rightAnsw();
							}
						else
							{
								this.value = "";
								parent.badAnsw();
							}
					}
				}
			]]></script>
		</input>
		<script>
			this.fon.init("rmgr:fConstruct/input.png",2,2,2,2);
			this.XEl.init("rmgr:fConstruct/xel.png",1,1,1,1);
			this.h =36;
			this.w = 36;
			this.XEl.resize(this.w,this.h);
		</script>
		<script>
			function rightAnsw()
				{
						this.fon.visible = false;
						this.parent.parent.nextStep();
				}
			function badAnsw()
				{
						this.parent.parent.txtInstruction.sayExplanation();
				}


			function init(tx,data,arrStyles,vis)
				{
					if (arrStyles!=null)
						{
							this.txt.style = arrStyles[0];
							this.txt_egual.style = arrStyles[1];
							this.txt_ind.style = arrStyles[2];
						}
					if (!vis)
						{
							this.txt_egual.value = "";
						}					this.fon.visible = true;
					this.XEl.visible = false;
					this.fon.resize(this.inp.width+8,this.inp.height+8);
					this.data = data;
					this.inp.value = "";
					this.inp.depth = +1;
					this.txt.value =tx;
					this.txt_ind.value = data;
					this.txt_egual.x = - this.txt_egual.getMediaSize().width - this.parent.padding;
					this.txt.x = this.txt_egual.x - this.txt.getMediaSize().width - this.parent.padding;
					this.fon.x = this.inp.x -3;
					this.XEl.x =  this.txt_egual.x - this.XEl.width - this.parent.padding;
					this.txt_egual.y = (this.h - this.txt_egual.getMediaSize().height)/2;
					this.txt_ind.y = (this.h - this.txt_ind.getMediaSize().height)/2;
					this.txt.y = (this.h - this.txt.getMediaSize().height)/2;
					this.inp.y = (this.h - this.inp.getMediaSize().height)/2;
					this.fon.y = (this.h - this.fon.height)/2;
					if (vis)
						{
							this.XEl.visible = false;
							this.txt.visible =true;
						}
					else
						{
							this.XEl.visible = true;
							this.txt.visible =false;
						}
				}

			function setVisible()
				{
					this.txt.visible = true;
					this.XEl.visible = false;
				}
		</script>
	</composition>


	<composition name="cFConstruct">
		<composition name="tableAppelation" class="cTableBase" x="610" y="40">
			<styles name="stNormal1" fontFamily="Arial" fontSize="16" fontWeight="bold" color="#000066"/>
			<styles name="stOvered1" fontFamily="Arial" fontSize="16" fontWeight="bold" color="#0000b4"/>
			<styles name="stSelected1" fontFamily="Arial" fontSize="16" fontWeight="bold" color="#000066"/>
			<styles name="stTitle" fontFamily="Arial" fontSize="16" fontWeight="bold" color="#000056"/>
			<styles name="stNormal2" fontFamily="Times New Roman" fontSize="16" fontWeight="bold" color="#000066"/>
			<styles name="stOvered2" fontFamily="Times New Roman" fontSize="16" fontWeight="bold" color="#0000b4"/>
			<styles name="stSelected2" fontFamily="Times New Roman" fontSize="16" fontWeight="bold" color="#000066"/>
			<script><![CDATA[
				this.centerX =740;
				this.centerX =740;
				this.paddingX = 10;
				this.paddingY = -2;
				this.fonImgs = new Array("rmgr:fConstruct/table/stNormal.png","rmgr:fConstruct/table/stNormal.png","rmgr:fConstruct/table/stSelect.png");
				function rowSelect()
					{
						this.parent.cFConstr.startPose();
						this.parent.cFConstr.startEdit(this.curRow.data);
						this.parent.cFConstr.stuffName.value = this.curRow.cells[0].txCaption.value;
					}
			]]></script>
		</composition>
		<composition name="cFConstr" x="0" y="0">
		<styles name="stTitle1" fontFamily="Arial" fontSize="20" color="#003f75"/>
		<text name="stuffName" style="stTitle1" x="50" y="65" value="Название вещества"/>
		<text name="levelOxi" style="stTitle1" x="50" y="245" value="Степень окисления:"/>
		<composition x="535" y="210" name="tableM" class="cTMendeleev">
			<text name="tTitle" x="8" y="-28" value="Периодическая таблица Д.И. Менделеева"/>
			<script><![CDATA[
				this.tTitle.style = this.parent.stTitle1;
				]]>
			</script>
		</composition>
		<composition x="560" y="420" name="tableI" class="cAnionsAndKations" visible="false">
			<text name="ionTitle"  x="-16" y="-30" value="Анионы и катионы:"/>
			<script><![CDATA[
				this.ionTitle.style = this.parent.stTitle1;
				this.paddingX =2;
				this.paddingY =4;
				this.top =5;
				this.left =5;
				this.allign = "center";
				this.w = 360;
				this.h = 110;
				this.arrOfTElems = new Array(
					"PO<sub>4</sub>","SO<sub>3</sub>","SO<sub>4</sub>","CO<sub>3</sub>","NO<sub>3</sub>",
					"HPO<sub>4</sub>","H<sub>2</sub>PO<sub>4</sub>","HCO<sub>3</sub>","","",
					"AlOH","Al(OH)<sub>2</sub>","CaOH","CuOH");	]]>
			</script>
		</composition>
		<composition x="65" y="275" name="lOxi" class="cLevelOxidation"/>
		<text name="stuffName" style="stTitle1" x="50" y="65"/>
		<composition name="objDrag" class="CDragDrop"/>
		<composition name="elemState" class="CResizablePaper" x="70" y="100" visible="true">
			<script>
				init("rmgr:fConstruct/stapel.png", 1, 1, 1, 1);
				this.resize(210,120);
			</script>
		</composition>
		<composition name="elemCalc" x="275" y="360">
			<styles name="stTitle1" fontFamily="Arial" fontSize="20" color="#003f75"/>
			<text name="nokTitle" style="stTitle1" x="-225" y="-35" value="Наименьшее общее кратное:"/>
			<text name="indxTitle" style="stTitle1" x="-225" y="40" value="Индексы элементов:"/>
			<styles name="eqStyle" fontFamily="Arial" fontSize="25" color="#000000"/>
			<styles name="txStyle" fontFamily="Arial" fontSize="18" color="#000066"/>
			<styles name="indStyle" fontFamily="Arial" fontSize="18" color="#000000"/>
			<styles name="txElStyle" fontFamily="Times New Roman" fontSize="30" fontWeight="bold" color="#00639C"/>
			<script>
				this.padding=5;
				this.topIndex=75;
				this.dY=40;
				this.arrIndex = new Array();
				this.dataArr = new Array();
			</script>
			<script><![CDATA[
				function initCalc(data)
					{
						this.dataArr  = data;
						if (this.arrIndex.length ==0)
							{
								var obj = new Composition();
								obj._class = "cCmpAnsw";
								obj.name = "nok";
								obj.parent = this;
								this.arrIndex.push(obj);
								this.arrIndex[0].init("НОК", Math.abs(data[1]*data[2]),[this.txStyle,this.eqStyle,this.indStyle],true);
							}
						else
							this.arrIndex[0].init("НОК", Math.abs(data[1]*data[2]),null,true);
						this.arrIndex[0].inp.visible = true;
						this.arrIndex[0].enabled = false;
						for (var i=0; i<data.length;i+=3)
							{
								var dt = data[i];
								if (data[i].charAt(0)=="(")
									dt = dt.substr(1, data[i].length-2)
								if (this.arrIndex.length<=(i/3+1))
									{
										var obj = new Composition();
										obj._class = "cCmpAnsw";
										obj.name = "inpcCmp_"+i/3;
										obj.parent = this;
										obj.y = (i/3)*this.dY+ this.topIndex;
										this.arrIndex.push(obj);
										this.arrIndex[i/3+1].init(dt,data[i+2],[this.txElStyle,this.eqStyle,this.indStyle],false);
									}
								else
									this.arrIndex[i/3+1].init(dt,data[i+2],null,false);
								this.arrIndex[i/3+1].enabled = false;
								this.arrIndex[i/3+1].inp.visible = true;
							}
					}

				function showElCalc(data)
					{
						for (var i=0; i<dataArr.length;i+=3)
							{
							if (this.dataArr[i].indexOf(data)!=-1)
								this.arrIndex[i/3+1].setVisible();
							}
					}

				initCalc(["X",0,0,"X",0,0]);
			]]></script>
		</composition>
		<composition name="elemStapel" x="300" y="300">
			<styles name="stEl" fontFamily="Times New Roman" fontWeight="bold" fontSize="48" color="#000066"/>
			<styles name="stElIndx" fontFamily="Times New Roman" fontSize="28" fontWeight="bold" color="#000066"/>
			<styles name="stElLev" fontFamily="Times New Roman" fontWeight="bold" fontSize="21" color="#A23500"/>
			<styles name="styleDragEl" fontFamily="Times New Roman" fontWeight="bold" fontSize="48" color="#000066"/>
			<styles name="styleDragLev" fontFamily="Times New Roman" fontWeight="bold" fontSize="21" color="#A23500"/>
			<styles name="styleMoveIndx" fontFamily="Times New Roman" fontSize="28" fontWeight="bold" color="#000066"/>
			<composition	name="elemforDrag">
				<text name="elemName" style="styleDragEl"/>
				<script>
					this.data = "";
				</script>
			</composition>
			<script>
				this.formulaElems = new Array();
				this.dataModel = null;
				this.fixedHEl =60;
				this.fixedHLev =25;
				this.stapType = "simple";
				this.curObj = null;
			</script>
			<script><![CDATA[
				function onSetText(obj)
					{
						this.curObj = obj;
						seq_rePosAndNextStep.rewindAndPlay();// секвенсeр с задержкой, а то не успевает соображать
					}
				function sayExplanation()
					{
						this.parent.txtInstruction.sayExplanation();
					}

				function sayWarning(num)
					{
						this.parent.txtInstruction.sayWarning(num);
					}

				function newEl(i)
					{
						var obj=new Composition();
						obj._class="cOverTextComp";
						obj.parent = this;
						obj.txt.style = this.stEl;
						obj.name = "elemChem"+i/3;
						this.typeEl = "simple";
						this.formulaElems.push(obj);
						obj.depth = -30;
						obj.onDrop = function(ob, x, y)
							{
								if (!this.txt.visible)
									{
										var flag = false;
										for (var i=0; i<this.parent.formulaElems.length; i+=3)
											{
												if (ob.data == this.parent.formulaElems[i].data)
														flag = true;
											}
										if (this.parent.stapType == "simple")
											{
												if (this.data==ob.data)
													{
														this.txt.value = this.data;
														this.txt.visible = true;
														this.parent.onSetText(this);
														this.enabled = false;
														this.imNormal.visible = false;
													}
												else
													{
														if (flag&&this.parent.parent.iStep==1)
															this.parent.sayExplanation();
													}
												if (!flag)
													this.parent.sayWarning(0);
											}
										else
											{
												if (this.data==ob.data)
													{
														this.txt.value = this.data;
														this.txt.visible = true;
														this.parent.onSetText(this);
														this.enabled = false;
														this.imNormal.visible = false;
													}
												else
													{
														if (flag)
															this.parent.sayWarning(0);
														else
															this.parent.sayExplanation();
													}
											}

									}
							}
						return obj;
					}

				function newLevelEl (i)
					{
						obj=new Composition();
						obj._class="cOverTextComp";
						obj.parent = this;
						obj.txt.style = this.stElLev;
						obj.name = "elemLev"+i/3;
						this.formulaElems.push(obj);
						obj.onDrop = function(ob, x, y)
							{
								if (!this.txt.visible)
									{
										if (this.data==ob.data)
											{
												this.txt.visible = true;
												this.enabled = false;
												this.parent.onSetText();
												this.imNormal.visible = false;
											}
										else
											this.parent.sayExplanation();
									}
							}
						return obj;
					}

				function newIndexlEl (i)
					{
						this.formulaElems.push(null);//раньше вставлялся элемент, теперь его не стало, но его ьуто оставим незанятым
					}

				function createModel(data)
					{
						this.dataModel = data;
						var leftX =0;
						for (var i=0; i<data.length;i+=3)
							{
								var objEl, objLevelEl,objIndexEl;
								if (this.formulaElems.length<=i)
									{
										objEl = newEl (i);
										objLevelEl = newLevelEl (i);
										objIndexEl = newIndexlEl (i);
									}
								else
									{
										objEl = this.formulaElems[i];
										objEl.imNormal.visible = true;
										objLevelEl = this.formulaElems[i+1];
										objLevelEl.imNormal.visible = true;
									}

								if (data[i].charAt(0)=="(")
									{
										objEl.data = data[i].substr(1, data[i].length-2);
										objEl.typeEl = "complex";
									}
								else
									{
										objEl.data = data[i];
										objEl.typeEl = "simple";
									}
								//trace(data[i]+" typeEl = "+objEl.typeEl);
								objEl.txt.value = data[i];
								var h = objEl.txt.getMediaSize().height;
								var w = objEl.txt.getMediaSize().width;
								objEl.txt.visible = false;
								if (this.fixedHEl!=0) objEl.init(this.fixedHEl,this.fixedHEl); else objEl.init(h,h);
								objEl.enabled = true;
								leftX += w;
										////
								objLevelEl.data = data[i+1];
								if (data[i+1]>0)
									objLevelEl.txt.value ="+" + data[i+1];
								else
									objLevelEl.txt.value ="" + data[i+1];
								var h = objLevelEl.txt.getMediaSize().height;
								var w = objLevelEl.txt.getMediaSize().width;
								if (this.fixedHLev!=0) objLevelEl.init(this.fixedHLev,this.fixedHLev); else objLevelEl.init(h,h);
								objLevelEl.y = - h/3;
								objLevelEl.imNormal.visible = true;
								objLevelEl.txt.visible = false;
								objLevelEl.visible = false;
								objLevelEl.enabled = true;
								leftX += w;
							}
						//this.x = this.parent.elemState.x + (this.parent.elemState.width-leftX)/2;
						this.resetPos();
						this.x = this.parent.elemState.x + (this.parent.elemState.width-this.width)/2;
						this.y = this.parent.elemState.y + (this.parent.elemState.height-this.height)/2;
					}

				function resetPos()
					{
						for (var i=1; i<this.formulaElems.length;i++)
							{
								if (this.formulaElems[i]!=null)
									{
										if (this.formulaElems[i-1]!=null)
											{
												this.formulaElems[i].x = this.formulaElems[i-1].x +this.formulaElems[i-1].width;
												//trace("#00FF00resetPos "+i-1 +" width = "+this.formulaElems[i-1].width);
											}
										else
											this.formulaElems[i].x = this.formulaElems[i-2].x +this.formulaElems[i-2].width;
									}
							}
					}

			]]></script>
			<sequencer name="seq_rePosAndNextStep">
				<script>
					200;
				</script>
				<script>
					resetPos();
					parent.nextStep(this.curObj);
				</script>
			</sequencer>
		</composition>
		<composition name="txtHint" class="CHint" x="200" y="540" visible="true">
			<text name="itext" width="600"/>
			<script>
				this.hints =new Array("Соблюдая предложенный порядок действий, научитесь составлять химические формулы средних солей.",
									"Запишите рядом знаки химических элементов. ",
									"Проставьте их степени окисления",
									"Определите для них наименьшее общее кратное (НОК).",
									"Найдите индексы и составьте химическую формулу вещества.");
			</script>
			<script>
				function nextHint(n)
					{
						itext.value = this.hints[n];
					}
			</script>
		</composition>
		<composition name="txtInstruction" visible="true">
		<!--	<audio name="sound1" src="rmgr:fConstruct/sound/01a.mp3"/>
			<audio name="sound1e" src="rmgr:fConstruct/sound/01b.mp3"/>
			<audio name="sound2" src="rmgr:fConstruct/sound/02a.mp3"/>
			<audio name="sound2e" src="rmgr:fConstruct/sound/02b.mp3"/>
			<audio name="sound3" src="rmgr:fConstruct/sound/03a.mp3"/>
			<audio name="sound3e" src="rmgr:fConstruct/sound/03b.mp3"/>
			<audio name="sound4" src="rmgr:fConstruct/sound/04a.mp3"/>
			<audio name="sound4e" src="rmgr:fConstruct/sound/04b.mp3"/>
			<audio name="soundWarning0" src="rmgr:fConstruct/sound/01a.mp3"/>-->
			<script><![CDATA[
				this.audioInstructions = new Array();
				this.arrErrors = new Array();
				this.warningAudio = new Array();
				//this.audioInstructions = new Array(sound1,sound1,sound2,sound3,sound4);
				//this.arrErrors = new Array(null,sound1e,sound2e,sound3e,sound4e);
				//this.warningAudio = new Array(soundWarning0);
				for (var i=0;i<this.audioInstructions.length;i++)
				{
					if (this.audioInstructions[i]!=null)
						{
							this.audioInstructions[i].instrClould = this;
							this.audioInstructions[i].onPlayed = function()
								{
									this.instrClould.unfocus();
								}
						}
				}
				this.paddingY = 10;
				this.instructions =new Array("Выберете название вещества из таблицы",
									"Запишите рядом знаки химических элементов. ",
									"Проставьте их степени окисления",
									"Определите для них наименьшее общее кратное (НОК).",
									"Найдите индексы и составьте химическую формулу вещества.");

				this.curInstr = 0;
				this.curCloud = 0;
				this.defClParam = new Array("RT",290,80,190);
				var arrClass = new Array ("RBLittleCloud","RTLittleCloud",
														"TLLittleCloud","TRLittleCloud",
														"BLLittleCloud","BRLittleCloud",
														"LBLittleCloud","LTLittleCloud");
				this.txtClouds = new Array();
				var arrClParam = new Array (["LB",-1,70,190],["RT",-2,80,190],["RT",-2,80,190],["RB",322,373,190],["RT",322,385,190]);

				function initClouds()
					{
 						for (var i=0; i<arrClass.length;i++)
 							{
  								var obj=new Composition();
  								obj._class=arrClass[i];//"RBLittleCloud";
								obj.name = arrClass[i].substr(0,2);
  								obj.parent = this;
  								obj.visible = false;
  								this.txtClouds.push(obj);
								obj.depth = -30;
 							}
 					}
				function nextInstruction (isSound)
					{
						if (this.curInstr>=this.instructions.length)
							this.curInstr = 0;
						var cloudPar = this.arrClParam[this.curInstr];
						switch (cloudPar[1])
							{
								case -1: cloudPar[1] = parent.parent.tableAppelation.x - cloudPar[3] -10;break;
								case -2: cloudPar[1] = parent.elemState.x + parent.elemState.width+5;break;
							}
						//trace("cloudParams!!!!!!!! ----"+cloudPar);
						this.txtClouds[this.curCloud].visible = false;
						switch (cloudPar[0])
							{
								case "RB":this.curCloud = 0;break;
								case "RT":this.curCloud = 1;break;
								case "TL":this.curCloud = 2;break;
								case "TR":this.curCloud = 3;break;
								case "BL":this.curCloud = 4;break;
								case "BR":this.curCloud = 5;break;
								case "LB":this.curCloud = 6;break;
								case "LT":this.curCloud = 7;break;
								default:this.curCloud = 0;break;
							}
						var cl = this.txtClouds[this.curCloud];
						cl.visible = true;
						cl.x = cloudPar[1];
						cl.y = cloudPar[2];
						cl.InnerText.value = this.instructions[this.curInstr];
						cl.InnerText.width = cloudPar[3];
						cl.InnerText.height = cl.InnerText.getMediaSize().height + this.paddingY*2;
						cl.init();
						if  (this.audioInstructions[this.curInstr]!=null&&isSound)
							{
								this.audioInstructions[this.curInstr].rewindAndPlay();
								cl.focus();
							}
						parent.txtHint.nextHint(this.curInstr);
						this.curInstr++;
					}

					function playAudioInstuction()
						{
							this.audioInstructions[this.curInstr-1].rewindAndPlay();
							this.txtClouds[this.curCloud].focus();
						}


					function sayExplanation()
						{
							if (this.arrErrors[this.curInstr-1]!=null)
								{
									scene.fireEvent("allSoundsStop");
									for (var i=0;i<this.audioInstructions.length;i++)
										if (this.audioInstructions[i]!=null) this.audioInstructions[i].stop();
									if (!this.arrErrors[this.curInstr-1].playing)
										{
											for (var i=0;i<this.arrErrors.length;i++)
												if (this.arrErrors[i]!=null) this.arrErrors[i].stop();
											this.arrErrors[this.curInstr-1].rewindAndPlay();
										}
								}
						}

					function	sayWarning(num)
					{
						scene.fireEvent("allSoundsStop");
						//trace("sayWarning");
 						for (var i=0;i<this.audioInstructions.length;i++)
 							if (this.audioInstructions[i]!=null) this.audioInstructions[i].stop();
						if (num != -1)
							{
								if (!this.arrErrors[this.curInstr-1].playing&&!this.warningAudio[num].playing)
									{
										for (var i=0;i<this.arrErrors.length;i++)
											if (this.arrErrors[i]!=null) this.arrErrors[i].stop();
										this.warningAudio[num].rewindAndPlay();
									}
							}
						else
							{
								for (var i=0;i<this.arrErrors.length;i++)
									if (this.arrErrors[i]!=null) this.arrErrors[i].stop();
								scene.finishAudio.rewindAndPlay();
							}
					}



					function unfocus()
						{
							this.txtClouds[this.curCloud].unfocus();
						}
					]]>
			</script>
			<script>

			</script>
		</composition>
		<script>
			this.iStep = 0;
			this.timeInterval = null;
			this.objMovie =new Array();
			this.countMovie = 0;
			this.constrType ="simple";//"complex";
		</script>
		<script><![CDATA[
		function indexMovie()
			{
				for (var i=0;i<objMovie.length;i++)
					{
						objMovie[i].realX +=objMovie[i].dx;
						objMovie[i].realY +=objMovie[i].dy;
						objMovie[i].x = objMovie[i].realX;
						objMovie[i].y = objMovie[i].realY;
					}
				this.countMovie--;
				if (this.countMovie==0) stopIndex();
			}
		function srartIndex(count)
			{
				this.countMovie = count;
				for (var i=0;i<objMovie.length;i++)
					{
						objMovie[i].visible =true;
						objMovie[i].dx = (objMovie[i].targetX - objMovie[i].x)/count;
						objMovie[i].dy = (objMovie[i].targetY - objMovie[i].y)/count;
					}
				this.timeInterval = this.setInterval(indexMovie, 100);
			}
		function stopIndex()
			{
				for (var i=0;i<objMovie.length;i++)
					objMovie[i].visible =false;
				if (this.timeInterval!=null) this.clearInterval(this.timeInterval);
				nextStep();
			}
		function initInstructions (arrInstr)
			{
				this.txtInstruction.instructions = arrInstr;
			}
		function startEdit(data)
			{
				this.elemStapel.createModel(data);
				this.elemCalc.visible = true;
				for (var i=0; i <data.length; i+=3)
					{
						var obj = null;
						if ((i/3)>=this.objMovie.length)
							{
								obj = new Text();
								obj.parent = this;
								obj.depth = -100;
								obj.style = this.elemStapel.styleMoveIndx;
								this.objMovie.push(obj);
							}
						else
							{
								obj = this.objMovie[i/3];
							}
						obj.value = data[i+2];
						obj.hide();
						obj.x = elemCalc.x + elemCalc.arrIndex[i/3+1].inp.x;
						obj.realX = obj.x;
						obj.y = elemCalc.y + elemCalc.arrIndex[i/3+1].y;
						obj.realY = obj.y;
						obj.targetX = elemStapel.x + elemStapel.formulaElems[i].x+elemStapel.formulaElems[i].width;
						obj.targetY = elemStapel.y + elemStapel.formulaElems[i].y +elemStapel.formulaElems[i].height/2;
					}
				nextStep();
			}
		function startPose()
			{
				txtInstruction.value="";
				txtInstruction.curInstr = 1;
				for (var i=0; i<elemCalc.arrIndex.length; i++)
					{
						elemCalc.arrIndex[i].value = "";
						elemCalc.arrIndex[i].enabled = false;
					}
 				for (var i=0;i<objMovie.length;i++)
					objMovie[i].visible =false;
				if (this.timeInterval!=null) this.clearInterval(this.timeInterval);
				iStep=0;
			}
		function nextStep(obj)
			{
				switch (iStep)
					{
						case 0:{
								scene.fireEvent("allSoundsStop");
								allSndStop();
								this.elemCalc.initCalc(this.elemStapel.dataModel);
 								txtInstruction.nextInstruction(true);
 								iStep ++;
 							};break;
						case 1:{
								this.elemCalc.showElCalc(obj.data);
								elemStapel.x = elemState.x + (elemState.width-elemStapel.width)/2;
								iStep ++;
							};break;
						case 2:{
								iStep ++;
								this.elemCalc.showElCalc(obj.data);
								allSndStop();
								txtInstruction.nextInstruction(true);
								for (var i=0;i<this.elemStapel.formulaElems.length;i+=3)
									{
										this.elemStapel.formulaElems[i+1].visible =true;
									}
								elemStapel.x = elemState.x + (elemState.width-elemStapel.width)/2;
							};break;
						case 3:{
								iStep ++;
							};break;
						case 4:{
								allSndStop();
								txtInstruction.nextInstruction(true);
								elemCalc.nok.enabled = true;
								elemCalc.nok.inp.depth = -1;
								iStep ++;
							};break;
						case 5:{
								allSndStop();
								txtInstruction.nextInstruction(true);
								iStep ++;
								nextStep();
							};break;
						case 6:{
								var flag = true;
								for (var i=0; i<elemCalc.arrIndex.length; i++)
									{
										if (!elemCalc.arrIndex[i].enabled)
											{
												flag = false;
												elemCalc.arrIndex[i].enabled = true;
												elemCalc.arrIndex[i].inp.depth = -1;
												break;
											}
									}
								if (flag)
									{
										iStep ++;
										nextStep();
									}
							};break;
						case 7:{
								//сюда
								for (var i=0; i <this.objMovie.length; i++)
									{
										this.objMovie[i].targetX = elemStapel.x + elemStapel.formulaElems[i*3].x+elemStapel.formulaElems[i*3].width;
										this.objMovie[i].targetY = elemStapel.y + elemStapel.formulaElems[i*3].y +elemStapel.formulaElems[i*3].height/2;
									}
								srartIndex(30);
								iStep ++;
							};break;
						case 7:{
								srartIndex(30);
								iStep ++;
							};break;
						case 8:{
								allSndStop();
								parent.countEx--;
								parent.tableAppelation.setFinish();
								if (parent.countEx!= 0)
									{
										txtInstruction.nextInstruction(true);
									}
								else
									{
											txtInstruction.hide();
											parent.tableAppelation.enabled = false;
											txtInstruction.sayWarning(-1);
											txtHint.hide();
									}
								var wdth =0;
								for (var i=0;i<elemStapel.formulaElems.length;i+=3)
									{
										if (elemStapel.dataModel[i+2]!=1)
											{
												if (elemStapel.formulaElems[i].typeEl=="complex")
													elemStapel.formulaElems[i].txt.value = "("+elemStapel.formulaElems[i].txt.value+")";
												elemStapel.formulaElems[i].txt.value += "<sub>"+elemStapel.dataModel[i+2]+"</sub>";
											}
										elemStapel.formulaElems[i+1].visible = false;
										if (i!=0)
											elemStapel.formulaElems[i].x = elemStapel.formulaElems[i-3].x + elemStapel.formulaElems[i-3].txt.getMediaSize().width;
										wdth += elemStapel.formulaElems[i].txt.getMediaSize().width;
									}

								elemStapel.x = elemState.x + (elemState.width-wdth)/2;
							};break;
					}
			}
		function allSndStop()
			{
				for (var i=0;i<txtInstruction.audioInstructions.length;i++)
					if (txtInstruction.audioInstructions[i]!=null) txtInstruction.audioInstructions[i].stop();
				for (var i=0;i<txtInstruction.arrErrors.length;i++)
					if (txtInstruction.arrErrors[i]!=null) txtInstruction.arrErrors[i].stop();
			}

			]]></script>
	</composition>
	<script><![CDATA[
		this.countEx = 0;
		function initConstr( arrEl)
			{
				tableAppelation.init(arrEl);
				this.countEx = arrEl.length;
				if (this.constrType == "complex")
					{
						this.cFConstr.tableM.smallVariant = true;
						this.cFConstr.tableM.fon.src="rmgr:fConstruct/smalltable.png";
						initIonSet();
						this.cFConstr.elemStapel.stapType = "complex";
					}
				this.cFConstr.tableM.createButtons();
				this.cFConstr.lOxi.createButtons();
				tableAppelation.Centred(tableAppelation.centerX,this.cFConstr.tableM.y + this.cFConstr.tableM.tTitle.y);
				this.cFConstr.txtInstruction.initClouds();
				this.cFConstr.txtInstruction.nextInstruction(false);
			}


		function initInstructions(arrInsr,arrHints,arrSounds,arrErrors,arrWar)
			{
				//trace("#FF0000initInstruction");
				if (arrInsr!=null)
					this.cFConstr.txtInstruction.instructions = arrInsr;
				if (arrHints!=null)
					this.cFConstr.txtHint.hints =arrHints;
				if (arrSounds!=null)
					{
						for (var i=0;i<arrSounds.length;i++)
							{
								arrSounds[i].instrClould = this.cFConstr.txtInstruction;
								arrSounds[i].onPlayed = function()
									{
										this.instrClould.unfocus();
									}
							}
							this.cFConstr.txtInstruction.audioInstructions = arrSounds;
					}
				if (arrErrors!=null)
					this.cFConstr.txtInstruction.arrErrors = arrErrors;
				if (arrWar!=null)
					this.cFConstr.txtInstruction.warningAudio = arrWar;
			}

		function initIonSet(elems)
			{
					if (elems!=null)
						this.cFConstr.tableI.arrOfTElems =elems;
					if (this.constrType == "complex")
						this.cFConstr.tableI.createButtons();
			}

		function startWork()
			{
				this.cFConstr.txtInstruction.playAudioInstuction();
			}
		function setStapelWidth(wdth)
			{
				this.cFConstr.elemState.resize(wdth,120);
			}
			]]>
	</script>
	</composition>
</rmml>
