opac=0.7;
function setOpacity(testObj,value) 
{
    if(!ie)
    {
	    testObj.style.opacity = value/10;
    }
    else
    {
	    testObj.style.filter='alpha(opacity=' + value*10 + ')';
    };
};
function getOpacity(obj)
{
    if(ie)
    {
        value=obj.filters.alpha.opacity;
    }
    else
    {
        value=obj.style.opacity;  
    }
    return value;
}


function getElementsByClass( searchClass, domNode, tagName) {
	if (domNode == null) domNode = document;
	if (tagName == null) tagName = '*';
	var el = new Array();
	var tags = domNode.getElementsByTagName(tagName);
	var tcl = " "+searchClass+" ";
	for(i=0,j=0; i<tags.length; i++) {
		var test = " " + tags[i].className + " ";
		if (test.indexOf(tcl) != -1)
			el[j++] = tags[i];
	}
	return el;
}
function is_child_of(parent, child) 
{
    if( child != null ) 
    {			
        while( child.parentNode ) 
        {
            if( (child = child.parentNode) == parent ) 
            {
                return true;
            }
        }
    }
    return false;
}

function showDrop()
{
    var active=activeArray[this.i];
    if(active!=this)
    {
        hideDrop(this.i);
        activeArray[this.i]=this;
        var dropdown=getElementsByClass('dropdown',this)[0];
        from=dropdown.offsetHeight;
        to=this.saveHeight;
        if(this.show){this.show.clearSubjects();}
        this.show=new Animator({duration:500}).addSubject(new NumericalStyleSubject(dropdown,'height',from,to));
        this.show.addSubject(new NumericalStyleSubject(dropdown,'opacity',getOpacity(dropdown), 1));
        this.show.play();
    }
    else
    {
        hideDrop(this.i);
    };
};

function hideDrop(index)
{
   var active=activeArray[index];
   if(active)
   {
        var dropdown=getElementsByClass('dropdown',active)[0];
        from=dropdown.offsetHeight;
        to=0;
        if(active.hide){active.hide.clearSubjects()};
        active.hide=new Animator({duration:500}).addSubject(new NumericalStyleSubject(dropdown,'height',from,to));
        active.hide.addSubject(new NumericalStyleSubject(dropdown,'opacity',getOpacity(dropdown), 0));
        active.hide.play();
        activeArray[index]=null;
    };
};

var activeArray=new Array();
function init()
{
	var lists=getElementsByClass('list');
    //var dropMenus=getElementsByClass('listItem');
    
    for(var i=0;i<lists.length;i++)
    {
        activeArray[i]=null;
        var dropMenus=getElementsByClass('listItem',lists[i]);
        for(var k=0;k<dropMenus.length;k++)
        {
           dropMenus[k].i=i;
           dropMenus[k].onclick=showDrop;
           dropdown=getElementsByClass('dropdown',dropMenus[k])[0];
           setOpacity(dropdown,0);
           dropMenus[k].saveHeight=dropdown.offsetHeight;
           dropdown.style.height="0px"
        };
    };
};

var ie=false;
switch(navigator.appName)
{
	case "Microsoft Internet Explorer":
		doc=document.documentElement;
		window.attachEvent("onload",init);
		ie=true;
		break    
	case "Netscape":
		if(navigator.vendor=="Apple Computer, Inc.") //SAFARI
		{
			window.onload=init;
			safari=true;
		}
		else                                                       //FIREFOX
		{
			
			doc=document.documentElement;
			document.addEventListener("DOMContentLoaded", init, false);
		};
		break
	default:
		doc=document.documentElement;
		window.onload = init;	
};