$(document).ready(function () {

    var cur = 0;
    var t;
    $('.an').hover(
		function () { cur = 1; t = setTimeout(function () { $('.nav-item-1').addClass('ni1-bg'); $('.nl').slideDown(100); }, 50); },
		function () { clearTimeout(t); cur = 0; t = setTimeout(function () { if (cur != 1) { $('.nl').slideUp(100, function () { $('.nav-item-1').removeClass('ni1-bg'); }); } }, 50); }
	);

    /* quan圈 */
    $('.quan').hover(
		function () { t = setTimeout(function () { $('.nav-item-5').addClass('ni1-bg'); $('.nlquan').slideDown(100); }, 50); },
		function () { clearTimeout(t); $('.nlquan').slideUp(100, function () { $('.nav-item-5').removeClass('ni1-bg'); }); }
	);

    /* 顶部菜单 */
    $('.dm').hover(
		function () { var e = $(this); t = setTimeout(function () { e.find('.menu').stop().slideDown(200); }, 50); $(this).find('.item-link').addClass('dm_hover'); },
		function () { clearTimeout(t); $(this).find('.menu').stop().slideUp(150); $(this).find('.item-link').removeClass('dm_hover'); }
	);

    /* 搜索菜单 */
    $('.item-link-4').click(function () {
        $('.view_search').stop().slideToggle(300, function () { $('.sc').fadeIn(); $('#search-keyword').focus(); $('.item-link-4').addClass('il_4'); });
    });

    /* 高级搜索 */
    $('#search-keyword').click(function () {
        //$('.sc').css({'background':'#9e0021'});
        $('.extra_sc').slideDown(300);
        //$('.sc button').addClass('on');
        clearTimeout(t);
    });

    $('.sc').mouseleave(function () {
        t = setTimeout(function () {
            //$('.sc').css({'background':'none'});
            $('.extra_sc').slideUp(300);
            //$('.sc button').removeClass('on');
        }, 500);
    });

});

/* 侧边浮动内容 */
lastScrollY = 0;
function gotop() {
    var diffY;
    if (document.documentElement && document.documentElement.scrollTop)
        diffY = document.documentElement.scrollTop;
    else if (document.body)
        diffY = document.body.scrollTop;
    else
    {/*Netscape stuff*/ }
    percent = .1 * (diffY - lastScrollY);
    if (percent > 0) percent = Math.ceil(percent);
    else percent = Math.floor(percent);
    lastScrollY = lastScrollY + percent;
    
    if (lastScrollY < 100) { $("#gotop").fadeOut('fast'); } else { $("#gotop").fadeIn('fast'); }
}
var commentText = "评论";
if (document.domain.indexOf("www.qqpaopao.com") >= 0)
{
	commentText = "评论";
}
gotopcode = " \
	<div id=\"side_func\"> <!--\
	<a class=\"sfa block1 joinus\" href=\"http://www.qqpaopao.com/\" title=\"泡泡乐园\"><span class=\"text1\"><img src=/images/pao.png></span><span class=\"text2\" style=\"display:none;\"><img src=/images/pao.png></span></a> \
	<a class=\"app\"><span >手机APP</span></a>\
		<a class=\"sfa block1\" href=\"http://www.qqpaopao.com/\" target=\"_blank\" ><img src=\"/images/app.png\" /></a> \
	<a class=\"weixin\"><span >微信公众</span></a>\
		<a class=\"sfa block1\" href=\"http://www.qqpaopao.com/\" target=\"_blank\" ><img src=\"/images/wxgz.png\" /></a>--> \
		<a class=\"sfa block2\" id=\"gocomm\" href=\"#SOHUCS\" onclick=\"javascript:goanswer();\">" + commentText + "</a> \
	<a class=\"sfa block3\" id=\"gotop\" href=\"javascript:;\" title=\"返回顶部\" onfocus=\"this.blur()\" style=\"display:none\"><span>返回<br />顶部</span></a> \
	</div>"
document.write(gotopcode);
$('#side_func').prependTo('body');
window.setInterval("gotop()", 500);
//window.setTimeout("gotop()", 1);

$('#side_func a.joinus').hover(
	function () { $(this).find('span.text1').css({ 'display': 'none' }); $(this).find('span.text2').css({ 'display': 'block' }); },
	function () { $(this).find('span.text2').css({ 'display': 'none' }); $(this).find('span.text1').css({ 'display': 'block' }); }
);

$("#gotop").click(function () {
    $("html,body").animate({ scrollTop: 0 }, 200);
    return false;
});

$('#gocomm,.pti_comm').click(function () {
    var href = $(this).attr("href");
    var pos = $(href).offset().top - 35;
    $("html,body").animate({ scrollTop: pos }, 200);
    return false;
});

hd_float="<div id=\"hd_float\" style=\"position:fixed;left:50%;bottom:260px;margin-left:-690px;width:166px;\"><!--<a class=\"close\" href=\"http://www.qqpaopao.com/\" target=\"_blank\" style=\"display:block;width:146px;height:213px;background:url(/images/11.png) no-repeat;\"></a>--></div>"

document.write(hd_float);
$('#hd_float').prependTo('body');

    /* 浮动内容 */
    $(window).scroll(function () {
        var bodyTop = 0,
        //bodyHeight = $(window).height(),
			 sideTop = $('.sidebar ul').eq(0).height() + 142;
        if (typeof window.pageYOffset != 'undefined') {
            bodyTop = window.pageYOffset;
        } else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
            bodyTop = document.documentElement.scrollTop;
        } else if (typeof document.body != 'undefined') {
            bodyTop = document.body.scrollTop;
        }
        if (bodyTop > sideTop) {
            $('#crf1').css({ 'position': 'fixed', 'top': '53px' });
        } else {
            $('#crf1').css({ 'position': 'relative', 'top': '0px' });
        }
    });