﻿/// <reference path="jQuery.js" />
//错误处理显示，共用

/******************************************************************/
//教育团体密码访问处理
/******************************************************************/
function CheckCirclePwdAccess(circleId) {
    var password = jQuery("#AccessPwd").val();
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pwd: '" + password + "',circleId:'" + circleId + "'}",
        dataType: "json",
        url: "/Service/CircleService.asmx/CheckCirclePwdAccess",
        success: function(result) {
            if (result.d == false) {
                _error_msg_show("您输入的密码不正确，请重试!", '', 'sorry', "错误");
            }
            else {
                _error_msg_show("重定向中，请稍候...", '', 'succ', "成功");
                location.href = document.location;
            }
        }
    });
}


/******************************************************************/
//加载教育团体文章列表数据
/******************************************************************/
function InitCircleArticleListData(param, dataDivId,  pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;

    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    if (aParamValues["CalendarDate"] == null) {
        aParamValues["CalendarDate"] = "0";
    }
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    if (aParamValues["FromBlog"] == null) {
        aParamValues["FromBlog"] = 0;
    }
    if (aParamValues["CategoryId"] == null) {
        aParamValues["CategoryId"] = 0
    }
    
    var data;
    if (aParamValues["FromBlog"] == "0") {
        data = "{ circleId: '" + aParamValues["CircleId"] + "',pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',circleArticleCategoryId:'" + aParamValues["CategoryId"] + "',CalendarDate:'" + aParamValues["CalendarDate"] + "',dns:'" + aParamValues["ReqDns"] + "', moreMenuId: '" + aParamValues["MoreMenuId"] + "',categoryGroupId:'" + (aParamValues["CategoryGroupId"] == null ? 0 : aParamValues["CategoryGroupId"]) + "',articleNature:'" + (aParamValues["ArticleNature"] == null ? 0 : aParamValues["ArticleNature"]) + "',articleFrom:'" + (aParamValues["ArticleFrom"] == null ? 0 : aParamValues["ArticleFrom"]) + "',imageShow:'" + (aParamValues["ImageArticleCategoryShowType"] == null ? "0" : aParamValues["ImageArticleCategoryShowType"]) + "'}";
    }
    else {
        data = "{ circleId: '" + aParamValues["CircleId"] + "',pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',circleArticleCategoryId:'" + aParamValues["CategoryId"] + "',CalendarDate:'" + aParamValues["CalendarDate"] + "',dns:'" + aParamValues["ReqDns"] + "', moreMenuId: '" + aParamValues["MoreMenuId"] + "',categoryGroupId:'" + (aParamValues["CategoryGroupId"] == null ? 0 : aParamValues["CategoryGroupId"]) + "',articleNature:'" + (aParamValues["ArticleNature"] == null ? 0 : aParamValues["ArticleNature"]) + "',articleFrom:'" + (aParamValues["ArticleFrom"] == null ? 0 : aParamValues["ArticleFrom"]) + "',imageShow:'" + (aParamValues["ImageArticleCategoryShowType"] == null ? "0" : aParamValues["ImageArticleCategoryShowType"]) + "',t:'1'}";
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: data,
        dataType: "json",
        url: aParamValues["FromBlog"] == "0" ? "/Service/CircleService.asmx/GetCircleArticleList" : "/Service/CircleService.asmx/GetCircleArticleListByT",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], aParamValues["IsFixed"]);
            jQuery(div).addClass("clearfix Box");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                if (aParamValues["ImageArticleCategoryShowType"] == "1") {
                    jQuery(div).append(CreateCircleArticleListForPic(item, aParamValues));
                }
                else {
                    switch (aParamValues["PostShowMode"]) {
                        case "0":
                            jQuery(div).append(CreateCircleArticleSummaryList(item, aParamValues));
                            if (item != null)
                                jQuery(div).append(CreateFuncNav(item, aParamValues));
                            break;
                        case "1":
                            jQuery(div).append(CreateCircleArticleList(item, aParamValues));
                            break;
                    }
                }
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitCircleArticleListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
            SetAllVideoArticleImage();
        }
    });

}

//图片列表显示
function CreateCircleArticleListForPic(item, aParamValues) {
    var str = "<div class=\"text-float-left TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.Title) + "\">" +
                  "<div class=\"Photo\" style=\"width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";\">" + (item == null ? "" : "<a href=" + item.Url + " target='_blank'>" + item.CoverImage + "</a>");
    if (item.IsVideoArticle == "1") {
        str += "<div style=\"position: relative;\"><img src=\"/Images/Video/play.jpg\" li=\"VideoArticleImage\" style=\"display:none;\" /></div>";
    }  
                  
             str +=     "</div>" +
                  "<div class=\"text-float-left TitleIcon\"></div>" +
                  "<div class=\"text-overflow Title\" style=\"width:80px;\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>" + item.Title + "</a>") + "</div>" +
              "</div>";
    return str;
}

