var XME = 0;
var YME = 0;

function doITooltip(tipX, tipY, im1, thumb1, im2, thumb2, im3, thumb3, im4, thumb4, im5, thumb5, imr1, thumbr1, imr2, thumbr2, imr3, thumbr3, imr4, thumbr4, imr5, thumbr5) {
// build tooltip
var tip = '<TABLE BGCOLOR="#000000" WIDTH="180" CELLSPACING="0" CELLPADDING="1" BORDER="0"><TR><TD><TABLE BGCOLOR="#e6ecff" WIDTH="100%" CELLSPACING="0" CELLPADDING="1" BORDER="0">';
tip += '<TR><TD COLSPAN="5" ALIGN="RIGHT" BGCOLOR="#555555"><A onclick="javascript:hideITip();" STYLE="font-family:arial;font-size:11px;font-weight:bold;color:#ffffff;text-decoration:none;cursor:pointer;">'
tip += 'close&nbsp;X</A></TD></TR>';
tip += '<TR><TD COLSPAN="5" CLASS="textblack2">Other Images by Member:</TD>';
if (im1 != '')
	{
		tip += '<TR><TD><A HREF="http://www.eyefetch.com/image.aspx?ID=' + im1 + '"><IMG SRC="http://www.eyefetch.com/' + thumb1 + im1 + 't.jpg" BORDER="1" STYLE="border-color:#000000" HEIGHT="40" WIDTH="40"></A></TD>';
	}
if (im2 != '')
	{
		tip += '<TD><A HREF="http://www.eyefetch.com/image.aspx?ID=' + im2 + '"><IMG SRC="http://www.eyefetch.com/' + thumb2 + im2 + 't.jpg" BORDER="1" STYLE="border-color:#000000" HEIGHT="40" WIDTH="40"></A></TD>';
	}
if (im3 != '')
	{
		tip += '<TD><A HREF="http://www.eyefetch.com/image.aspx?ID=' + im3 + '"><IMG SRC="http://www.eyefetch.com/' + thumb3 + im3 + 't.jpg" BORDER="1" STYLE="border-color:#000000" HEIGHT="40" WIDTH="40"></A></TD>';
	}
if (im4 != '')
	{
		tip += '<TD><A HREF="http://www.eyefetch.com/image.aspx?ID=' + im4 + '"><IMG SRC="http://www.eyefetch.com/' + thumb4 + im4 + 't.jpg" BORDER="1" STYLE="border-color:#000000" HEIGHT="40" WIDTH="40"></A></TD>';
	}
if (im5 != '')
	{
		tip += '<TD><A HREF="http://www.eyefetch.com/image.aspx?ID=' + im5 + '"><IMG SRC="http://www.eyefetch.com/' + thumb5 + im5 + 't.jpg" BORDER="1" STYLE="border-color:#000000" HEIGHT="40" WIDTH="40"></A></TD>';
	}
tip += '</TR></TABLE></TD></TR><TR><TD>';
tip += '<TABLE BGCOLOR="#e6ecff" WIDTH="100%" CELLSPACING="0" CELLPADDING="1" BORDER="0">';
tip += '<TR><TD COLSPAN="5" CLASS="textblack2">Similar / Related Images:</TD>';
if (imr1 != '')
	{
		tip += '<TR><TD ALIGN="CENTER"><A HREF="http://www.eyefetch.com/image.aspx?ID=' + imr1 + '"><IMG SRC="http://www.eyefetch.com/' + thumbr1 + imr1 + 't.jpg" BORDER="1" STYLE="border-color:#000000" HEIGHT="40" WIDTH="40"></A></TD>';
	}
if (imr2 != '')
	{
		tip += '<TD><A HREF="http://www.eyefetch.com/image.aspx?ID=' + imr2 + '"><IMG SRC="http://www.eyefetch.com/' + thumbr2 + imr2 + 't.jpg" BORDER="1" STYLE="border-color:#000000" HEIGHT="40" WIDTH="40"></A></TD>';
	}
if (imr3 != '')
	{
		tip += '<TD><A HREF="http://www.eyefetch.com/image.aspx?ID=' + imr3 + '"><IMG SRC="http://www.eyefetch.com/' + thumbr3 + imr3 + 't.jpg" BORDER="1" STYLE="border-color:#000000" HEIGHT="40" WIDTH="40"></A></TD>';
	}
if (imr4 != '')
	{
		tip += '<TD><A HREF="http://www.eyefetch.com/image.aspx?ID=' + imr4 + '"><IMG SRC="http://www.eyefetch.com/' + thumbr4 + imr4 + 't.jpg" BORDER="1" STYLE="border-color:#000000" HEIGHT="40" WIDTH="40"></A></TD>';
	}
if (imr5 != '')
	{
		tip += '<TD><A HREF="http://www.eyefetch.com/image.aspx?ID=' + imr5 + '"><IMG SRC="http://www.eyefetch.com/' + thumbr5 + imr5 + 't.jpg" BORDER="1" STYLE="border-color:#000000" HEIGHT="40" WIDTH="40"></A></TD>';
	}
tip += '</TR></TABLE></TD></TR></TABLE>';


	// correct mouse position for scrolled screens
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
	//Netscape compliant
	scrOfY = window.pageYOffset;
	scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	//DOM compliant
	scrOfY = document.body.scrollTop;
	scrOfX = document.body.scrollLeft;
	} else if( document.documentElement &&
	  ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	//IE6 standards compliant mode
	scrOfY = document.documentElement.scrollTop;
	scrOfX = document.documentElement.scrollLeft;
	}

	var corrposx = 0;
	var corrposy = 0;
	corrposx = tipX + scrOfX;
	corrposy = tipY + scrOfY;

	if (document.all) // IE4+
	{
		document.all.tooltip.innerHTML = tip;
	 	document.all.tooltip.style.pixelLeft = corrposx + 8;
 		document.all.tooltip.style.pixelTop = corrposy + 8;
	 	document.all.tooltip.style.visibility = "visible";
	}
	else if (document.layers) // NS4+
	{
		document.tooltip.document.write(tip);
		document.tooltip.document.close();
		document.tooltip.left = corrposx + 8;
		document.tooltip.top = corrposy + 8;
		document.tooltip.visibility = "show";
	}
	else if (document.getElementById) //NS6+
	{
		var myElement = document.getElementById("tooltip");
		myElement.innerHTML = tip;
		myElement.style.left = corrposx + 8 + "px";
		myElement.style.top = corrposy + 8 + "px";
		myElement.style.visibility = "visible";
	} 
}

