// Global Variables
portalOpen = false;
xmlFrameTarget = "http://armory.wow-europe.com/de_de/darkportal.htm";
currentDomain = "wow-europe.com";
xmlRetrievalFrame = false;
currentlyViewing = "";
threadCounter = 0;
setcookie("cookieLangId", "de_de");

//Functions
function enhancedXmlTTip(thisID)
{
	currentlyViewing = thisID;
	if(document.getElementById(thisID) != null)
	{
		showTip(document.getElementById(thisID).innerHTML);
	}
	else
	{
		showTip("Verbindung zum Arsenal wird hergestellt...");
		requestHTML(thisID);
	}
}

function requestHTML(thisID)
{
	if(portalOpen)
	{
		darkPortal.requestXml(thisID);
	}
	else if(!xmlRetrievalFrame)
	{
		xmlRetrievalFrame = document.createElement("iframe");
		xmlRetrievalFrame.name = "darkPortalFrame"; //We put the FUN! in "function"
		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);
	if(isShowing && currentlyViewing == thisID) { showTip(thisHTML); }
}