
// Nick 23 Jan 2008 - ugh... no time to figure out why IE7 won't work with InvertCSSAttribute
// Replace with different style of function
function ToggleDivOpen(win, name)
{
	var el = win.document.getElementById(name);
	if (el)
	{
        if (el.getAttribute('open') == 0)
        {
            el.setAttribute('open', 1);
            el.style.display = 'block';
        }
        else
        {
            el.setAttribute('open', 0);
            el.style.display = 'none';
        }
	}
};

// toggle an attribute from 0 <-> 1, making sure that CSS updates
function InvertCSSAttribute(win, name, attrib)
{
	var el = win.document.getElementById(name);
	if (el)
	{
		el.setAttribute(attrib,(el.getAttribute(attrib)>0?0:1));
        CSSTriggerStyleHack(el, 'open');
		//CSSTriggerHack(el);
		//CSSTriggerHack(el.parent);
	}
};

function OpenDiv(surround, myself)
{
	if (!surround)
		return;

	if (HasAttribute(surround, 'current') && surround.getAttribute('current').length)
	{
		var current = document.getElementById(surround.getAttribute('current'));
		if (current)
		{
			if (HasAttribute(current, 'div'))
			{
				var div = document.getElementById(current.getAttribute("div"));
				if (div)
                {
                    div.setAttribute('open', 0);
                    div.style.display = 'none';     // IE6 Compatibility
                }
			}
			current.setAttribute('open', 0);
		}
	}
	surround.setAttribute('current', '');
	if (myself)
	{
		myself.setAttribute('open', 1);
		if (HasAttribute(myself, "div"))
		{
			var div = document.getElementById(myself.getAttribute("div"));
			if (div)
            {
                div.setAttribute('open', 1);
                div.style.display = 'block';    // IE6 Compatibility
            }
		}
		surround.setAttribute('current', myself.id);
	}
};



