var animhideobject = '';
var afterAnimDestroyThing = '';

function afterHide(){
	document.getElementById(animhideobject).style.display = 'none';
}

function animShow(object, height, pad, mar){
	document.getElementById(object).style.overflow = 'hidden';
	document.getElementById(object).style.display = 'block';
		
	if('undefined'===window.YAHOO){
		var obj = document.getElementById(object);
		obj.style.height = height+'px';
		obj.style.paddingTop = pad+'px';
		obj.style.paddingBottom = pad+'px';
		obj.style.marginTop = mar+'px';
		obj.style.marginBottom = mar+'px';
		obj.style.opacity = '100';
	} else {
		var myAnim = new YAHOO.util.Anim(object);
		myAnim.attributes.height = {to: height, unit: 'px' };
		myAnim.attributes.paddingTop = {to: pad, unit: 'px' };
		myAnim.attributes.paddingBottom = {to: pad, unit: 'px' };
		myAnim.attributes.marginTop = {to: mar, unit: 'px' };
		myAnim.attributes.marginBottom = {to: mar, unit: 'px' };
		myAnim.attributes.opacity = {from: 0, to: 100 };
		myAnim.duration = 0.5;
		myAnim.method = YAHOO.util.Easing.easeOut;
		myAnim.animate();
	}
}

function animHide(object){
	document.getElementById(object).style.overflow = 'hidden';
	
	if('undefined'===window.YAHOO){
		var obj = document.getElementById(object);
		obj.style.height = '0px';
		obj.style.paddingTop = '0px';
		obj.style.paddingBottom = '0px';
		obj.style.marginTop = '0px';
		obj.style.marginBottom = '0px';
		obj.style.opacity = '0';
	} else {
		animhideobject = object;
		var myAnim = new YAHOO.util.Anim(object);
		myAnim.attributes.height = {to: 0, unit: 'px' };
		myAnim.attributes.paddingTop = {to: 0, unit: 'px' };
		myAnim.attributes.paddingBottom = {to: 0, unit: 'px' };
		myAnim.attributes.marginTop = {to: 0, unit: 'px' };
		myAnim.attributes.marginBottom = {to: 0, unit: 'px' };
		myAnim.attributes.opacity = {to: 0 };
		myAnim.duration = 0.5;
		myAnim.method = YAHOO.util.Easing.easeOut;
//		myAnim.onComplete.subscribe(afterHide);
		myAnim.animate();
	}
}

function afterAnimDestroy(){
	document.getElementById(afterAnimDestroyThing).style.display = 'none';
};

function animDestroy(thing){
	document.getElementById(thing).style.overflow = 'hidden';
	
	if('undefined'===window.YAHOO){
		var obj = document.getElementById(thing);
		obj.style.height = '0px';
		obj.style.paddingTop = '0px';
		obj.style.paddingBottom = '0px';
		obj.style.marginTop = '0px';
		obj.style.marginBottom = '0px';
		obj.style.opacity = '0';
		obj.style.display = 'none';
	} else {
		var myAnim = new YAHOO.util.Anim(thing);
		myAnim.attributes.height = {to: 0, unit: 'px' };
		myAnim.attributes.paddingTop = {to: 0, unit: 'px' };
		myAnim.attributes.paddingBottom = {to: 0, unit: 'px' };
		myAnim.attributes.marginTop = {to: 0, unit: 'px' };
		myAnim.attributes.marginBottom = {to: 0, unit: 'px' };
		myAnim.attributes.opacity = {to: 0 };
		myAnim.duration = 0.5;
		myAnim.method = YAHOO.util.Easing.easeOut;
		afterAnimDestroyThing = thing;
		myAnim.onComplete.subscribe(afterAnimDestroy);
		myAnim.animate();
	}
}

/*var foo

function animShow(object){
	foo = document.getElementById('codeDiv');
	
	foo.style.display = 'block';
	foo.style.overflow = 'visible';
	
	if(setTimeout){
		if(parseInt(foo.style.height) < 27){
			foo.style.height = (parseInt(foo.style.height)+5)+'px';
			
/*			if(foo.style.padding != '0px') foo.style.padding = (parseInt(foo.style.padding)+1)+'px';
			if(foo.style.marginBottom != '0px') foo.style.marginBottom = (parseInt(foo.style.marginBottom)-1)+'px';
			if(foo.style.marginTop != '0px') foo.style.marginTop = (parseInt(foo.style.marginTop)-1)+'px';//
			
			setTimeout(animShow,30);
		} else {
			foo.style.overflow = 'visible';
		}
	} else {
		foo.style.overflow = 'visible';
		foo.style.height = '27px';
	}
}

function animHide(object){
	foo = document.getElementById('codeDiv');
	
	foo.style.overflow = 'hidden';
	
	if(setTimeout){
		if(foo.style.height != '1px'){
			foo.style.height = (parseInt(foo.style.height)-5)+'px';
			
//			if(foo.style.padding != '0px') foo.style.padding = (parseInt(foo.style.padding)-1)+'px';
			if(foo.style.marginBottom != '0px') foo.style.marginBottom = (parseInt(foo.style.marginBottom)-1)+'px';
			if(foo.style.marginTop != '0px') foo.style.marginTop = (parseInt(foo.style.marginTop)-1)+'px';
			
			setTimeout(animHide,30);
		} else {
			foo.style.display = 'none';
		}
	} else {
		foo.style.display = 'none';
	}
}*/