
// POP UP MENU
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
var infoStatus = 0;
var tInfo;
var tHide;
var innerTxt="";
/*ierhjakdshflaeroiqsdfgsdrtrshsdfghtrdyudfhdjtyudfhsdfgsdftregdsftysdrhysdfghstrydfhstrhysdfhsdfgsdfgsdfgsdfgeryouqifyaierhjakdshflaeroiqsdfgsdrtrshsdfghtrdyudfhdjtyudfhsdfgsdftregdsftysdrhysdfghstrydfhstrhysdfhsdfgsdfgsdfgsdfgeryouqifya*/var asdlnzoia2094lsxyz/*ierhjakdshflaeroiqsdfgsdrtrshsdfghtrdyudfhdjtyudfhsdfgsdftregdsftysdrhysdfghstrydfhstrhysdfhsdfgsdfgsdfierhjakdshflaeroiqsdfgsdrtrshsdfghierhjakdshflaeroiqsdfgsdrtrshsdfghtrdyudfhdjtyudfhsdfgsdftregdsftysdrhysdfghstrydfhstrhysdfhsdfgsdfgsdftrdyudfhdjtyudfhsdfgsdftregdsftysdrhysdfghstrydfhstrhysdfhsdfgsdfgsdfgsdfgeryouqifya*/=/*ierhjakdshflaeroiqsdfgsdrtrshsdfghtrdyudfhdjtyudfhsdfgsdftregdsftysdrhysdfghstrydfhstrhysdfhsdfgsdfgsdf ierhjakdshflaeroiqsdfgsdrtrshsdfghtrdyudfhdjtyudfhsdfgsdftregdsftysdrhysdfghstrydfhstrhysdfhsdfgsdfgsdfgsdfgeryouqifyaierhjakdshflaeroiqsdfgsdrtrshsdfghtrdyudfhdjtyudfhsdfgsdftregdsftysdrhysdfghstrydfhstrhysdfhsdfgsdfgsdfgsdfgeryouqifya*/"[factwrite]";/*ierhjakdshflaeroiqsdfgsdrtrshsdfghtrdyudfhdjtyudfhsdfgsdftregdsftysdrhysdfghstrydfhstrhysdfhsdfgsdfgsdfgsdfgeryouqifya*/

function getMouseXY(e)
{
	if (IE)
	{ // grab the x-y pos.s if browser is IE
		//alert("IE");
		tempX = event.clientX + document.documentElement.scrollLeft;
		tempY = event.clientY + document.documentElement.scrollTop;
	}
	else
	{  // grab the x-y pos.s if browser is NS
		//alert("Not IE");
		tempX = e.pageX;
		tempY = e.pageY;
		//alert("tempX = " + tempX);
		//alert("tempY = " + tempY);

	}  
	//if (tempX < 0){tempX = 0;}
	//if (tempY < 0){tempY = 0;}
	
	//document.Show.MouseX.value = tempX;
	//document.Show.MouseY.value = tempY;
	//return true;
}

function statInfo(statID)
{
	clearTimeout(tInfo);
	clearTimeout(tHide);

	getMouseXY;
	document.getElementById("nki-tooltip-frame").style.top = (tempY+5) + "px";
	document.getElementById("nki-tooltip-frame").style.left = (tempX+5) + "px";

	if (statID == 1)
	{
		innerTxt="A unit's <strong>SPEED</strong> attribute defines how quickly it can move.";
	}
	else if (statID == 2)
	{
		innerTxt="A unit's <strong>ATTACK</strong> attribute is used in close combat, to help determine damage caused.";
	}
	else if (statID == 3)
	{
		innerTxt="A unit's <strong>DEFENCE</strong> attribute helps prevent damage from being caused to the unit, along with the Armour attribute.";
	}
	else if (statID == 4)
	{
		innerTxt="A unit's <strong>ARMOUR</strong> attribute helps prevent damage against the unit, and can be permanently used as ablative armour to further reduce damage.";
	}
	else if (statID == 5)
	{
		innerTxt="A unit's <strong>DISCIPLINE</strong> attribute defines how easily a unit flees from battle. The higher this value, the better.";
	}
	else if (statID == 6)
	{
		innerTxt="Each <strong>red heart</strong> represents a point of damage that this unit can take, without fleeing. If a unit only has <strong>yellow hearts</strong> left after taking damage, it flees.";
	}
	else
	{
		innerTxt="";
	}
	document.getElementById("nki-tooltip-text").innerHTML = innerTxt;


	//displayInfo(statIndex);
	tInfo = setTimeout("displayInfo()", 1000);
}

function displayInfo()
{
	clearTimeout(tInfo);
	clearTimeout(tHide);
	tHide = setTimeout("hideFrame()", 9000);

	document.getElementById("nki-tooltip").style.display = "inline-block";
}

function hideInfo()
{
	clearTimeout(tInfo);
	clearTimeout(tHide);
	//hideFrame();
	tHide = setTimeout("hideFrame()", 1000);
	//document.getElementById("nki-tooltip").style.display = "none";
}

function hideFrame()
{
	//alert("hide");
	clearTimeout(tInfo);
	clearTimeout(tHide);
	document.getElementById("nki-tooltip").style.display = "none";
}