    $(window).scroll(function () {
        var bodyTop = 0,
        //bodyHeight = $(window).height(),
			 sideTop = $('.header-nav  .header-nav-main').eq(0).height() + 0;
        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) {
          $('.header-nav').css({'position':'fixed','top':'0','z-index':'99'});
        
        } else {
            $('.header-nav').css({position:'relative'});
			

        }
    });  
	
	
/* 侧边浮动内容 */
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');
	}
}
gotopcode = " \
	<div id=\"side_func\"> \
	 \
	<a class=\"sfa block1 tougao\" href=\"/tg.html\" target=\"_blank\" title=\"点击查看投稿要求\"><span>投稿</span></a> \
	<a class=\"sfa block2\" id=\"gocomm\" href=\"#SOHUCS\"><span>评论</span></a> \
	<a class=\"sfa block3\" id=\"gotop\" href=\"javascript:;\"  onfocus=\"this.blur()\"  style=\"display:none\"><span>顶部</span></a> \
	</div> \
"
document.write(gotopcode);
$('#side_func').prependTo('body');
window.setInterval("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;
});
$(function(){
	$(".header-nav .menu").click(function() {//显示或隐藏下方导航列表
                    $(".header-nav-main .layui-nav").slideToggle(100);
     });

});


function writeall020116(obj){
if (document.getElementById("commentcontent020116").value==''){
document.getElementById("commentcontent020116").value=document.getElementById("commentcontent020116disabled").value
}
//obj.select();
}


function clearall020116(obj){
if (document.getElementById("commentcontent020116disabled").value==document.getElementById("commentcontent020116").value){
document.getElementById("commentcontent020116").value=''
}
//obj.select();
}

function checkguest020116(frm) {
  frm.submit1.disabled = "true";
  	if (typeof(frm.commentcontent020116)!="undefined"){
  if (frm.commentcontent020116.value.trim().length < 2) {
layui.use('layer', function(){
var layer = layui.layer;
layer.msg('评论内容应大于2个字符'); 
});
    frm.submit1.disabled = 0;
    return false;
  }
if (frm.commentcontent020116.value.indexOf('请遵守法律法规') > -1) {
    
layui.use('layer', function(){
var layer = layui.layer;
layer.msg('请正确填写评论内容'); 
});
    frm.submit1.disabled = 0;
    return false;
}
  
}
  var patrn = /^[\s\S]{2,20}$/;
  	if (typeof(frm.username)!="undefined"){
  if (!patrn.test(frm.username.value.trim())) {
layui.use('layer', function(){
var layer = layui.layer;
layer.msg('昵称为2至20位字符'); 
});  
    frm.submit1.disabled = 0;
    return false;
  }
}

  var patrn = /^[0-9]{4,10}$/;
  	if (typeof(frm.vcode)!="undefined"){
  if (!patrn.test(frm.vcode.value.trim())) {
layui.use('layer', function(){
var layer = layui.layer;
layer.msg('验证码为4位及以上数字'); 
});  
    frm.submit1.disabled = 0;
    return false;
  }
}
document.getElementById("trdisnone").innerHTML = ("<iframe id=\"ifr1\" name=\"ifr1\" style=\"display:none;\"></iframe>");
  frm.submit();
    frm.submit1.disabled = 0;
  return false;
}
