(function($) {
	$.fn.hoverForIE6 = function(option) {
		var s = $.extend( {
			current : "hover",
			delay : 10
		}, option || {});
		$.each(this, function() {
			var timer1 = null, timer2 = null, flag = false;
			$(this).bind("mouseover", function() {
				var _this = $(this);

				if (flag) {
					clearTimeout(timer2);
				} else {
					timer1 = setTimeout(function() {
						_this.addClass(s.current);

						if ($.browser.msie) {
							_this.css('z-index', '1');
						}

						var _piao = _this.children("#piao");

						//指针距离页面顶部的距离
						var F = _this.offset().top;
						//页面下滑距离
						var E = document.documentElement.scrollTop;
						//打开页面的高度
						var G = document.documentElement.clientHeight;
						//弹出层的高度
						var D = _piao.height();
						
						// 是否要向上展示,减去233是为了不挡住页面上方的搜索框
							if (F - E - 223 > D) {
								if ((G - F + E) < D) {
									_piao.css('top', 'auto');
									_piao.css('bottom', '-2px');
								}
							}
							flag = true;
						}, s.delay);
				}
			}).bind("mouseout", function() {
				var _this = $(this);

				if (flag) {
					timer2 = setTimeout(function() {
						_this.removeClass(s.current);
						_this.css('z-index', '');

						var _piao = _this.children("#piao");
						_piao.css('top', '');
						_piao.css('bottom', '');

						flag = false;
					}, s.delay);
				} else {
					clearTimeout(timer1);
				}
			})
		})
	}
})(jQuery);
