// global javascript functions
var thetimeout;
var theimage;
var thisDivID;
var thisDivStyle;
var thisImageDivID
var thisImageDivStyle;

function showCase () {
	var theitem=document.getElementById("CaseStudy");
	var theX=findPosX(theitem);
	var theY=findPosY(theitem);
	var objSelect = document.getElementById("CompletedSites");
	var thecase = document.getElementById( objSelect.item(objSelect.selectedIndex).value );	

	if ((thisDivID) &&(thisDivID!=thecase.id)) thisDivStyle.visibility='hidden';
	thisDivID = thecase.id;
	thisDivStyle = thecase.style;
	thisDivStyle.top=theY+1;
	thisDivStyle.left=theX;
    thisDivStyle.visibility="visible";
	
	showImage(objSelect);
}
function showImage (objSelect) {
	var theitem=document.getElementById("CaseImage");
	var theX=findPosX(theitem);
	var theY=findPosY(theitem);
	var thecase = document.getElementById( objSelect.item(objSelect.selectedIndex).value+"_image" );	

	if ((thisImageDivID) &&(thisImageDivID!=thecase.id)) thisImageDivStyle.visibility='hidden';
	thisImageDivID = thecase.id;
	thisImageDivStyle = thecase.style;
	thisImageDivStyle.top=theY+1;
	thisImageDivStyle.left=theX;
    thisImageDivStyle.visibility="visible";

}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}
function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}