//列表显示
function CreateCircleArticleList(item, aParamValues) {
    var str = "<div class=\"TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.Title) + "\">";
    if (aParamValues["IsShowTime"] == 1) {
        str += "<div class=\"text-float-right Date\">" + (item == null ? "&nbsp;" : GetDateFormat(aParamValues["TimeFormat"], new Date(parseInt(item.UpdateTime.substring(6, item.UpdateTime.length - 2))))) + "</div>";
    }
    if (aParamValues["IsShowUser"] == 1) {
        str += "<div class=\"text-float-right Name\">" + (item == null ? "&nbsp;" : "<a href=" + item.UserUrl + ">" + item.UserName + "</a>") + "</div>";
    }
    if (item != null && aParamValues["IsShowTopFlag"] == 1 && item.Top == 1) {
        str += "<div class=\"text-float-right Top\"></div>";
    }
    str += "<div class=\"text-float-left TitleIcon\"></div>";
    if (aParamValues["IsShowCategory"] == 1) {
        str += "<div class=\"text-float-left Category\" title=\"所属类别\">" + (item == null ? "&nbsp;" : "<a href=" + item.CategoryUrl + ">" + item.CategoryName + "</a>") + "</div>";
    }
    str += "<div class=\"text-overflow Title\">" + (item == null ? "&nbsp;" : (item.IsVideoArticle == "1" ? "<img src=\"/Images/Video/v_ico.gif\" boader=0 align=\"absMiddle\" />" : (item.IsImageArticle == "1" ? "(图)" : ""))) + (item == null ? "&nbsp;" : "<a href=" + item.Url + " " + (aParamValues["FromBlog"] == "0" ? "target='_blank'" : "") + ">" + item.Title + "</a>") + "</div>";
    str += "</div>";
    return str;
}
//文章摘要列表显示
function CreateCircleArticleSummaryList(item, aParamValues) {
    var str = "<div class=\"TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.Title) + "\">";
    if (item != null && aParamValues["IsShowTopFlag"] == 1 && item.Top == 1) {
        str += "<div class=\"text-float-right Top\"></div>";
    }
    str += "<div class=\"text-float-left TitleIcon\"></div>" +
           "<div class=\"text-overflow Title\">" + (item == null ? "&nbsp;" : (item.IsVideoArticle == "1" ? "<img src=\"/Images/Video/v_ico.gif\" boader=0 align=\"absMiddle\" />" : (item.IsImageArticle == "1" ? "(图)" : ""))) + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>" + item.Title + "</a>") + "</div>";
    if (item != null && item.PasswordAccess == 3) {
        str += "<div class='PwdFont' width=\"100%\" align=\"center\" id=\"CircleArticleList_Pwd_" + item.ArticleId + "\">" + "请输入访问密码：<input type=\"password\" class='PwdBox' name=\"CircleArticleAccessPwd\" onfocus=\"setKeyDown('CircleArticleAccessPwd_" + item.ArticleId + "','CircleArticleAccessPwd_" + item.ArticleId + "','btnCircleArticleAccessPwd" + item.ArticleId + "')\" id=\"CircleArticleAccessPwd_" + item.ArticleId + "\"><input id=\"btnCircleArticleAccessPwd" + item.ArticleId + "\" class='PwdButton' type=\"button\" onclick=\"javascript:CheckCircleArticlePwdAccess(" + item.ArticleId + ");\" value=\"确定\"  />" + "</div>";
        str += "<div class=\"text-wrap Brief\" style=\"display:none;\" id=\"" + (item == null ? "&nbsp;" : "CircleArticleList_" + item.ArticleId) + "\">" + (item == null ? "" : item.Brief) + "</div>";
    }
    else {
        str += "<div class=\"text-wrap Brief\" id=\"" + (item == null ? "&nbsp;" : "CircleArticleList_" + item.ArticleId) + "\">" + (item == null ? "" : item.Brief) + "</div>";
    }

    str += "<div class=\"View\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>[查看全文]</a>") + "</div></div>";

    return str;
}
//文章密码验证
function CreateCircleArticlePwdForRepeater(ArticleId) {
    var str = "";
    str = "<div class='PwdFont' width=\"100%\" align=\"center\" id=\"CircleArticleList_Pwd_" + ArticleId + "\">" + "请输入访问密码：<input type=\"password\" class='PwdBox' name=\"CircleArticleAccessPwd\" onfocus=\"setKeyDown('CircleArticleAccessPwd_" + ArticleId + "','CircleArticleAccessPwd_" + ArticleId + "','btnCircleArticleAccessPwd" + ArticleId + "')\" id=\"CircleArticleAccessPwd_" + ArticleId + "\"><input id=\"btnCircleArticleAccessPwd" + ArticleId + "\" class='PwdButton' type=\"button\" onclick=\"javascript:CheckCircleArticlePwdAccess(" + ArticleId + ");\" value=\"确定\"  />" + "</div>";

    return str;
}
//功能导航
function CreateFuncNav(item, aParamValues) {
    var str = "<div style=\"width:100%\">";
    if (aParamValues["IsShowCategory"] == 1) {
        str += "<div class=\"text-float-right Category\">分类：<a href=" + item.CategoryUrl + ">" + item.CategoryName + "</a></div>";
    }
    if (item.CopyFrom == 0) {
        str += "<div class=\"text-float-right Implement\"><a href=" + item.Url + "#Comments target='_blank'>评论</a> <a href=" + item.Url + " target='_blank'>阅读</a> <a href='javascript:void(0)' onclick=\"javascript:SetReport(" + item.ArticleId + ",2,'" + aParamValues["PathPrefix"] + "')\">举报</a></div>";
    }
    else {
        str += "<div class=\"text-float-right Implement\"><a href=/OperationManage/recordStatTime.aspx?pkId=" + item.ArticleId + " target='_blank'>评论</a> <a href=" + aParamValues["PathPrefix"] + "OperationManage/recordStatTime.aspx?pkId=" + item.ArticleId + " target='_blank'>阅读</a> <a href='javascript:void(0)' onclick=\"javascript:SetReport(" + item.ArticleId + ",2,'" + aParamValues["PathPrefix"] + "')\">举报</a></div>";
    }
    if (aParamValues["IsShowUser"] == 1) {
        str += "<div class=\"text-float-right Name\"><a href=" + item.UserUrl + ">" + item.UserName + "</a></div>";
    }
    if (aParamValues["IsShowTime"] == 1) {
        str += "<div class=\"text-float-right Date\">发布时间：" + GetDateFormat(aParamValues["TimeFormat"], new Date(parseInt(item.UpdateTime.substring(6, item.UpdateTime.length - 2)))) + "</a></div>";
    }
    str += "</div>";

    return str;
}


