<?xml version="1.0" encoding="UTF-8"?>
<rmml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="L:\collaborative-nir\program\Cscl3DWS\rmml\RMML.xsd">
	<composition _name="CAtomsPanel">
		<script><![CDATA[
			this.atomSize = 34;
			this.atoms = new Array();
			this.constAtomNames=new Array(
				"H", "HKt", "Li", "Be", "B", "C", "N", "O", "OM", "F",
				"Na", "Mg", "Al", "Si", "P", "S", "Cl", "K", "Ca","Sc",
				"Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn","Ga",
				"Ge", "As", "Se", "Br", "Ag", "Cd", "Sn", "I", "Ba","Hg",
				"Pb", "LNK");

			function getAtomName(id)
			{
				if( id<0 || id>=this.constAtomNames.length)	return "";
				return this.constAtomNames[id];
			}

			function getAtomID(name)
			{
				var i=0;
				for(; i<this.constAtomNames.length; i++)
				{
					if( name == this.constAtomNames[i])	return i;
				}
				trace("!!!!!!!!!!!!!!      ERROR !!!!!!!!!!!!!!!!!!! [atomsPanel.xml] : " + name);
				return -1;
			}

			function addAtom(name)
			{
				var	atomID = getAtomID(name);
				if( atomID == -1)	return;

				var	imAtom = new Image();
				imAtom.name = "atom" + name;
				imAtom.atom_name = name;
				imAtom.x = 0;
				imAtom.id = atomID;
				imAtom.y = this.atoms.length*this.atomSize;
				imAtom.src = eval('\"' + KMRESPATH + 'atoms/'+name+'.png'+'\"');
				imAtom.onPress = function()
				{
					this.parent.itemSelected( this.id);
				}
				imAtom.parent=this;

				this.atoms.push(imAtom);
			}

			function itemSelected(id)
			{
				parent.atomSelected(id);
			}

			function selectAtom(id)
			{
				var i=0;
				for(;i<this.atoms.length;i++)
				{
					if( this.atoms[i].atom_name == id)
						this.itemSelected(this.atoms[i].id);
				}
			}
		]]></script>
	</composition>
</rmml>