
    //表单提交
    //var post_review_url ='';//所引用页中必需得新设置此项
    $('#reviewForm').submit(function(){
    	var comment_btn = $(".comment-ft");
    	if (typeof(post_review_url)=="undefined") {
			tuzi.alert('js错误：post_review_url 未定义');
			return false;
    		//comment_btn.find("span").remove().end().append('<span class="error">js错误：post_review_url 未定义</span>');
    		//return false;
    	}

   		if (post_review_url == '') {
   			tuzi.alert('js错误：post_review_url 未定义');
			return false;
    		//comment_btn.find("span").remove().end().append('<span class="error">js错误：post_review_url 未定义</span>');
    		//return false;
    	}
        var comment_content = $("textarea[name='comment_content']");
		if($.trim(comment_content.val())==''){
		    tuzi.alert('请输入内容');
			return false;
            //comment_btn.find("span").remove().end().append("<span class='error'>内容不能为空1111</span>");
            //return false;
        }
        
        var verify = $("input[name='verify']");
		if($.trim(verify.val())==''){
		    tuzi.alert('请填写验证码');
			return false;
            //comment_btn.find("span").remove().end().append("<span class='error'>内容不能为空1111</span>");
            //return false;
        }

        var _postForm = $('#reviewForm').serialize();
        $.post(post_review_url,_postForm,function(data){
            if(data.status == 1) {
                if (data.review_id == 0) {
				   	tuzi.alert('评论成功，等待审核');
					//return false;
                    //comment_btn.find("span").remove().end().append("<span>评论成功</span>");
                    var html = '<div class="comment-item review_item_list">'+
                                '<div class="comment-hd">'+                           
                                '<div class="new_comments_left"><img src="' + data.comment_pic + '"></div>'+
								'<div class="new_comments_right">' + 
                                '<span class="username">' + data.comment_username + '</span>' + 
                                '<span class="commment-time">' + data.comment_time +'&nbsp;&nbsp;'+ data.comment_ip +'</span>'+
                                '</div>'+
								'</div>'+
                                '<p class="new_comments_right_pxia" id="' + data.id + '">'+ comment_content.val() + 
                                '</p>'+
                                '</div>';
                    $('.comment-box h3').after(html);
                    $('.review-count').text(parseInt($('.review-count').text())+1);
                    //$("html,body").animate({scrollTop: $(".comment-box h3").offset().top}, 500); 
                }else {

                    var html = '<div class="comment-item reply-item" id="' + data.id + '">'+
                                '<a class="avatar" user_id="'+data.user_id+'" href="#" target="_blank">'+
                                '<img src="'+ data.avatar+'" />'+
                                '</a>'+
                                '<span class="username">' + data.comment_username + '</span>' + 
                                '<span class="commment-time">' + data.comment_time + '</span>'+
                                '</div>'+
                                '<div class="comment-bd">'+
                                '<div>' + data.comment_content + '</div>'+
                                '</div>'
                                '</div>';
                        //$('#' + data.review_id).after(html);
                        $('#reviewForm').before(html);
                }
                comment_content.val('');

                return false;
            } else if(data.status == 0) {
				tuzi.alert('验证码错误');
				return false;
                comment_btn.find("span").remove().end().append("<span class='error'>"+ data.info +"</span>");
                //alert(data);
            } else if(data.status == 2) {
				tuzi.alert('请先登录');
				return false;
                comment_btn.find("span").remove().end().append("<span class='error'>"+ data.info +"</span>");
                //alert(data);
            } else if(data.status == 3) {
				tuzi.alert('评论系统关闭');
				return false;
                comment_btn.find("span").remove().end().append("<span class='error'>"+ data.info +"</span>");
                //alert(data);
            } else {			
				tuzi.alert('评论失败，请检查代码');
				return false;
                comment_btn.find("span").remove().end().append("<span class='error'>--</span>");
                
            }
        },'json');
        
        return false;
    });


//评论JS
$(function(){
  $('#q-com-form').submit(function(event){
    event.preventDefault();
    var _this=$(this);
    var _name=$('.user-name').text();
    var _content=_this.find('textarea').val();
    var comList=$('.q-comment-list ul li');
    $.ajax({
      type:'POST',
      url:_this.attr('action'),
      data:_this.serialize(),
      dataType:'json',
      success:function(d){
        if(d.s==0){
          blue.alert('评论需要通过审核才能展示')
          if(comList.length>0){
            comList.eq(0).before('<li><h3><a href="javascript:void(0);" target="_blank">'+_name+'</a></h3><div class="q-comment-body">'+_content+'</div><p class="clearfix"><span>刚刚</span></p></li>');
          }else{
            $('.q-comment-list ul').append('<li><h3><a href="javascript:void(0);" target="_blank">'+_name+'</a></h3><div class="q-comment-body">'+_content+'</div><p class="clearfix"><span>刚刚</span></p></li>');
          }
        }else{
          blue.alert(d.msg,d.s)
        }
      }
    });
  });
});


//新闻列表tab加载
$(function(){
  $('.index_list').off('click','.list-tab-more');
  $('.index_list').on('click','.list-tab-more',function(event){
    event.preventDefault();
    var _url=$(this).attr('href');
    var _parent=$(this).parents('.index_list')
    $.get(_url,function(d){
      _parent.find('.ajax-more').remove();
      _parent.append(d);
    });
  });
});

//下拉菜单
$(function(){
  $('.news_menu ul li').hover(function(){
    if($(this).find('ul').length>0){
      $(this).addClass('hover');
      $(this).find('ul').stop(true).slideDown(300);
    }else{
      return false;
    };
  },function(){
    $(this).removeClass('hover');
    $(this).find('ul').stop(true).slideUp(300);
  });
});

//列表页加载更多独立出来
$(function(){
  $('#mainbox').off('click','.js_more_list')
  $('#mainbox').on('click','.js_more_list',function(event){
    event.preventDefault()
    var _this=$(this);
    var box=_this.attr('data-box');
    var url=_this.attr('href')
   $(box).append('<p class="loading" style="padding:10px; font-size:13px; color:#666; text-align:center">载入中...</p>');
    $.get(url,function(d){
    _this.remove();
    $(box).find('.loading').remove();
    $(box).append(d);
    });
  });
});
