// Author: Andrew Shinn
;

num hIdle1	= -1;
num hIdle2	= -1;
num hIdle3	= -1;

void open()
{
	num rev;
	num x = 10;
	num y = 170;

	CreateBorder(x, y, 200, 90, 5, 0, "Idle Control");
	CreateStatic(x+5, y-5, 100, 20, 5, 0, "Idle RPM's");

	x = x + 20;
	y = y + 20;

	hIdle1 = CreateEdit(x, y, 75, 20, 5, 0, "Idle1");
	CreateStatic(x+80, y, 90, 20, 5, 0, "Cold Idle");
	setitem(hIdle1, round(1875600 / readword(0x2D58), 0));
	

	y = y + 20;
	rev = (readbyte(0x645F) - 128) * 62.52;
	hIdle2 = CreateEdit(x, y, 75, 20, 5, 0, "Idle2");
	CreateStatic(x+80, y, 90, 20, 5, 0, "Warm Idle");
	setitem(hIdle2, round(1875600 / readword(0x2D81), 0));

	y = y + 20;
	rev = (readbyte(0x6464) - 128) * 62.52;
	hIdle3 = CreateEdit(x, y, 75, 20, 5, 0, "Idle3");
	CreateStatic(x+80, y, 90, 20, 5, 0, "Moving Idle");
	setitem(hIdle3, round(1875600 / readword(0x2D43), 0));
}

void save()
{
	writeword(0x2D58, 1875600 / GetItem(hIdle1));
	writeword(0x2D81, 1875600 / GetItem(hIdle2));
	writeword(0x2D43, 1875600 / GetItem(hIdle3));
}