/******************************************************************/
//加载教育团体日历
/******************************************************************/
function InitCircleCalendarData(param, dataDivId) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    var div = GetContentDiv(aParamValues);
    div.className = "clearfix Box"; //整体样式 
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    parent.Calendar().Init(function(y, m, d, objectId, dns, moreMenuId, type, callback) { parent.jQuery.ajax({ type: "POST", contentType: "application/json", data: "{ y: '" + y + "',m:'" + m + "', d:'" + d + "',objectId:'" + objectId + "',dns:'" + dns + "',moreMenuId:'" + moreMenuId + "', type: '" + type + "'}", dataType: "json", url: "/Service/Calendar.asmx/HitDay", success: function(msg) { callback(msg.d); } }); }, function(y, m, direction, type, objectId, callback) { parent.jQuery.ajax({ type: "POST", contentType: "application/json", data: "{ y: '" + y + "',m:'" + m + "', direction:'" + direction + "',type:'" + type + "',objectId:'" + objectId + "'}", dataType: "json", url: "/Service/Calendar.asmx/HitMonth", success: function(msg) { callback(msg.d); } }); }, function(response) { parent.location.href = response; ; }, div, "circle", aParamValues["CircleId"], aParamValues["CircleId"], aParamValues["ReqDns"], aParamValues["MoreMenuId"]);
    InitContentDiv(aParamValues, div);
}

/******************************************************************/
//加载教育团体用户数据
/******************************************************************/
function InitCircleUserListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    if (aParamValues["PageSize"] == null) {
        aParamValues["PageSize"] = 10;
    }
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{circleId:'" + aParamValues["CircleId"] + "',pageIndex:'" + pageIndex + "',pageSize:'" + aParamValues["PageSize"] + "',dns:'" + aParamValues["ReqDns"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "'}",
        dataType: "json",
        url: "/Service/CircleService.asmx/GetCircleUserList",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], aParamValues["IsFixed"]);
            jQuery(div).addClass("clearfix Box");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                switch (aParamValues["PostShowMode"]) {
                    case "0":
                        jQuery(div).append(CreateCircleUserListData(item, aParamValues));
                        break;
                    case "1":
                        jQuery(div).append(CreateCircleUserListDataForPhoto(item, aParamValues));
                        break;
                }
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div style=\"width:100%;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitCircleUserListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav") + "</div>"); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}

//带照片显示
function CreateCircleUserListDataForPhoto(item, aParamValues) {

    var s1 = document.createElement("div");
    s1.className = "Photo"; //照片样式
    s1.innerHTML = item == null ? "&nbsp;" : item.Photo;
    if (s1.document.getElementById("UserPhoto") != null) {
        s1.document.getElementById("UserPhoto").style.width = "100%";
        s1.document.getElementById("UserPhoto").style.height = "100%";
    }

    var str = "<div class=\"text-float-left TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.FullName) + "\">";
    if (item != null && item.BlogId != 0) {
        str += "<div class=\"Photo\" style=\"width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";\"><a href=" + item.Url + " target=_blank>" + s1.innerHTML + "</a></div>";
    }
    else {
        str += "<div class=\"Photo\" style=\"width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";\">" + (item == null ? "&nbsp;" : s1.innerHTML) + "</div>";
    }
    str += "<div class=\"text-float-left TitleIcon\"></div>";
    if (item != null && item.BlogId != 0) {
        str += "<div class=\"Title\"><a href=" + item.Url + " target=_blank>" + item.FullName + "</a></div>";
    }
    else {
        str += "<div class=\"Title\">" + (item == null ? "&nbsp;" : item.FullName) + "</div>";
    }
    if (item != null && item.DutyName == "") {
        str += "<div class=\"Duty\">职务：无</div>";
    }
    else {
        str += "<div class=\"Duty\">" + (item == null ? "&nbsp;" : "职务：" + item.DutyName) + "</div>";
    }
    if (item != null && item.Identity == "") {
        str += "<div class=\"Iden\">身份：无</div>";
    }
    else {
        str += "<div class=\"Iden\">" + (item == null ? "&nbsp;" : "身份：" + item.Identity) + "</div>";
    }
    str += "</div>";

    return str;
}
//列表显示
function CreateCircleUserListData(item, aParamValues) {
    var str = "<div class=\"TitleBox\">";
    if (item != null && item.DutyName != "") {
        str += "<div class=\"text-float-right Duty\">" + item.DutyName + "</div>";
    }
    if (item != null && item.Identity != "") {
        str += "<div class=\"text-float-right Iden\">" + item.Identity + "</div>";
    }
    str += "<div class=\"text-float-left TitleIcon\"></div>";
    if (item != null && item.BlogId != 0) {
        str += "<div class=\"text-overflow Title\" title=\"" + (item == null ? "&nbsp;" : item.FullName) + "\"><a href=" + item.Url + " target=_blank>" + item.FullName + "</a></div>";
    }
    else {
        str += "<div class=\"text-overflow Title\" title=\"" + (item == null ? "&nbsp;" : item.FullName) + "\">" + (item == null ? "&nbsp;" : item.FullName) + "</div>";
    }
    str += "</div>";

    return str;
}


