function headHide() {
	$(this).removeClass('active');
	$(this.childNodes[1]).css('opacity','0.3');
	$(this).animate({
		height: '80px'
	}, 500);
}
function hideAll() {
		var mark = window.mark37=Math.random() + "";
		setTimeout(function() {
			if(mark!=window.mark37) return;
			if(window.head_active) {
				window.head_active.each(headHide);
				window.head_active = null;
			}
		},300);
}

$(function() {
	var heads = $('#accordion div.head');
	var picNew = $('div.picNew');

	heads.css('height','80px');
	picNew.css('opacity','0.3');
	heads.css('overflow','hidden');
	heads.scrollTop(100);


  heads.mouseleave(hideAll);
	heads.mouseenter(function(event) {
		var d=event.target;
		while(d && d.className != 'head') d = d.parentNode;

		var mark=window.mark37=Math.random() + "";
		if(window.head_active && window.head_active[0] == d) return;
		setTimeout(function() {
			if(mark!=window.mark37) return;
					$(d.childNodes[1]).css('opacity','1');
					if(window.head_active) {
						window.head_active.each(headHide);
					}
					window.head_active = $(d);

						var h= $(d).data("NH");
						if(h == null) {
//						console.log($(d.childNodes[3]).height());
//							alert(d.childNodes[2].className);
							h = eval(100+$(d.childNodes[2]).height());
							$(d).data("NH",h);
						}

						$(d).animate({
				    height: h
				  }, 500);
		},100);

	});

});


