//create DIV
window.document.write('<div id="moreInfoWin" class="dimmer" style="border-left:solid 1px #bedada; border-top:solid 1px #bedada; border-right:solid 2px #aaaaaa; border-bottom:solid 2px #aaaaaa; width:175px; height:176px; padding=0px;"></div>')

//Define MouseClick X/Y co-ordinates.
var Xpos, Ypos;

if (!document.all) {
  window.captureEvents(Event.CLICK);
  window.onclick=showitMOZ;
}
else
{
  document.onclick=showit;
}

function showit() //
{
  Xpos = event.x;
  Ypos = event.y+document.body.scrollTop;

}

function showitMOZ(e)
{
  Xpos = e.pageX;
  Ypos = e.pageY;
}


function DMI(symbol)
{

    offsetX = 10;
	offsetY = 10;
	floatDIVwidth = 175;
	scrollWidth=50;

	if( (Xpos + floatDIVwidth) > screen.width)
	{
		Xpos = screen.width - floatDIVwidth - offsetX - scrollWidth
	}

	//SET DIV VISIBLE
	document.getElementById('moreInfoWin').style.visibility = "visible";
    document.getElementById('moreInfoWin').style.left = Xpos+offsetX + 'px';
    document.getElementById('moreInfoWin').style.top = Ypos+offsetY + 'px';
	document.getElementById("moreInfoWin").innerHTML=""
	showdata(symbol);

	/*
	document.getElementById('moreInfoWin').style.visibility = "visible";
    document.getElementById('moreInfoWin').style.left = Xpos+'px';
    document.getElementById('moreInfoWin').style.top = Ypos+'px';
	document.getElementById("moreInfoWin").innerHTML=""
	showdata(symbol);
	*/

}

originalHeight = 196;
i = originalHeight;

function hideMoreInfo()
{
	//document.getElementById('moreInfoWin').style.overflow = "hidden";
	document.getElementById('moreInfoWin').style.height=i+'px';
	i-=8;
	if(i >= 0)
	{
	var x = setTimeout("hideMoreInfo()", 1);
	}
	else
	{
	document.getElementById('moreInfoWin').style.height=originalHeight+'px';
	document.getElementById('moreInfoWin').style.visibility='hidden';
	//document.getElementById('moreInfoWin').style.overflow = "auto"
	i = originalHeight;
	}
}

//AJAX Component start
var xmlHttp

function showdata(symbol)
{
var url="/getStockData.asp?symbol="+symbol
xmlHttp=GetXmlHttpObject(stateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function stateChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
	document.getElementById("moreInfoWin").innerHTML=xmlHttp.responseText
	}
}

function GetXmlHttpObject(handler)
{
	var objXmlHttp=null

	if (navigator.userAgent.indexOf("Opera")>=0)
	{
	alert("This example doesn't work in Opera")
	return
	}
	if (navigator.userAgent.indexOf("MSIE")>=0)
	{
	var strName="Msxml2.XMLHTTP"
	if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
	{
	strName="Microsoft.XMLHTTP"
	}
	try
	{
	objXmlHttp=new ActiveXObject(strName)
	objXmlHttp.onreadystatechange=handler
	return objXmlHttp
	}
	catch(e)
	{
	alert("Error. Scripting for ActiveX might be disabled")
	return
	}
	}
	if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
	objXmlHttp=new XMLHttpRequest()
	objXmlHttp.onload=handler
	objXmlHttp.onerror=handler
	return objXmlHttp
	}
}