// 教育团体关联
function selectMember(path, circleId, obj, obj1) {
    var item = document.getElementById(obj);
    showModalDialog("" + path + "CircleManage/selectCircleMember.aspx?circleId=" + circleId + "&identity=" + item.options[item.selectedIndex].value + "&obj=" + obj1, window, "dialogWidth:300px;dialogHeight:400px;help:no;scroll:no;status:no");
}
function selectCircleMember(circleId, identityId, obj1) {
    showModalDialog("selectCircleMember.aspx?circleId=" + circleId + "&identity=" + identityId + "&obj=" + obj1, window, "dialogWidth:300px;dialogHeight:400px;help:no;scroll:no;status:no");
}
function bindSelectedUser(obj, fullName, userId) {
    var txtFullName, hiddenUserId
    if (obj == "ddlIdentity") {
        txtFullName = document.getElementById("txtCorrelativeUser");
        hiddenUserId = document.getElementById("hiddenUserId");
    }
    else {
        txtFullName = document.getElementById(obj + "_txtCorrelativeUser");
        hiddenUserId = document.getElementById(obj + "_hiddenUserId");
    }
    txtFullName.value = fullName;
    hiddenUserId.value = userId;
}


/******************************************************************/
// 生日榜祝福语
/******************************************************************/
function ShowBirthdayWish(circleId, userId) {
    openWindow('/OperationManage/WishIndex.aspx?circleId=' + circleId + '&userId=' + userId, '450', '345', '生日祝福', '生日祝福');
}
/******************************************************************/
// 加载用户关系
/******************************************************************/
function InitUserCorrelativeData(userId, circleId) {
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ userId: '" + userId + "',circleId:'" + circleId + "'}",
        dataType: "json",
        url: "/Service/CircleService.asmx/GetUserCorrelative",
        success: function(result) {
            jQuery("#UserCorrelative").html("");
            jQuery.each(result.d, function(i, item) {
                var str = "<div align=\"center\"><a href=" + item.Url + " target=_blank>" + item.Photo + "</a>" + item.Name + "(" + item.Appellation + ")   -->  <a href=" + item.CorrelativeUrl + " target=_blank>" + item.CorrelativePhoto + "</a>" + item.CorrelativeName + "(" + item.CorrelativeAppellation + ")</div>";
                jQuery("#UserCorrelative").append(str);
            });
        }
    });
}

/******************************************************************/
//加载文章评论
/******************************************************************/
function InitArticleComments(articleId) {
    document.getElementById("Comments").innerText = "数据加载中...";
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ articleId: '" + articleId + "'}",
        dataType: "json",
        url: "/Service/CircleService.asmx/GetCircleCommentsByArticleId",
        success: function(result) {
            jQuery("#Comments").html("");
            jQuery.each(result.d, function(i, item) {
                var str = "<div><div class=\"Name\" align=\"left\">昵称：" + item.NickName + "&nbsp;&nbsp;&nbsp;&nbsp;" + item.UserIden + "</div><div class=\"text-float-right Date\">" + (new Date(parseInt(this.CommentDate.substring(6, this.CommentDate.length - 2))).formatt("yyyy-MM-dd hh:mm:ss")) + "</div><div class=\"Content\" align=\"left\">" + item.Content + "</div></div>";
                jQuery("#Comments").append(str);
            });
        }
    });
}


/******************************************************************/
//教育团体横幅
/******************************************************************/
function InitCircleBannerData(param, dataDivId, imgDivId, nameDivId, urlDivId) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;

    var div = GetContentDiv(aParamValues);
    if (div.id != dataDivId) {
        div.innerHTML = $(dataDivId).innerHTML;
    }
    var pos = GetPosition(div);
    var imgDiv = parent.document.getElementById(imgDivId);
    var nameDiv = parent.document.getElementById(nameDivId);
    var urlDiv = parent.document.getElementById(urlDivId);

    //获取总宽度	
    var width = div.parentNode.parentNode.style.width;
    width = width.replace("px", "");
    var height;

    if (aParamValues["BannerFile"] != null && aParamValues["BannerFile"] != "null" && aParamValues["BannerFile"] != "") {
        height = width * aParamValues["BannerScale"];
        if (navigator.userAgent.indexOf("MSIE") > 0) {
            imgDiv.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/" + aParamValues["BannerFile"] + "', sizingMethod='scale')";
        }
        else {
            imgDiv.style.background = "url(/" + aParamValues["BannerFile"] + ") repeat center";
        }
    }
    else {
        w = GetCssWidth("CircleBanner", "BannerBox");
        h = GetCssHeight("CircleBanner", "BannerBox");
        height = width * (h / w);
    }

    imgDiv.style.height = height + "px";
    imgDiv.style.width = width + "px";

    nameDiv.style.cssText = "position:relative;left:120px;top:" + (height / 2 - 15) + "px;float:left;overflow-x:hidden;white-space:nowrap; z-index:10";
    urlDiv.style.cssText = "position:relative;left:50px;top:" + (height / 2 + 15) + "px;float:left;overflow-x:hidden;white-space:nowrap; z-index:10";

    InitContentDiv(aParamValues, div);
}
function ClipBoard(test) {
    CopyToClipboard(test);

    _error_msg_show("已经把该团体网址复制到系统剪贴板，您可以使用（Ctrl+V或鼠标右键）粘贴功能，通过其他软件记录或发送给您的朋友。", '', 'succ', "成功");
}



