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 doM2off(obj)
{
 obj.className='m2off';
}

function doM2on(obj)
{
 obj.className='m2on';
}

function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null;
 
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;
}
} 
 
 
function doVcode()
{ 
	thePage = "check_vcode.php?vcodeID=" + document.form1.vcodeID.value + "&vcode=" + document.form1.vcode.value;
	xmlHttp=GetXmlHttpObject(stateChanged);
	xmlHttp.open("GET", thePage , true);
	xmlHttp.send(null);
} 
 
function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
   {
	document.form1.vcodeTrue.value=xmlHttp.responseText;
   }	
} 

function HideInfo(branch, theTitle)
{
	var objBranch = document.getElementById(branch).style;
	document.getElementById(theTitle).className="infoBoxOff";
	objBranch.display="none";
}

function ShowHideInfo(branch, theTitle)
{
	var objBranch = document.getElementById(branch).style;
	if(objBranch.display=="block")
	{
		theTitle.className="infoBoxOff";
		objBranch.display="none";
	} 
	else
	{
		theTitle.className="infoBoxOn";
		objBranch.display="block";
	}
}

