$(document).ready(function(){
    $("#HeadSearchWordKey").focus(function(){
        $(this).css({'background-image' : 'none'});
    });
    $("#HeadSearchWordKey").blur(function(){
        if($(this)[0].value==""){
            $(this).css({'background-image' : 'url(/T/1/skin/sprite.gif)'});
        }
    });
    $("#HeadSearchImgBtn").click(function(){
        if($("#HeadSearchWordKey")[0].value!=""){
            window.location="/search.aspx?type=life&k="+escape($("#HeadSearchWordKey")[0].value); 
        }
    });
});
/*——*/
var DropMenu_timeout = 500;
var DropMenu_closetimer = 0;
var DropMenu_ddmenuitem = 0;
function DropMenu_open()
{
	DropMenu_canceltimer();
	DropMenu_close();
	DropMenu_ddmenuitem = $(this).find('ul').eq(0).css('display', 'block');
	if($(this).children("ul").size()>0)
	{
	    $(this).attr("class","on");
	}
}
function DropMenu_close()
{
	if(DropMenu_ddmenuitem)
	{
	    DropMenu_ddmenuitem.parent().attr('class', '');
	    DropMenu_ddmenuitem.css('display', 'none');
	}
}
function DropMenu_timer()
{
	DropMenu_closetimer = window.setTimeout(DropMenu_close, DropMenu_timeout);
}
function DropMenu_canceltimer()
{
	if(DropMenu_closetimer)
	{
		window.clearTimeout(DropMenu_closetimer);
		DropMenu_closetimer = null;
    }
}
/**/
$(document).ready(function(){
	$('#topbarmenu > li').bind('mouseover', DropMenu_open);
	$('#topbarmenu > li').bind('mouseout',  DropMenu_timer);
});
document.onclick = DropMenu_close;
/*——*/
(function($){
	$.scrollBtn = function(options) {
		var opts = $.extend({}, $.scrollBtn.defaults, options);

		var $scrollBtn = $('<div></div>').css({
							bottom: opts.bottom + 'px',
							right: opts.right + 'px'
						}).addClass('scroll-up')
						.attr('title', opts.title)
						.click(function() {
							$('html, body').animate({scrollTop: 0}, opts.duration);
						}).appendTo('body');
																			
		$(window).bind('scroll', function() {
			var scrollTop = $(document).scrollTop(),
				viewHeight = $(window).height();

			if(scrollTop <= opts.showScale) {
				if($scrollBtn.is(':visible'))
					$scrollBtn.fadeOut(500);
			} else {
				if($scrollBtn.is(':hidden')) 
					$scrollBtn.fadeIn(500);
			}

			if(isIE6()) {
				var top = viewHeight + scrollTop - $scrollBtn.outerHeight() - opts.bottom;
				$scrollBtn.css('top', top + 'px');
			}
		});

		function isIE6() {
			if($.browser.msie) {
				if($.browser.version == '6.0') return true;
			}
		}
	};			
	$.scrollBtn.defaults = {
		showScale: 100,  
		right:10,
		bottom:10,
		duration:200,
		title:'返回页顶'
	}
})(jQuery);
/**/
$(document).ready(function(){
    $.scrollBtn({
	    showScale: 200,
	    bottom:20,
	    right:20
    });
});
/*——*/









$(document).ready(function(){
	$('#navbarmenu > li').bind('mouseover', DropMenu_open);
	$('#navbarmenu > li').bind('mouseout',  DropMenu_timer);
});
/*——*/
$(document).ready(function(){
    ShowSlide(477,194,true,"mainslideBox","mainslidePic","mainslideNum",false,5,12,true,3000);
});
/*——*/
//$(document).ready(function(){
//    var scrtime;
//    $("#announcement").hover(function(){
//        clearInterval(scrtime);
//    },function(){
//        scrtime = setInterval(function(){
//            var $ul = $("#announcement ul");
//            var liHeight = $ul.find("li:last").height();
//            $ul.animate({marginTop : liHeight+0+"px"},500,function(){
//                $ul.find("li:last").prependTo($ul)
//                $ul.find("li:first").hide();
//                $ul.css({marginTop:0});
//                $ul.find("li:first").fadeIn(500);
//            });	
//        },5000);
//    }).trigger("mouseleave");
//});
/*——*/
$(document).ready(function(){
    var scrtime1;
    $("#HY_SJ").hover(function(){
        clearInterval(scrtime1);
    },function(){
        scrtime1 = setInterval(function(){
            var $div = $("#HY_SJ span");
            var blockquoteHeight = $div.find("blockquote:last").height();
            $div.animate({marginTop : blockquoteHeight+0+"px"},500,function(){
                $div.find("blockquote:last").prependTo($div)
                $div.find("blockquote:first").hide();
                $div.css({marginTop:0});
                $div.find("blockquote:first").fadeIn(500);
            });	
        },2000);
    }).trigger("mouseleave");
});