/******************************************************************/
//加载团体相册
/******************************************************************/
function InitCircleAlbumListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    if (aParamValues["NewsMenuId"] == null) {
        aParamValues["NewsMenuId"] = 0;
    }
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    if (aParamValues["FromBlog"] == null) {
        aParamValues["FromBlog"] = 0;
    }
    var data;
    if (aParamValues["FromBlog"] == "0") {
        data = "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',circleId:'" + aParamValues["CircleId"] + "',newsMenuId:'" + aParamValues["NewsMenuId"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "', dns: '" + aParamValues["ReqDns"] + "'}";
    }
    else {
        data = "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',circleId:'" + aParamValues["CircleId"] + "',newsMenuId:'" + aParamValues["NewsMenuId"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "', dns: '" + aParamValues["ReqDns"] + "',t:'1'}";
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: data,
        dataType: "json",
        url: aParamValues["FromBlog"] == "0" ? "/Service/CircleService.asmx/GetCircleAlbum" : "/Service/CircleService.asmx/GetCircleAlbumByT",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.CList, aParamValues["PageSize"], aParamValues["IsFixed"]);
            jQuery(div).addClass("clearfix Box");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                var str = "<div class=\"text-float-left TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.Name) + "\">" +
                              "<div class=\"Photo\" style=\"overflow:hidden;width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " " + (item.OpenMode == 1 ? "target='_blank'" : "") + ">" + item.CoverPhoto + "</a>") + "</div>" +
                              "<div class=\"text-float-left TitleIcon\"></div>" +
                              "<div class=\"Title text-overflow\" style=\"width:110px;\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " " + (item.OpenMode == 1 ? "target='_blank'" : "") + ">" + item.Name + "</a>") + "</div>" +
                              "<div class=\"Date\">" + (item == null ? "&nbsp;<br>&nbsp;" : (new Date(parseInt(item.CreatTime.substring(6, item.CreatTime.length - 2)))).formatt("yyyy-MM-dd") + "<br>" + item.Nums + "张图片") + "</div>" +
                              "<div class=\"Origan text-overflow\" style=\"width:110px;\" title=\"" + (item == null ? "&nbsp;" : item.Origan) + "\">" + (item == null ? "&nbsp;" : item.Origan) + "</div>" +
                          "</div>";
                jQuery(div).append(str);
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div style=\"width:300px;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitCircleAlbumListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav") + "</div>"); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}


