// user jquery effects.blind

function init_subcats_hover_change(id){
	var speed = 600;
	
	var inchanging = false;
	var toshow = false;
	var isshow = false;
	var delayTimer = null;
	
	var checkShowResult = function() {
		inchanging = false;
		if (toshow!=isshow) {
			toshow ? showfunc() : hidefunc();
		}
	}
	
	var e = $(id);
	var c = $(".hover-content",e);
	var expand = $(".hover-hint .expand",e);
	var collapse = $(".hover-hint .collapse",e);
	
	c.hide();
	$(".hover-hint").show();
	collapse.hide();
	e.css({position:'absolute',"z-index":10});
	e.after('<div style="height:40px;"></div>');
	
	
	var showfunc = function() {
		if (!inchanging) {
			inchanging = true;
			expand.fadeOut(speed/2,function(){collapse.fadeIn(speed/2);});
			c.show("blind", { direction: "vertical" }, speed, function(){isshow=true;setTimeout(checkShowResult,200);});
		}
	}
	
	var hidefunc = function() {
		if (!inchanging) {
			inchanging = true;
			collapse.fadeOut(speed/2,function(){expand.fadeIn(speed/2);});
			c.hide("blind", { direction: "vertical" }, speed, function(){isshow=false;setTimeout(checkShowResult,200);});
		}
	}
	
	e.hover(
		function() { toshow = true;showfunc();},
		function() { toshow = false;hidefunc();}
	);
	expand.click(function(){showfunc();expand.blur();return false;});
	collapse.click(function(){hidefunc();collapse.blur();return false;});
}