
function GetXmlHttpObject() {
  var xmlHttp=null;
  try
  {
    // Firefox, Opera 8.0+, Safari
    xmlHttpObject = new XMLHttpRequest();
  }
  catch (e)
  {
    // Internet Explorer
  try
  {
    xmlHttpObject = new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch (e)
  {
    xmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
  }
}
  return xmlHttpObject;
}

function retrieveQuote() {
	xmlHttpObject=GetXmlHttpObject()
	// Browseren understøtter ikke  AJAX
	if (xmlHttpObject == null) {return;}
	// Send forespørgsel
	today = new Date()
	var getUrl = "/sys/modules/quote/quote.asp?t=" + today.getSeconds()
	xmlHttpObject.onreadystatechange = updateQuote;
	xmlHttpObject.open("GET", getUrl, true);
	xmlHttpObject.send(null);
}

function updateQuote()
{
  if (xmlHttpObject.readyState==4) {
    result = xmlHttpObject.responseText;  // get results
	eval(result)
	
    var container = document.getElementById("quoteContainer");
	for (i=0;i<=container.childNodes.length;i++) {
		el = container.childNodes[0];
		if (el != null) {
		old = container.removeChild(el);
		}
	}

	oQuote = document.createTextNode(quote)
	container.appendChild(oQuote);

	if (origin != '') {
		oOrigin = document.createElement("div");
		oOrigin.className = 'origin';
		oOriginText = document.createTextNode(origin);
		oOrigin.appendChild(oOriginText);
		container.appendChild(oOrigin);
	}

	oClose = document.createElement("div");
	oClose.className = 'close';
	oCloseText = document.createTextNode('- close box -');
	oClose.appendChild(oCloseText)
	oClose.onclick = hideQuote;
	container.appendChild(oClose);
  showQuote();
	}
}

function showQuote() {
	document.getElementById('rightMenuQuotePop').style.display='block';
}
function hideQuote() {
	document.getElementById('rightMenuQuotePop').style.display='none';
}
