inicializado = false;

posicion = [
	[373, 469],
	[393, 475],
	[376, 575],
	[372, 569],
	[370, 463],
	[330, 446],
	[251, 505],
	[350, 579],
	[251, 407],
	[396, 483],
	[242, 398],
	[297, 485],
	[379, 569],
	[290, 495]
];

lvl = -1;
fx = -1;
fy = -1;
nfx = -1;
nfy = -1;
tmr_f = -1;
tmr_v = -1;
tmr_n = -1;

function Inicializa()
{
	IniciaCapa("flecha", 0, 0);

	if(document.all) flecha.style.filter = "blendTrans(duration=0.25)";

	inicializado = true;
}

function MuestraFlecha(n)
{

	if(inicializado) {
		if(tmr_v != -1) {
			clearTimeout(tmr_v);
			tmr_v = -1;
		}

		if(lvl == -1) {
			if(document.all && flecha.filters.blendTrans.status != 2) {
				flecha.filters[0].Apply();
				MuestraCapa("flecha");
				flecha.filters[0].Play();
			} else {
				MuestraCapa("flecha");
			}
		}

		--n;
		nfx = posicion[n][0] - 4;
		nfy = posicion[n][1] - 4;

		if(lvl == 1) {
			if(tmr_n != -1) clearTimeout(tmr_n);
			tmr_n = setTimeout("NuevaAnimaFlecha()", 250);
		} else {
			if(tmr_f != -1) {
				clearTimeout(tmr_f);
				tmr_f = -1;
			}
			lvl = 1;
			PosicionaCapa("flecha", nfx, nfy);
		}
	}
}

function NuevaAnimaFlecha()
{
	tmr_n = -1;

	if(tmr_f != -1) clearTimeout(tmr_f);

	fx = nfx;
	fy = nfy;

	tmr_f = setTimeout("AnimaFlecha()", 50);
}

function AnimaFlecha()
{
	tmr_f = -1;
	var x = CapaX("flecha");
	var y = CapaY("flecha");
	var dx = 0.25 * (fx - x);
	var dy = 0.25 * (fy - y);
	if(Math.abs(dx) >= 0.25 || Math.abs(dy) >= 0.25) {
		PosicionaCapa("flecha", x + dx, y + dy);
		if(tmr_f == -1) tmr_f = setTimeout("AnimaFlecha()", 50);
	} else {
		PosicionaCapa("flecha", fx, fy);
	}
}

function OcultaFlecha()
{
	if(inicializado) tmr_v = setTimeout("OcultaRealmente()", 1000);
}

function OcultaRealmente()
{
	tmr_v = -1;
	lvl = -1;

	if(document.all && flecha.filters.blendTrans.status != 2) {
		flecha.filters[0].Apply();
		OcultaCapa("flecha");
		flecha.filters[0].Play();
	} else {
		OcultaCapa("flecha");
	}
}
