// Global Variables
portalOpen = false;
xmlFrameTarget = "http://armory.worldofwarcraft.com/en_us/darkportal.htm";
currentDomain = "worldofwarcraft.com";
xmlRetrievalFrame = false;
currentlyViewing = "";
threadCounter = 0;
iconNameBuffer = new Array();
isShowing = false;

//Functions
function enhancedXmlTTip(thisID)
{
	currentlyViewing = thisID;
	if(document.getElementById(thisID) != null)
	{
		showTip(document.getElementById(thisID).innerHTML);
	}
	else
	{
		showTip("Loading...");
		requestHTML(thisID);
	}
}

function requestHTML(thisID)
{
	if(portalOpen)
	{
		darkPortal.requestXml(thisID);
	}
	else if(!xmlRetrievalFrame)
	{
		xmlRetrievalFrame = document.createElement("iframe");
		xmlRetrievalFrame.name = "darkPortalFrame";
		xmlRetrievalFrame.id = "xmlPortal";
		xmlRetrievalFrame.style.display = "none";
		document.getElementsByTagName("body")[0].appendChild(xmlRetrievalFrame);
		document.domain = currentDomain;
		xmlRetrievalFrame.src = xmlFrameTarget;
	}
}

function openPortal()
{
	darkPortal = (frames["darkPortalFrame"]) ? frames["darkPortalFrame"] : document.getElementById("xmlPortal").contentWindow;
	portalOpen = true;
	tooltipBuffer = document.createElement("div");
	tooltipBuffer.id = "tooltipBufferDiv";
	tooltipBuffer.style.display = "none";
	document.getElementsByTagName("body")[0].appendChild(tooltipBuffer);
	requestHTML(currentlyViewing);
}

function receivceHTML(thisHTML, thisID)
{
	var newHtmlHolder = document.createElement("div");
	newHtmlHolder.id = thisID;
	newHtmlHolder.innerHTML = thisHTML;
	tooltipBuffer.appendChild(newHtmlHolder);
	var numId = parseInt(thisID);
	iconNameBuffer[numId] = (document.getElementById("XssName"+numId))?new Array(document.getElementById("XssName"+numId).innerHTML,document.getElementById("XssIcon"+numId).innerHTML):null;
	if(document.getElementById(numId+"ListLocation") != null && document.getElementById("XssName"+numId)) insertListItem(numId);
	hideTip();
	queuedItems--;
//	if(isShowing && currentlyViewing == thisID) { showTip(thisHTML); }
}