function hideITip() {
	if (document.all) // IE4+
	{
		document.all.tooltip.style.visibility = "hidden";
	}
	else if (document.layers) // NS4+
	{
		document.tooltip.visibility = "hide";
	}
	else if (document.getElementById) //NS6+
	{
		var myElement = document.getElementById("tooltip");
		myElement.style.visibility = "hidden";
	} 
}

function getIDescription(xpos, ypos, imageid) {
	XME = xpos;
	YME = ypos;
	var url = 'http://www.eyefetch.com/info_image.aspx?ID=' + imageid;
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }
    req.onreadystatechange = processIRequest;
    req.open("GET", url, true);
    req.send(null);
}

function processIRequest() {
    if (req.readyState == 4) {
        if (req.status == 200) {
          parseIMessages();
        } else {
          //alert ( "Not able to retrieve description" );
				}
    }
}

function parseIMessages() {
	response  = req.responseXML.documentElement;
	if (response.getElementsByTagName('imageid')[0] != null)
	{
		var im1 = response.getElementsByTagName('imageid')[0].firstChild.data;
	}
	else
	{
		var im1 = '';
	}
	if (response.getElementsByTagName('imageid')[1] != null)
	{
		var im2 = response.getElementsByTagName('imageid')[1].firstChild.data;
	}
	else
	{
		var im2 = '';
	}
	if (response.getElementsByTagName('imageid')[2] != null)
	{
		var im3 = response.getElementsByTagName('imageid')[2].firstChild.data;
	}
	else
	{
		var im3 = '';
	}
	if (response.getElementsByTagName('imageid')[3] != null)
	{
		var im4 = response.getElementsByTagName('imageid')[3].firstChild.data;
	}
	else
	{
		var im4 = '';
	}
	if (response.getElementsByTagName('imageid')[4] != null)
	{
		var im5 = response.getElementsByTagName('imageid')[4].firstChild.data;
	}
	else
	{
		var im5 = '';
	}
	if (response.getElementsByTagName('thumb')[0] != null)
	{
		var thumb1 = response.getElementsByTagName('thumb')[0].firstChild.data;
	}
	else
	{
		var thumb1 = '';
	}
	if (response.getElementsByTagName('thumb')[1] != null)
	{
		var thumb2 = response.getElementsByTagName('thumb')[1].firstChild.data;
	}
	else
	{
		var thumb2 = '';
	}
	if (response.getElementsByTagName('thumb')[2] != null)
	{
		var thumb3 = response.getElementsByTagName('thumb')[2].firstChild.data;
	}
	else
	{
		var thumb3 = '';
	}
	if (response.getElementsByTagName('thumb')[3] != null)
	{
		var thumb4 = response.getElementsByTagName('thumb')[3].firstChild.data;
	}
	else
	{
		var thumb4 = '';
	}
	if (response.getElementsByTagName('thumb')[4] != null)
	{
		var thumb5 = response.getElementsByTagName('thumb')[4].firstChild.data;
	}
	else
	{
		var thumb5 = '';
	}
	if (response.getElementsByTagName('imageid2')[0] != null)
	{
		var imr1 = response.getElementsByTagName('imageid2')[0].firstChild.data;
	}
	else
	{
		var imr1 = '';
	}
	if (response.getElementsByTagName('imageid2')[1] != null)
	{
		var imr2 = response.getElementsByTagName('imageid2')[1].firstChild.data;
	}
	else
	{
		var imr2 = '';
	}
	if (response.getElementsByTagName('imageid2')[2] != null)
	{
		var imr3 = response.getElementsByTagName('imageid2')[2].firstChild.data;
	}
	else
	{
		var imr3 = '';
	}
	if (response.getElementsByTagName('imageid2')[3] != null)
	{
		var imr4 = response.getElementsByTagName('imageid2')[3].firstChild.data;
	}
	else
	{
		var imr4 = '';
	}
	if (response.getElementsByTagName('imageid2')[4] != null)
	{
		var imr5 = response.getElementsByTagName('imageid2')[4].firstChild.data;
	}
	else
	{
		var imr5 = '';
	}
	if (response.getElementsByTagName('thumb2')[0] != null)
	{
		var thumbr1 = response.getElementsByTagName('thumb2')[0].firstChild.data;
	}
	else
	{
		var thumbr1 = '';
	}
	if (response.getElementsByTagName('thumb2')[1] != null)
	{
		var thumbr2 = response.getElementsByTagName('thumb2')[1].firstChild.data;
	}
	else
	{
		var thumbr2 = '';
	}
	if (response.getElementsByTagName('thumb2')[2] != null)
	{
		var thumbr3 = response.getElementsByTagName('thumb2')[2].firstChild.data;
	}
	else
	{
		var thumbr3 = '';
	}
	if (response.getElementsByTagName('thumb2')[3] != null)
	{
		var thumbr4 = response.getElementsByTagName('thumb2')[3].firstChild.data;
	}
	else
	{
		var thumbr4 = '';
	}
	if (response.getElementsByTagName('thumb2')[4] != null)
	{
		var thumbr5 = response.getElementsByTagName('thumb2')[4].firstChild.data;
	}
	else
	{
		var thumbr5 = '';
	}
	
	//alert(im1 + " " + im2 + " " + im3 + " " + im4 + " " + im5);
	doITooltip(XME, YME, im1, thumb1, im2, thumb2, im3, thumb3, im4, thumb4, im5, thumb5, imr1, thumbr1, imr2, thumbr2, imr3, thumbr3, imr4, thumbr4, imr5, thumbr5);
}