/******************************************************************/
//加载教育团体讨论区列表数据
/******************************************************************/
function InitCircleDiscussListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;

    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }

    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    if (aParamValues["NewsMenuId"] == null) {
        aParamValues["NewsMenuId"] = 0;
    }
    if (aParamValues["FromBlog"] == null) {
        aParamValues["FromBlog"] = 0;
    }
    var data;
    if (aParamValues["FromBlog"] == "0") {
        data = "{ circleId:'" + aParamValues["CircleId"] + "', postShowType:'" + aParamValues["PostShowType"] + "',pageIndex:'" + pageIndex + "',pageSize:'" + aParamValues["PageSize"] + "',dns:'" + aParamValues["ReqDns"] + "', moreMenuId: '" + aParamValues["MoreMenuId"] + "',newsMenuId:'" + aParamValues["NewsMenuId"] + "'}";
    }
    else {
        data = "{ circleId:'" + aParamValues["CircleId"] + "', postShowType:'" + aParamValues["PostShowType"] + "',pageIndex:'" + pageIndex + "',pageSize:'" + aParamValues["PageSize"] + "',dns:'" + aParamValues["ReqDns"] + "', moreMenuId: '" + aParamValues["MoreMenuId"] + "',newsMenuId:'" + aParamValues["NewsMenuId"] + "',t:'1'}";
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: data,
        dataType: "json",
        url: aParamValues["FromBlog"] == "0" ? "/Service/CircleService.asmx/GetCircleDiscussList" : "/Service/CircleService.asmx/GetCircleDiscussListByT",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], aParamValues["IsFixed"]);
            jQuery(div).addClass("clearfix Box");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                switch (aParamValues["PostShowMode"]) {
                    case "0": //列表显示                       
                        jQuery(div).append(CreateCircleDiscussList(item, aParamValues))
                        break;
                    case "1": //平铺显示                       
                        jQuery(div).append(CreateCircleDiscussListForTile(item, aParamValues))
                        break;
                }
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div style=\"width:100%;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitCircleDiscussListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav") + "</div>"); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}
//列表显示
function CreateCircleDiscussList(item, aParamValues) {
    var content = document.createElement("div");
    var link = document.createElement("div");
    link.className = "TitleBox";
    link.title = item == null ? "&nbsp;" : item.Title;

    if (aParamValues["IsShowRestore"] == 1) {
        var sname = document.createElement("div");
        sname.className = 'text-float-right RestoreName'; //回复者名称样式	
        sname.innerHTML = item == null ? "&nbsp;" : item.RestoreUser;
        sname.style["padding-left"] = "5px";
        sname.title = "最后回应者";
        link.appendChild(sname);

        var stime = document.createElement("div");
        stime.className = 'text-float-right RestoreTime'; //回复时间样式	
        stime.innerHTML = item == null ? "&nbsp;" : item.RestoreTimeStr;
        stime.style["padding-left"] = "5px";
        stime.title = item == null ? "&nbsp;" : "最后回应时间：" + new Date(parseInt(item.RestoreTime.substring(6, item.RestoreTime.length - 2))).formatt("yyyy-MM-dd hh:mm:ss");
        link.appendChild(stime);
    }
    if (aParamValues["IsShowCount"] == 1) {
        var sviewcount = document.createElement("div");
        sviewcount.className = 'text-float-right ViewCount'; //浏览次数样式	
        sviewcount.innerHTML = item == null ? "&nbsp;" : item.ViewCount;
        sviewcount.style["padding-left"] = "5px";
        sviewcount.title = "浏览次数";
        link.appendChild(sviewcount);

        var sresotecount = document.createElement("div");
        sresotecount.className = 'text-float-right RestoreCount'; //回复次数样式	
        sresotecount.innerHTML = item == null ? "&nbsp;" : item.RestoreCount;
        sresotecount.style["padding-left"] = "5px";
        sresotecount.title = "回应次数";
        link.appendChild(sresotecount);
    }

    if (aParamValues["IsShowUser"] == 1) {
        var suser = document.createElement("div");
        suser.className = 'text-float-right Name'; //发布者名称样式
        if (item != null && item.UserUrl == "") {
            suser.innerHTML = item.UserName;
        }
        else {
            suser.innerHTML = item == null ? "&nbsp;" : "<a href=" + item.UserUrl + ">" + item.UserName + "</a>";
        }
        suser.style["padding-left"] = "5px";
        suser.title = "发布者";
        link.appendChild(suser);
    }

    var sicon = document.createElement("div");
    sicon.className = "text-float-left TitleIcon";
    link.appendChild(sicon)

    var s2 = document.createElement("div");
    s2.className = 'text-overflow Title'; //标题样式
    if (item != null && item.IsElite == 1) {
        s2.innerHTML = "<a href=" + item.Url + " " + (item.OpenMode == 1 ? "target='_blank'" : "") + ">[<font color=red>精华</font>]" + item.Title + "</a>";
    }
    else {
        if (item != null && item.IsTop == 1) {
            s2.innerHTML = "<a href=" + item.Url + " " + (item.OpenMode == 1 ? "target='_blank'" : "") + ">[<font color=blue>置顶</font>]" + item.Title + "</a>";
        }
        else {
            s2.innerHTML = item == null ? "&nbsp;" : "<a href=" + item.Url + " " + (item.OpenMode == 1 ? "target='_blank'" : "") + ">" + item.Title + "</a>";
        }
    }
    link.appendChild(s2);
    content.appendChild(link);
    return content.innerHTML;
}

