function initExpand()
{
  if (typeof toExpand != 'undefined')
  {
    if (!NS4)
    {
      if (NS6)
      {
        var objs = document.getElementsByTagName('A');
        for (a = 0 ; a < objs.length; a++) if (objs[a].name.substr(0,6) == 'anchor')
        {
          objName = objs[a].name;
          toObjName = objName.substr(6 , objName.length - 6);
          objs[a].addEventListener("click",expandNS6,false);
        }
      }
      else
        expandDiv(toExpand)
    }
  }
}
  with (document) {
    write("<style type='text/css'>");
    if (NS4) {
      write(".parent {position:absolute; visibility:hidden; z-index:2}");
      write(".child {position:absolute; visibility:hidden; z-index:2}");
      write(".regular {position:absolute; visibility:hidden}")
    }
    else if (!NS6) {
      write(".child {display:none}")
    }
   write("</style>");
  }

  isExpanded = false;

//  ie & ns functions
function initialize()
{
	
  if (NS4) {
		firstEl = "elOneParent";
		firstInd = ns_getIndex(firstEl);
		ns_showAll();
		ns_arrange();
    //ns_init();
  }
  else {
    ie_init();
  }
  initExpand();
}

function expandDiv(el)
{
	if (!ver4) return;
	if (IE4) {expandIE(el)} else if (NS4) {expandNS(el)}
}

//  ie functions
function ie_init()
{
  if (document.getElementsByTagName)
    tempColl = document.getElementsByTagName("DIV")
  else
    tempColl = document.all.tags("DIV");
  for (i=0; i < tempColl.length; i++)
  {
    if (tempColl[i].className == "child" && !NS6)
      tempColl[i].style.display = "none";
  }
}

if (NS6)
  var event = null;
function expandNS6(e)
{
  event = e;
  event.srcElement = e.target;
  return;
  alert('s');
  ns_init();
  expandIE(e.target.name.substr(4, e.target.name.length - 4));
}

function expandIE(el)
{
 	if (document.getElementById)
    whichEl = document.getElementById(el + "Child");
  else
	  whichEl = eval(el + "Child");
	
	whichIm = event != null && event.srcElement != null ? event.srcElement : document.images['imEx' + el];
	
	
	if (whichEl.style.display == "block"){
		whichEl.style.dispaly = "none";
	}
	
	if (whichEl.style.display == "none" || whichEl.style.display == '')
	{
		ie_init();
		whichEl.style.display = "block";
		/*
		if(el == "elOne")
		{
			whichIm.src = "_images/menu_1_f2.gif";
		}
		else if(el == "elSix")
		{
			whichIm.src = "_images/menu_6_f2.gif";
		}
		else if(el == "elNine")
		{
			whichIm.src = "_images/menu_9_f2.gif";
		}
		*/
	}
	else
	{
		whichEl.style.display = "none";
		/*
		if(el == "elOne")
		{
			whichIm.src = "_images/menu_1.gif";
		}
		else if(el == "elSix")
		{
			whichIm.src = "_images/menu_6.gif";
		}
		else if(el == "elNine")
		{
			whichIm.src = "_images/menu_9.gif";
		}
		*/
  }
}


//  ns functions

function ns_init()
{
	//alert("ns init ! = "+document.layers.length);
  for (i=0; i<document.layers.length; i++)
  {
    whichEl = document.layers[i];
    if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
  }
  ns_arrange();

}

function expandNS(el)
{
  return;
  whichEl = eval("document." + el + "Child");
  whichIm = eval("document." + el + "Parent.document.imEx" + el);
  
  var expanded;

  if (whichEl.visibility == "hide")
  {
     
    expanded	= 1;
    whichEl.visibility = "show";
    if(el == "elOne")
		{ whichIm.src = "_images/menu_1_f2.gif"; }
		if(el == "elSix")
		{	whichIm.src = "_images/menu_6_f2.gif"; }
		if(el == "elNine")
		{	whichIm.src = "_images/menu_9_f2.gif"; }
	}
  else
  {
    expanded  = 0;
    whichEl.visibility = "hide";
    if(el == "elOne")
		{ whichIm.src = "_images/menu_1.gif"; }
		if(el == "elSix")
		{ whichIm.src = "_images/menu_6.gif"; }
		if(el == "elNine")
		{	whichIm.src = "_images/menu_9.gif"; }
  }
  ns_arrange();
}

function ns_getIndex(el)
{
  ind = null;
  for (i=0; i<document.layers.length; i++)
  {
    whichEl = document.layers[i];
		if (whichEl.id == el)
		{
	  	ind = i;
      break;
		}
  }
  return ind;
}


function ns_arrange()
{
	document.layers[firstInd].top = "170";
	document.elOneParent.top = "170";
  nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
  for (i=firstInd+1; i<document.layers.length; i++) {
    whichEl = document.layers[i];
    if (whichEl.visibility != "hide") {
			whichEl.pageY = nextY;
			nextY += whichEl.document.height;
    }
  }
}

function ns_showAll()
{
  for (i=firstInd; i<document.layers.length; i++) {
    whichEl = document.layers[i];
    whichEl.visibility = "show";
  }
}

function ns_collapsAll(){
	for (i=firstInd; i<document.layers.length; i++){
		whichEl	= document.layers[i];
		whichEl.visibility = "hidden";
	}
}
