var openImg = new Image();		openImg.src = "images/arrow_opened.gif";
var closedImg = new Image();	closedImg.src = "images/arrow_closed.gif";

function doBranch(branch, img)
{
 var objBranch = document.getElementById(branch).style;
 if(objBranch.display=="block") objBranch.display="none";
 else objBranch.display="block";
 objImg = document.getElementById(img);
 if(objImg.src.indexOf('images/arrow_closed.gif')>-1) objImg.src = openImg.src;
 else objImg.src = closedImg.src;
}


function selectItem(formItem, theValue)
{
 for(var j=0; j <= formItem.length-1; j++)
 {
  if (formItem.options[j].value == theValue)
   formItem.selectedIndex = j;
 }
}


var browser=new Browser();
var startPos, diffpos=0;
var ee = false;

function Browser() {
  var ua, s, i;
  this.isIE= false;  // Internet Explorer
  this.isNS= false;  // Netscape
  this.version= null;
  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version=parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS=true;
    this.version=parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}
function getPageOffsetLeft(el) {
  var x;
  x = el.offsetLeft;
  if (el.offsetParent != null)
    x += getPageOffsetLeft(el.offsetParent) - 2;
  return x;
}


function getPageOffsetTop(el) {
  var y;
  y = el.offsetTop;
  if (el.offsetParent != null)
    y += getPageOffsetTop(el.offsetParent);
  return y;
}


var isHome=false;

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) + objTd.offsetWidth - objDiv.offsetWidth;
	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="Menu1off";
}

function doMenu2off(obj)
{
 obj.className='Menu2off';
}

function doMenu2on(obj)
{
 obj.className='Menu2on';
}


function doBox1off(obj)
{
 obj.className='Box1off';
}

function doBox1on(obj)
{
 obj.className='Box1on';
}