//平铺显示
function CreateCircleDiscussListForTile(item, aParamValues, width, height) {
    var content = document.createElement("div");
    var link = document.createElement("div");
    var photo = document.createElement("div");
    var title = document.createElement("div");

    if (aParamValues["IsShowRestore"] == 1) {
        var sname = document.createElement("div");
        sname.className = 'text-float-right RestoreName'; //回复者名称样式	
        sname.innerHTML = item == null ? "&nbsp;" : item.RestoreUser;
        sname.style["padding-left"] = "5px";
        sname.title = "最后回应者";
        link.appendChild(sname);

        var stime = document.createElement("div");
        stime.className = 'text-float-right RestoreTime'; //回复时间样式	
        stime.innerHTML = item == null ? "&nbsp;" : "最新回应：" + item.RestoreTimeStr;
        stime.style["padding-left"] = "5px";
        stime.title = item == null ? "&nbsp;" : "最后回应时间：" + new Date(parseInt(item.RestoreTime.substring(6, item.RestoreTime.length - 2))).formatt("yyyy-MM-dd hh:mm:ss");
        link.appendChild(stime);
    }
    if (aParamValues["IsShowCount"] == 1) {
        var sviewcount = document.createElement("div");
        sviewcount.className = 'text-float-right ViewCount'; //浏览次数样式	
        sviewcount.innerHTML = item == null ? "&nbsp;" : "浏览：" + item.ViewCount;
        sviewcount.style["padding-left"] = "5px";
        sviewcount.title = "浏览次数";
        link.appendChild(sviewcount);

        var sresotecount = document.createElement("div");
        sresotecount.className = 'text-float-right RestoreCount'; //回复次数样式	
        sresotecount.innerHTML = item == null ? "&nbsp;" : "回应：" + item.RestoreCount;
        sresotecount.style["padding-left"] = "5px";
        sresotecount.title = "回应次数";
        link.appendChild(sresotecount);
    }

    if (aParamValues["IsShowUser"] == 1) {
        var suser = document.createElement("div");
        suser.className = 'text-float-right Name'; //发布者名称样式
        if (item != null && item.UserUrl == "") {
            suser.innerHTML = "来自：" + item.UserName + "[" + item.MemberTypeStr + "]";
        }
        else {
            suser.innerHTML = item == null ? "&nbsp;" : "来自：<a href=" + item.UserUrl + " target='_blank'>" + item.UserName + "</a>[" + item.MemberTypeStr + "]";
        }
        suser.style["padding-left"] = "5px";
        suser.title = "发布者";
        title.appendChild(suser);
    }

    var supdate = document.createElement("div");
    supdate.className = 'text-float-right Date'; //发布时间样式	
    supdate.innerHTML = item == null ? "&nbsp;" : item.UpdateTimeStr;
    supdate.style["padding-left"] = "5px";
    supdate.title = item == null ? "&nbsp;" : "发布时间：" + new Date(parseInt(item.UpdateTime.substring(6, item.UpdateTime.length - 2))).formatt("yyyy-MM-dd hh:mm:ss");
    title.appendChild(supdate);

    var sicon = document.createElement("div");
    sicon.className = "text-float-left TitleIcon";
    title.appendChild(sicon);

    var s2 = document.createElement("div");
    s2.className = 'text-overflow Title'; //标题样式
    s2.title = item == null ? "&nbsp;" : item.Title;
    s2.style["padding-left"] = "5px";
    if (item != null && item.IsElite == 1) {
        s2.innerHTML = "<a href=" + item.Url + " " + (item.OpenMode == 1 ? "target='_blank'" : "") + ">[<font color=red>精华</font>]" + item.Title + "</a>";
    }
    else {
        if (item != null && item.IsTop == 1) {
            s2.innerHTML = "<a href=" + item.Url + " " + (item.OpenMode == 1 ? "target='_blank'" : "") + ">[<font color=blue>置顶</font>]" + item.Title + "</a>";
        }
        else {
            s2.innerHTML = item == null ? "&nbsp;" : "<a href=" + item.Url + " " + (item.OpenMode == 1 ? "target='_blank'" : "") + ">" + item.Title + "</a>";
        }
    }
    title.appendChild(s2);
    if (item != null && item.UserUrl == "") {
        photo.innerHTML = item.UserPhoto;
    }
    else {
        photo.innerHTML = item == null ? "&nbsp;" : "<a href=" + item.UserUrl + " target='_blank'>" + item.UserPhoto + "</a>";
    }
    photo.className = "Photo"; //照片样式
    if (photo.document.getElementById("UserPhoto") != null) {
        photo.document.getElementById("UserPhoto").style.width = "100%";
        photo.document.getElementById("UserPhoto").style.height = "100%";
    }
    photo.style.overflow = "hidden";
    InitDivWidthAndHeight(photo, aParamValues["ImageWidth"], aParamValues["ImageHeight"]); //定义在Common.js中
    content.appendChild(photo);

    var sreport = document.createElement("div");
    sreport.className = "Report"; //我要举报样式
    sreport.align = "left";
    sreport.innerHTML = item == null ? "&nbsp;" : "<a href=javascript:void(0) onclick=\"javascript:SetReport(" + item.PkId + ",3, '" + aParamValues["PathPrefix"] + "')\">我要举报</a>";
    link.appendChild(sreport)

    var str = "<table width=\"100%\"  border=\"0\" cellspacing=\"0\" class=TitleBox cellpadding=\"0\"><tr><td rowspan=\"3\" width=\"1%\" valign=\"top\">" + content.innerHTML + "</td>"
	          + "<td valign=\"top\">" + title.innerHTML + "</td><td width=\"0\"></td>"
	          + "</tr><tr>"
	          + "<td colspan=\"2\" class=Content valign=\"top\" align=left style=\"padding-left:5px\">" + (item == null ? "&nbsp;" : item.Content) + "</td>"
	          + "</tr><tr>"
	          + "<td colspan=\"2\" valign=\"top\">" + link.innerHTML + "</td>"
	          + "</tr></table>";

    return str;
}

/******************************************************************/
//加载讨论区回复
/******************************************************************/
function InitDiscussRestoreList(discussId, t) {
    if (t == null) t = 0;
    document.getElementById("CircleDiscussRestoreList").innerText = "数据加载中...";
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{discussId:'" + discussId + "',t:'" + t + "'}",
        dataType: "json",
        url: "/Service/CircleService.asmx/GetCircleDiscussRestoreListByDiscussId",
        success: function(result) {
            jQuery("#CircleDiscussRestoreList").html("");
            jQuery.each(result.d, function(i, item) {
                jQuery("#CircleDiscussRestoreList").append(CreateCircleDiscussRestoreList(item, i));
            });
        }
    });
}

