function doImg(imgName, imgSrc){
 document.images[imgName].src = imgSrc.src;
}

var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
var calunit=ns? "" : "px"

function showLarge(){
	if(!ns && !ie && !w3) return;
	if (ie){
	 documentWidth=truebody().offsetWidth/2+truebody().scrollLeft-20;
	 documentHeight =truebody().offsetHeight/2+truebody().scrollTop-20;
	}
	if (ns){
	 documentWidth=window.innerWidth/2+window.pageXOffset-20;
	 documentHeight=window.innerHeight/2+window.pageYOffset-20;
	} 
	if (w3){
	 documentWidth=self.innerWidth/2+window.pageXOffset-20;
	 documentHeight=self.innerHeight/2+window.pageYOffset-20;
	} 
    document.getElementById("overlayDiv").style.display="block";
	document.getElementById("largeDiv").style.left=0+calunit;
	document.getElementById("largeDiv").style.top=documentHeight-250+calunit;
    document.getElementById("largeDiv").style.display="block";
}

function closeLarge(){
	document.getElementById("largeDivContentImg").src="images/pixel.gif";
	document.getElementById("largeDivContentText").innerHTML="";
    document.getElementById("largeDiv").style.display="none";
    document.getElementById("overlayDiv").style.display="none";
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body}

function showPhoto(theImag, theText){
	document.getElementById("largeDivContentImg").src=theImag;
	document.getElementById("largeDivContentText").innerHTML=theText;
	showLarge();
}


function moreInfo(ID)
{
	branch="i"+ID;
	var objBranch = document.getElementById(branch).style;
	if(objBranch.display=="block") objBranch.display="none";
	else objBranch.display="block";
}

var lastTD = "";
function onmouseOverDiv(obj,className)
{
	obj.style.display = 'block';
	lastTD.className = className;
}
function onmouseOutDiv(obj,className)
{
	obj.style.display = 'none';
	lastTD.className = className;
}
function showSubMenu(objTd , name)
{
	lastTD=objTd;  // last td on menu bar
	var objDiv = document.getElementById (name);
	objDiv.style.display = (objDiv.style.display == "none" || objDiv.style.display == "")? "block" : "none";
	objDiv.style.left = getPosX(objTd)-2;
	objDiv.style.top = getPosY(objTd) + objTd.offsetHeight   ;
	
}
function hideMenu(name)
{
	var objDiv = document.getElementById (name);
	objDiv.style.display = "none";
}
function getPosX(obj)
{
	var curleft = 0;
	while (obj.offsetParent)
	{
	  curleft += obj.offsetLeft;
	  obj = obj.offsetParent;
	}
	return curleft;

}
function getPosY(obj)
{
	var curtop = 0;
	while (obj.offsetParent)
	{
	  curtop += obj.offsetTop;
	  obj = obj.offsetParent;
	}
	return curtop;

}
function changeColor(obj,color)
{
    var ob=document.getElementById(obj);
    if(ob != null)
    {
        ob.style.backgroundColor = color;
    }

}

function hideTitle(id)
{
  var title = document.getElementById(id);
  title.className="m1off";
}

function doM2off(obj)
{
 obj.className='m2off';
}

function doM2on(obj)
{
 obj.className='m2on';
}

function showCaseStudy(id){
	page= "case_study.php?ID=" + id;
	window.open(page,"CaseStudyWin","toolbars=0,manubar=0,scrollbars=0,directories=0,location=0,resizable=1,width=912,height=653,left=40,top=40");
}

