document.WM = new Object();
document.WM.hirelist = new Object();
document.WM.hirelist.expandos = new Array();
document.WM.hirelist.heights = new Array();
document.WM.hirelist.names = new Array();

function WM_toggle(id) 
{
  if (document.all)
	{
    if(document.all[id].style.display == 'none') { document.all[id].style.display = ''; } 
		else { document.all[id].style.display = 'none'; }
  } 
	else if (document.getElementById)
	{
    if (document.getElementById(id).style.display == 'none') { document.getElementById(id).style.display = 'block'; } 
		else { document.getElementById(id).style.display = 'none'; }
  } 
	else if(document.layers) 
	{
		if(parseInt(id + 1)) { ditem = id + 1; } 
		else { ditem = document.WM.hirelist.names[id]; }
		if (document.WM.hirelist.expandos[ditem])
		{
			if (document.WM.hirelist.expandos[ditem].clip.bottom == 0) 
			{
				document.WM.hirelist.expandos[ditem].clip.bottom = document.WM.hirelist.heights[ditem];
			}
			else 
			{
				document.WM.hirelist.expandos[ditem].clip.bottom = 0;
			}
		}
		WM_align();
  }
}

function WM_close(id) 
{
  if (document.all)
	{
		document.all[id].style.display = 'none';
  } 
	else if (document.getElementById)
	{
		document.getElementById(id).style.display = 'none';
  } 
	else if(document.layers) 
	{
		if(parseInt(id + 1)) { ditem = id + 1; } 
		else { ditem = document.WM.hirelist.names[id]; }
		if (document.WM.hirelist.expandos[ditem])
		{
			document.WM.hirelist.expandos[ditem].clip.bottom = 0;
		}
  }
}

function WM_align() {
	var i, j, stupid_netscape_array_infinate_loop_error;
	stupid_netscape_array_infinate_loop_error = document.WM.hirelist.expandos.length;
	if(document.layers) {
		for(i=0; i<stupid_netscape_array_infinate_loop_error; i++) 
		{
			j = i + 1;
			if(document.WM.hirelist.expandos[j]){
				document.WM.hirelist.expandos[j].top = document.WM.hirelist.expandos[i].top + document.WM.hirelist.expandos[i].clip.bottom;
			}
		}
	}
}

function WM_initialize_toolbar(openMenu, image, img1, img2, hd)
{
	if(document.layers)
	{
		for (i=0; i<document.layers['container'].document.layers.length; i++)
		{
			document.WM.hirelist.expandos[i] = document.layers['container'].document.layers[i];
			document.WM.hirelist.names[document.layers['container'].document.layers[i].name] = i;
			document.WM.hirelist.heights[i] = document.WM.hirelist.expandos[i].clip.bottom;
		}
		for (p=0;p<document.WM.hirelist.expandos.length;p=p+2) { WM_toggle(p); }
		document.layers['container'].visibility = 'visible';
	} 
	else if (document.all)
	{
		for(i = 0; i < document.all('container').all.length; i++)
		{
			document.all('container').all[i].style.position = 'relative';
			if(document.all('container').all[i].className == 'menu') { document.all('container').all[i].style.display = 'none'; }
		}
		document.all('container').style.visibility = 'visible';
	} 
	else if (document.getElementsByTagName && document.getElementById)
	{
		var contained = document.getElementById('container').getElementsByTagName('div');
		for(i = 0; i < contained.length; i++)
		{
			contained[i].style.position = 'relative';
			if(contained[i].getAttribute('class') == 'menu') { contained[i].style.display = 'none'; }
		}
		document.getElementById('container').style.visibility = 'visible';
	}
	if (openMenu != '')
	{
		navi_flipmenu(openMenu, image, img1, img2, hd);
	}
}

function WM_imageToggle(daImage, src1, src2, netscape_container){
  var objStr,obj;
	myImage = document.images[daImage];
	if(document.layers)
	{
		myImage = document.layers['container'].document.layers[netscape_container].document.images[daImage];
	}
	if(document.images)
	{
		if (myImage)
		{
			if (myImage.src == src1) { myImage.src = src2; } 
			else { myImage.src = src1; }
		}
  }
}

function WM_setimage(daImage, src1, netscape_container){
  var objStr,obj;
	myImage = document.images[daImage];
	if(document.layers)
	{
		myImage = document.layers['container'].document.layers[netscape_container].document.images[daImage];
	}
	if(document.images)
	{
		if (myImage)
		{
			myImage.src = src1;
		}
  }
}

function navi_flipmenu(id, im_id, imSrc1, imSrc2, layer)
{
	WM_closeallbut(id);
	WM_toggle(id); 
	WM_imageToggle(im_id, imSrc1, imSrc2, layer);
}


