this.reacColor = new Array(
	new Color(255,255,255),
	new Color(255,236,185),
	new Color(252,154,39),
	new Color(184,119,35),
	new Color(0,0,0),
	new Color(255,212,0),
	new Color(250,248,225),
	new Color(172,224,243),
	new Color(0,192,160),
	new Color(36,26,82),
	new Color(194,216,91),
	new Color(71,45,14),
	new Color(46,171,230),
	new Color(47,97,48),
	new Color(200,200,200)
);

function loadReacAnimation(s)
{
	var anim = new Animation;
	anim.src = "rmeq:effects\\"+s+".fln";
	freeNameIdx=0;
	while(eval("scene."+s+freeNameIdx)!=undefined)	freeNameIdx++;
	anim._name = s+freeNameIdx;
	anim._x = 1000;
	//	anim.loop = true;
	anim._parent = scene;
	return anim;
}

function gfReacDissolve(gr, color, ibtime, isubtime, smap)
{
	trace(typeof(color));
	if( typeof(gr.animDissolve) == undefined)
	{
		trace("ERROR: dissolve in non glass equipment");
		return;
	}
	var	obj = gr.obj;
	if(gr.animDissolve == null)
		gr.animDissolve = loadReacAnimation("dissolve");

	var curcolor = null;
	if (typeof(color) == "number")
        	curcolor = this.reacColor[color];
	else
		curcolor = color;
	obj.amap = 254;
	obj.mapr = curcolor.r; obj.mapg = curcolor.g; obj.mapb = curcolor.b;

	if( smap != undefined)	obj.substmap = smap;
	else	obj.substmap = "rmeq:subst\\prsed.png";
	
	//gr.snapshot();
	gr.beginChanges();
	obj.mapanim = gr.animDissolve;
	obj.amap = 240;
	obj.asubst = 0;
	gr.endChanges();

	
	if( gr.seqDissolve == null)
	{
		gr.seqDissolve = new Sequencer;
		gr.seqDissolve._class = "CDissolveSeq";
		gr.seqDissolve._parent = gr;
	}
	gr.seqDissolve.dissolveSubstTime = isubtime;
	gr.seqDissolve.rewindAndPlay();
}

function gfReacSediment(gr, color, level, ibtime, s, wait)
{
	if( color == undefined)	color=0;
	if( level == undefined)	level=10;
	if( ibtime == undefined)	ibtime=0;
	if( s == undefined)	s="";
	if( wait == undefined)	wait=false;
	
	//
	if( typeof(gr.animSediment) == undefined)
	{
		trace("ERROR: sediment in non glass equipment");
		return;
	}
	var	obj = gr.obj;
	if(gr.animSediment == null)
		gr.animSediment = loadReacAnimation("sediment");
		
	obj.mapanim = gr.animSediment;
	obj.amap = 254;
	obj.asubst = 0;
	var curcolor = null;
	if (typeof(color) == "number")
        	curcolor = this.reacColor[color];
	else
		curcolor = color;
	obj.mapr = curcolor.r; obj.mapg = curcolor.g; obj.mapb = curcolor.b;	
	obj.substlevel = 0; 
	obj.blendtime = ibtime;
	
	gr.beginChanges();
		obj.amap = 255;
		obj.asubst = 255;	
		obj.substlevel = level;
		if( s != "")	obj.substmap = s;
		else	obj.substmap = "rmeq:subst\\prsed.png";
	gr.endChanges();
	trace("obj.substmap="+obj.substmap);
	gr.blendnolevel(ibtime);
	gr.animSediment.rewindAndPlay() ;
}