/*
	YUIDomCollapse fancy add-on by Christian Heilmann
	Version 1.0 / May 2007
	License: http://creativecommons.org/licenses/by/3.0/
	Homepage: http://onlinetools.org/tools/yuidomcollapse/
*/
if(YAHOO&&YAHOO.otorg&&YAHOO.otorg.DomCollapse&&YAHOO.util&&YAHOO.util.Anim){
YAHOO.otorg.DomCollapse.toggle=function(e){
var css=YAHOO.otorg.DomCollapse.css;
var parent=YAHOO.util.Dom.hasClass(this,css.triggerClass)?this:this.parentNode;
var id=this.href.replace(/.*#/,'');
var t=document.getElementById(id);
if(t!==undefined){
	var oldover=YAHOO.util.Dom.getStyle(t,'overflow');
	YAHOO.util.Dom.setStyle(t,'overflow','hidden');
	var height=YAHOO.util.Dom.getStyle(t,'height');
	if(height==='auto'){  curHeight=t.offsetHeight;}
	 else{ curHeight=Math.max(parseInt(height),t.offsetHeight);}

	var x=parseInt(curHeight);

	if(YAHOO.util.Dom.hasClass(t,css.hideClass)){
		YAHOO.util.Dom.setStyle(t,'height',0+'px');
		YAHOO.util.Dom.removeClass(t,css.hideClass);
		YAHOO.util.Dom.setStyle(t,'opacity',0);
		var a=new YAHOO.util.Anim(t,{opacity: {from:0,to: 1},height:{from:0,to:x} },.5,YAHOO.util.Easing.easeBoth);
		a.onComplete.subscribe(function(){YAHOO.util.Dom.setStyle(t,'overflow',oldover);
		YAHOO.util.Dom.replaceClass(parent,css.parentClass,css.openClass);});

	a.animate();


	// the addition so that the parent div's height gets changed
	b=parent.parentNode;
	a=new YAHOO.util.Anim(b,{height:{by:x} },.001,YAHOO.util.Easing.easeNone);
	a.animate();

	b=parent.parentNode.parentNode;
	a=new YAHOO.util.Anim(b,{height:{by:x} },.001,YAHOO.util.Easing.easeNone);
	a.animate();

	b=parent.parentNode.parentNode.parentNode;
	a=new YAHOO.util.Anim(b,{height:{by:x} },.001,YAHOO.util.Easing.easeNone);
	a.animate();


}

else {

	// the addition so that the parent div's height gets changed
	b=parent.parentNode;
	var a=new YAHOO.util.Anim(b,{height:{by:-x} },.1,YAHOO.util.Easing.easeNone);
	a.animate();

	b=parent.parentNode.parentNode;
	a=new YAHOO.util.Anim(b,{height:{by:-x} },.1,YAHOO.util.Easing.easeNone);
	a.animate();

	b=parent.parentNode.parentNode.parentNode;
	a=new YAHOO.util.Anim(b,{height:{by:-x} },.001,YAHOO.util.Easing.easeNone);
	a.animate();










	var a=new YAHOO.util.Anim(t,{opacity: {from:1,to: 0} ,height:{from:x,to:0} },.5,YAHOO.util.Easing.easeBoth);
	a.animate();
	a.onComplete.subscribe(function(){YAHOO.util.Dom.addClass(t,css.hideClass);


	YAHOO.util.Dom.setStyle(t,'height',x+'px');
	YAHOO.util.Dom.setStyle(t,'opacity',1);
	YAHOO.util.Dom.setStyle(t,'overflow',oldover);
	YAHOO.util.Dom.replaceClass(parent,css.openClass,css.parentClass);});};};
	YAHOO.util.Event.preventDefault(e);};};