function CreateCircleDiscussRestoreList(item, i) {
    var content = document.createElement("div");
    var link = document.createElement("div");
    var photo = document.createElement("div");
    var title = document.createElement("div");
    var user = document.createElement("div");

    var stime = document.createElement("div");
    stime.className = 'text-float-left Date'; //回复时间样式	
    stime.innerHTML = item.UpdateTimeStr;
    stime.style["padding-left"] = "5px";
    stime.title = "回应时间：" + new Date(parseInt(item.UpdateTime.substring(6, item.UpdateTime.length - 2))).formatt("yyyy-MM-dd hh:mm:ss");
    link.appendChild(stime);

    var suser = document.createElement("div");
    suser.className = 'text-float-left Name'; //发布者名称样式
    if (item.UserUrl == "") {
        suser.innerHTML = item.UserName + "[" + item.MemberTypeStr + "]：";
    }
    else {
        suser.innerHTML = "<a href=" + item.UserUrl + " >" + item.UserName + "</a>[" + item.MemberTypeStr + "]：";
    }
    suser.style["padding-left"] = "5px";
    suser.title = "回应者";
    link.appendChild(suser);



    if (item.UserUrl == "") {
        photo.innerHTML = item.UserPhoto;
    }
    else {
        photo.innerHTML = "<a href=" + item.UserUrl + ">" + item.UserPhoto + "</a>";
    }
    photo.className = "Photo"; //照片样式		
    if (photo.document.getElementById("UserPhoto") != null) {
        photo.document.getElementById("UserPhoto").style.width = "100%";
        photo.document.getElementById("UserPhoto").style.height = "100%";
    }
    content.appendChild(photo);
    var str = "<table width=\"96%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=Table><tr><td rowspan=\"3\" width=\"50px\" valign=\"top\">" + content.innerHTML + "</td>"
	          + "<td valign=\"top\">" + link.innerHTML + "</td><td class=Iden valign=\"top\" align=\"right\">" + item.UserIden + "</td>"
	          + "</tr><tr>"
	          + "<td colspan=\"2\" class=Content valign=\"top\" align=left style=\"padding-left:5px\">" + item.Content + "</td>"
	          + "</tr><tr>"
	          + "<td colspan=\"2\" valign=\"top\" align=right class=Pos><a href=\"#Discuss\" onclick=\"javascript:CircleRestore('" + item.UserName + "')\">回复</a>&nbsp;&nbsp;" + (i + 1) + "楼&nbsp;&nbsp;<a href=\"#top\" title='回到顶楼'><img src='/Images/icon_up_gray.gif' boder=0/></a></td>"
	          + "</tr></table>";

    return str;
}

function CircleRestore(name) {

    document.getElementById("frmDiscuss").contentWindow.SetContent(name);
}

/******************************************************************/
//团体文章密码访问处理
/******************************************************************/
function CheckCircleArticlePwdAccess(articleId) {
    var password = jQuery("#CircleArticleAccessPwd_" + articleId).val();
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{pwd:'" + password + "',pkId:'" + articleId + "'}",
        dataType: "json",
        url: "/Service/CircleService.asmx/CheckCircleArticlePwdAccess",
        success: function(result) {
            if (result.d == 0) {
                _error_msg_show("您输入的密码不正确，请重试!", '', 'sorry', "错误");
            }
            else {
                jQuery("#CircleArticleList_" + result.d).show();
                jQuery("#CircleArticleList_Pwd_" + result.d).hide();
            }
        }
    });
}
//具体显示文章时密码验证处理(与列表中验证有所区别)
function CheckCircleArticlePwdAccess1(articleId, param, dataDivId, commentsId, menuId) {

    var password = jQuery("#CircleArticleAccessPwd").val();
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{pwd:'" + password + "',pkId:'" + articleId + "'}",
        dataType: "json",
        url: "/Service/CircleService.asmx/CheckCircleArticlePwdAccess",
        success: function(result) {
            if (result.d == 0) {
                _error_msg_show("您输入的密码不正确，请重试!", '', 'sorry', "错误");
            }
            else {
                _error_msg_show("重定向中，请稍候...", '', 'succ', "成功");
                location.href = document.location;
            }
        }
    });
}


/******************************************************************/
//访问记录
/******************************************************************/
function LogCircleIndexCount(objectId) {
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{objectId:'" + objectId + "'}",
        dataType: "json",
        url: "/Service/CircleService.asmx/LogCircleIndexCount"
    });
   
}
function LogCircleArticleCount(articleId, blogId) {
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{articleId:'" + articleId + "',circleId:'" + blogId + "'}",
        dataType: "json",
        url: "/Service/CircleService.asmx/LogCircleArticleCount"
    });
}

/******************************************************************/
//文章搜索模块
/******************************************************************/
function RedirectToSearch(param, txtId, typeId, circleId) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);

    if ($(txtId).value.Trim() == "") {
        _error_msg_show("请输入查询关键字", '', 'smile', "提醒");
    }
    else {
        location.href = "/OperationManage/CircleMoreIndex.aspx?pkId=" + aParamValues["MoreMenuId"] + "&circleId=" + circleId + "&kw=" + $(txtId).value + "&st=" + $(typeId).value + "&t=1";

    }
}

/******************************************************************/
//加载网站文章搜索
/******************************************************************/
function InitCircleArticleSearchListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    if (aParamValues["IsShowPageNav"] == "1") {
        aParamValues["PageIndex"] = pageIndex;
        aParamValues["PageScript"] = "InitCircleArticleSearchListData('" + param + "','" + dataDivId + "' ,{0})";
    }
    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    var data;
    data = "{ circleId: '" + aParamValues["CircleId"] + "',pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',kw:'" + aParamValues["SearchKeyWord"] + "',type:'" + aParamValues["SearchType"] + "',dns:'" + aParamValues["ReqDns"] + "'}";
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: data,
        dataType: "json",
        url: "/Service/CircleService.asmx/GetCircleArticleSearchList",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], aParamValues["IsFixed"]);
            jQuery(div).addClass("clearfix Box");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                jQuery(div).append(CreateCircleArticleList(item, aParamValues));
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitCircleArticleListData('" + param + "','" + dataDivId + "'," + isImageArticleCategory + " ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });   
}