﻿/// <reference path="jQuery.js" />
/******************************************************************/
//加载网站文章搜索
/******************************************************************/
function InitSystemArticleSearchListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    if (aParamValues["IsShowPageNav"] == "1") {
        aParamValues["PageIndex"] = pageIndex;
        aParamValues["PageScript"] = "InitSystemArticleSearchListData('" + param + "','" + dataDivId + "' ,{0})";
    }
    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',kw:'" + aParamValues["SearchKeyWord"] + "',type:'" + aParamValues["SearchType"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetSystemArticleSearchList",
        success: function(result) {
            onInitSystemArticleListDataSuccess(result.d, aParamValues);
        }
    });
}
/******************************************************************/
//加载博客文章搜索
/******************************************************************/
function InitBlogArticleSearchListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    if (aParamValues["IsShowPageNav"] == "1") {
        aParamValues["PageIndex"] = pageIndex;
        aParamValues["PageScript"] = "InitBlogArticleSearchListData('" + param + "','" + dataDivId + "' ,{0})";
    }
    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',kw:'" + aParamValues["SearchKeyWord"] + "',type:'" + aParamValues["SearchType"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetBlogArticleSearchList",
        success: function(result) {
            onInitSystemArticleListDataSuccess(result.d, aParamValues);
        }
    });
}
/******************************************************************/
//加载最新文章
/******************************************************************/
function InitSystemArticleListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;    
    if (aParamValues["IsShowPageNav"] == "1") {
        aParamValues["PageIndex"] = pageIndex;
        aParamValues["PageScript"] = "InitSystemArticleListData('" + param + "','" + dataDivId + "' ,{0})";
    }
    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["CategoryId"] == null) {
        aParamValues["CategoryId"] = 0
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',categoryId:'" + aParamValues["CategoryId"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "',categoryGroupId:'" + (aParamValues["CategoryGroupId"] == null ? 0 : aParamValues["CategoryGroupId"]) + "',articleNature:'" + (aParamValues["ArticleNature"] == null ? 0 : aParamValues["ArticleNature"]) + "',articleFrom:'" + (aParamValues["ArticleFrom"] == null ? 0 : aParamValues["ArticleFrom"]) + "', newsMenuId:'" + aParamValues["NewsMenuId"] + "', imageShow:'" + aParamValues["ImageArticleCategoryShowType"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetSystemArticleList",
        success: function(result) {
            onInitSystemArticleListDataSuccess(result.d, aParamValues);
        }
    });
}
/******************************************************************/
//加载最新博客文章
/******************************************************************/
function InitBlogArticleListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;    
    if (aParamValues["IsShowPageNav"] == "1") {
        aParamValues["PageIndex"] = pageIndex;
        aParamValues["PageScript"] = "InitBlogArticleListData('" + param + "','" + dataDivId + "' ,{0})";
    }
    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',categoryId:'" + aParamValues["CategoryId"] + "',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"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetBlogArticleList",
        success: function(result) {
            onInitSystemArticleListDataSuccess(result.d, aParamValues);
        }
    });
}

/******************************************************************/
//加载网站专题文章
/******************************************************************/
function InitSystemSpecialArticleListData(param, dataDivId, isImageArticleCategory, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    aParamValues["IsImageArticleCategory"] = isImageArticleCategory;
    if (aParamValues["IsShowPageNav"] == "1") {
        aParamValues["PageIndex"] = pageIndex;
        aParamValues["PageScript"] = "InitSystemSpecialArticleListData('" + param + "','" + dataDivId + "'," + isImageArticleCategory + " ,{0})";
    }
    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',specialId:'" + aParamValues["SpecialId"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetSystemSpecialArticleList",
        success: function(result) {
            onInitSystemArticleListDataSuccess(result.d, aParamValues);
        }
    });
}
function onInitSystemArticleListDataSuccess(result, aParamValues) {
    var div = GetContentDiv(aParamValues);
    var list = InitFixed(result.List, aParamValues["PageSize"], 1);
    jQuery(div).addClass("clearfix Box");
    jQuery(div).html("");

    jQuery.each(list, function(i, item) {
        if (aParamValues["ImageArticleCategoryShowType"] == "1") {
            jQuery(div).append(CreateLatestBlogArticleListForPic(item, aParamValues));
        }
        else {
            switch (aParamValues["PostShowMode"]) {
                case "0":
                    jQuery(div).append(CreateSystemArticleSummaryList(item, aParamValues));
                    break;
                case "1":
                default:
                    jQuery(div).append(CreateLatestBlogArticleList(item, aParamValues));
                    break;
            }
        }
    });

    if (aParamValues["IsShowPageNav"] == "1") {
        jQuery(div).append(CreatePageNav(aParamValues["PageIndex"], result.PageCount, aParamValues["PageScript"], "PageNav")); //文章列表分页样式
    }
    InitContentDiv(aParamValues, div);

    SetAllVideoArticleImage();
}
//文章摘要列表显示
function CreateSystemArticleSummaryList(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>";
    str += "<div class=\"text-wrap Brief\" >" + (item == null ? "" : item.Brief) + "</div>";

    str += "<div class=\"View\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>[查看全文]</a>") + "</div></div>";

    return str;
}
//列表显示
function CreateLatestBlogArticleList(item, aParamValues) {
    var str = "<div class=\"TitleBox\" title=\"" + (item == null ? "" : item.OriTitle) + "\">";
    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\" title=\"发布者\">" + (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 + " target='_blank'>" + item.Title + "</a>") + "</div>";
    str += "</div>";

    return str;
}

//图片列表显示
function CreateLatestBlogArticleListForPic(item, aParamValues) {
    var str = "<div class=\"text-float-left TitleBox\" title=\"" + (item == null ? "" : item.OriTitle) + "\">" +
              "<div class=\"Photo\" style=\"width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";\">";
    str += (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:70px;\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>" + item.Title + "</a>") + "</div>" +
              "</div>";
    return str;
}


/******************************************************************/
//加载最新注册博客
/******************************************************************/
function InitLatestRegisterBlogData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;

    document.getElementById(dataDivId).innerText = "数据加载中...";
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',categoryId:'" + aParamValues["BlogCircleCategoryId"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetLatestBlog",
        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(CreateLatestBlogListData(item, aParamValues));
                        break;
                    case "1":
                        jQuery(div).append(CreateLatestBlogForPhotoListData(item, aParamValues));
                        break;
                }
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div width=\"width:100%;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitLatestRegisterBlogData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });

}

//带照片显示
function CreateLatestBlogForPhotoListData(item, aParamValues) {
    var s1 = document.createElement("div");
    s1.innerHTML = item == null ? "&nbsp;" : "<a href=" + item.Url + " target=_blank>" + item.Photo + "</a>";
    if (s1.document.getElementById("BlogPhoto") != null) {
        s1.document.getElementById("BlogPhoto").style.width = "100%";
        s1.document.getElementById("BlogPhoto").style.height = "100%";
    }
    var str = "<div class=\"text-float-left TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.BlogName) + "\">" +
              "<div class=\"text-float-left Photo\" style=\"width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";\">" + s1.innerHTML + "</div>" +
              "<div class=\"Des\">" + (item == null ? "&nbsp;" : item.Description) + "</div>" +
              "<div class=\"text-float-left TitleIcon\"></div>" +
              "<div class=\"text-overflow Title\" style=\"width:100px;\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target=_blank>" + item.BlogName + "</a>") + "</div>";
    if (aParamValues["IsShowTime"] == 1) {
        str += "<div class=\"Date\">" + (item == null ? "&nbsp;" : GetDateFormat(aParamValues["TimeFormat"], new Date(parseInt(item.CreateTime.substring(6, item.CreateTime.length - 2))))) + "</div>";
    }
    str += "</div>";

    return str;
}
//列表显示
function CreateLatestBlogListData(item, aParamValues) {
    var str = "<div class=\"TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.BlogName) + "\">";
    if (aParamValues["IsShowTime"] == 1) {
        str += "<div class=\"text-float-right Date\">" + ((item == null ? "&nbsp;" : GetDateFormat(aParamValues["TimeFormat"], new Date(parseInt(item.CreateDate.substring(6, item.CreateDate.length - 2)))))) + "</div>";
    }
    str += "<div class=\"text-float-left TitleIcon\"></div><div class=\"text-overflow Title\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target=_blank>" + item.BlogName + "</a>") + "</div>";
    str += "</div>";

    return str;
}

/******************************************************************/
//加载最新创建圈子
/******************************************************************/
function InitLatestCreatedCircleData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;

    document.getElementById(dataDivId).innerText = "数据加载中...";
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "',unitId:'" + aParamValues["UnitId"] + "',departmentId:'" + aParamValues["DepartmentId"] + "',isShowChild:'" + aParamValues["IsShowChild"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetLatestCircle",
        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(CreateLatestCircleListData(item, aParamValues));
                        break;
                    case "1":
                        jQuery(div).append(CreateLatestCircleForPhotoListData(item, aParamValues));
                        break;
                }
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div width=\"width:100%;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitLatestCreatedCircleData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}

//带照片显示
function CreateLatestCircleForPhotoListData(item, aParamValues) {
    var s1 = document.createElement("div");
    s1.innerHTML = item == null ? "&nbsp;" : "<a href=" + item.Url + " target=_blank>" + item.CirclePhoto + "</a>";
    if (s1.document.getElementById("CirclePhoto") != null) {
        s1.document.getElementById("CirclePhoto").style.width = "100%";
        s1.document.getElementById("CirclePhoto").style.height = "100%";
    }
    var str = "<div class=\"text-float-left TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.CircleName) + "\">" +
              "<div class=\"text-float-left Photo\" style=\"width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";\">" + s1.innerHTML + "</div>" +
               "<div class=\"text-float-left TitleIcon\"></div>" +
               "<div class=\"text-overflow Title\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target=_blank>" + item.CircleName + "</a>") + "</div>" +
            "<div class=\"Des\">" + (item == null ? "&nbsp;" : item.Description) + "</div>";                         
    if (aParamValues["IsShowTime"] == 1) {
        str += "<div class=\"Date\">" + (item == null ? "&nbsp;" : GetDateFormat(aParamValues["TimeFormat"], new Date(parseInt(item.CreateTime.substring(6, item.CreateTime.length - 2))))) + "</div>";
    }
    str += "</div>";

    return str;

}
//列表显示
function CreateLatestCircleListData(item, aParamValues) {
    var str = "<div class=\"TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.CircleName) + "\">";
    if (aParamValues["IsShowTime"] == 1) {
        str += "<div class=\"text-float-right Date\">" + ((item == null ? "&nbsp;" : GetDateFormat(aParamValues["TimeFormat"], new Date(parseInt(item.CreateTime.substring(6, item.CreateTime.length - 2)))))) + "</div>";
    }
    str += "<div class=\"text-float-left TitleIcon\"></div><div class=\"text-overflow Title\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target=_blank>" + item.CircleName + "</a>") + "</div>";
    str += "</div>";

    return str;
}

/******************************************************************/
//加载教育团体列表（跟最新创建团体共用）
/******************************************************************/
function InitCircleListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;

    document.getElementById(dataDivId).innerText = "数据加载中...";
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "',unitId:'" + aParamValues["UnitId"] + "',departmentId:'" + aParamValues["DepartmentId"] + "',isShowChild:'" + aParamValues["IsShowChild"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetCircleList",
        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(CreateLatestCircleListData(item, aParamValues));
                        break;
                    case "1":
                        jQuery(div).append(CreateLatestCircleForPhotoListData(item, aParamValues));
                        break;
                }
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div width=\"width:100%;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitCircleListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}
/******************************************************************/
//加载教育团体(根据类别)列表（跟最新创建团体共用）
/******************************************************************/
function InitCircleListByTypeData(param, dataDivId, pageIndex) {
   
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;

    document.getElementById(dataDivId).innerText = "数据加载中...";
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',circleType:'" + aParamValues["CircleType"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetCircleListByType",
        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(CreateLatestCircleListData(item, aParamValues));
                        break;
                    case "1":
                        jQuery(div).append(CreateLatestCircleForPhotoListData(item, aParamValues));
                        break;
                }
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div width=\"width:100%;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitCircleListByTypeData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}

/******************************************************************/
//检查用户名是否已经被注册
/******************************************************************/
var validRegisterUserName = true;
function CheckUserNameIsRegistered(userName) {
    validRegisterUserName = true;
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ userName:'" + userName + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/UserNameIsRegistered",
        success: function(result) {
            validRegisterUserName = result.d;
        }
    });
}

/******************************************************************/
//检查电子邮件是否已经被注册
/******************************************************************/
var validRegisterEmail = true;
function CheckEmailIsRegistered(email) {
    validRegisterEmail = true;
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ email:'" + email + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/EmailIsRegistered",
        success: function(result) {
            validRegisterEmail = result.d;
        }
    });
}

/******************************************************************/
//系统横幅
/******************************************************************/
function InitSystemBannerData(param, dataDivId) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;

    var div = GetContentDiv(aParamValues);

    var content = document.createElement("div");
    var imgDiv = document.createElement("div");

    imgDiv.id = "bannerImg";
    imgDiv.className = "BannerBox"; //横幅整体样式
    //获取总宽度	
    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 {
        content.appendChild(imgDiv);
        div.innerHTML = content.innerHTML;
        var a = div.document.getElementById("bannerImg");
        height = width * (a.offsetHeight / a.offsetWidth);
        content.innerHTML = "";
        div.innerHTML = "";
    }

    imgDiv.style.height = height + "px";
    imgDiv.style.width = width + "px";

    content.appendChild(imgDiv);
    div.innerHTML = content.innerHTML;

    InitContentDiv(aParamValues, div);
}

/******************************************************************/
//加载相册
/******************************************************************/
function InitBlogAlbumListData(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["ObjectId"] == null) {
        aParamValues["ObjectId"] = 0;
    }

    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',albumType:'" + aParamValues["AlbumType"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "',objectId:'" + aParamValues["ObjectId"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetAlbum",
        success: function(result) {
        var div = GetContentDiv(aParamValues);
            var list = new Object();
            if (aParamValues["AlbumType"] == "0") {
                list = InitFixed(result.d.List, aParamValues["PageSize"], aParamValues["IsFixed"]); ;
            }
            else {
                list = InitFixed(result.d.CList, aParamValues["PageSize"], aParamValues["IsFixed"]);
            }
            jQuery(div).addClass("clearfix Box");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                jQuery(div).append(CreateBlogAlbumList(item, aParamValues));
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div width=\"width:100%;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitBlogAlbumListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}

function CreateBlogAlbumList(item, aParamValues) {
    var str = "<div class=\"text-float-left TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.Name) + "\">" +
              "<div class=\"Photo\" style=\"width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>" + item.CoverPhoto + "</a>") + "</div>" +
              "<div class=\"Title text-overflow\" style=\"width:100px;\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>" + item.Name + "</a>") + "</div>" +
              "</div>";
    return str;
}

/******************************************************************/
//文章搜索模块
/******************************************************************/
function RedirectToSearch(param, txtId, typeId) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);

    if ($(txtId).value.Trim() == "") {
        _error_msg_show("请输入查询关键字", '', 'smile', "提醒");
    }
    else {
        location.href = "/MoreIndex.aspx?pkId=" + aParamValues["MoreMenuId"] + "&kw=" + escape($(txtId).value) + "&st=" + $(typeId).value + "&t=1";

    }
}

/******************************************************************/
//博客文章搜索模块
/******************************************************************/
function RedirectToBlogArticleSearch(param, txtId, typeId) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);

    if ($(txtId).value.Trim() == "") {
        _error_msg_show("请输入查询关键字", '', 'smile', "提醒");
    }
    else {
        location.href = "/MoreIndex.aspx?pkId=" + aParamValues["MoreMenuId"] + "&kw=" + escape($(txtId).value) + "&st=" + $(typeId).value + "&t=4";

    }
}

/******************************************************************/
//个人空间或教育团体搜索模块
/******************************************************************/
function RedirectToBlogCircleSearch(param, txtId, objId, typeId) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);

    if ($(txtId).value.Trim() == "") {
        _error_msg_show("请输入查询关键字", '', 'smile', "提醒");
    }
    else {
        
        location.href ="/MoreIndex.aspx?pkId=" + aParamValues["MoreMenuId"] + "&kw=" + escape($(txtId).value) + "&obj=" + $(objId).value + "&st=" + $(typeId).value + "&t=2";

    }
}

/******************************************************************/
//视频以及专辑搜索模块
/******************************************************************/
function RedirectToVideoSearch(param, txtId, typeId) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);

    if ($(txtId).value.Trim() == "") {
        _error_msg_show("请输入查询关键字", '', 'smile', "提醒");
    }
    else {
        location.href =  "/MoreIndex.aspx?pkId=" + aParamValues["MoreMenuId"] + "&kw=" + escape($(txtId).value) + "&t=" + $(typeId).value + "&st=0";

    }
}


/******************************************************************/
//加载所有个人或者团体的讨论区列表数据
/******************************************************************/
function InitAllDiscussListData(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;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ postShowType:'" + aParamValues["PostShowType"] + "', pageIndex:'" + pageIndex + "',pageSize:'" + aParamValues["PageSize"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "',newsMenuId:'" + aParamValues["NewsMenuId"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetAllDiscussList",
        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(CreateAllDiscussList(item, aParamValues));
                        break;
                    case "1": //平铺显示
                        jQuery(div).append(CreateAllDiscussListForTile(item, aParamValues));
                        break;
                }
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div width=\"width:100%;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitAllDiscussListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}
//列表显示
function CreateAllDiscussList(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 + " target='_blank'>" + 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 = item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>[<font color=red>精华</font>]" + item.Title + "</a>";
    }
    else {
        if (item != null && item.IsTop == 1) {
            s2.innerHTML = "<a href=" + item.Url + " target='_blank'>[<font color=blue>置顶</font>]" + item.Title + "</a>";
        }
        else {
            s2.innerHTML = item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>" + item.Title + "</a>";
        }
    }
    link.appendChild(s2);
    content.appendChild(link);
    return content.innerHTML;
}

//平铺显示
function CreateAllDiscussListForTile(item, aParamValues, width, height) {
    var content = document.createElement("div");
    var link = document.createElement("div");
    var photo = document.createElement("div");
    var title = document.createElement("div");

    link.className = "TitleBox";

    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 + " target='_blank'>[<font color=red>精华</font>]" + item.Title + "</a>";
    }
    else {
        if (item != null && item.IsTop == 1) {
            s2.innerHTML = "<a href=" + item.Url + " target='_blank'>[<font color=blue>置顶</font>]" + item.Title + "</a>";
        }
        else {
            s2.innerHTML = item == null ? "&nbsp;" : "<a href=" + item.Url + " 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%\" class=TitleBox  border=\"0\" cellspacing=\"0\" 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 InitBlogSearchListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "',pageSize:'" + aParamValues["PageSize"] + "',kw:'" + aParamValues["SearchKeyWord"] + "',type:'" + aParamValues["SearchType"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetBlogSearchList",
        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(CreateLatestBlogListData(item, aParamValues));
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div width=\"width:100%;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitBlogSearchListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}
/******************************************************************/
//加载教育团体搜索列表
/******************************************************************/
function InitCircleSearchListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "',pageSize:'" + aParamValues["PageSize"] + "',kw:'" + aParamValues["SearchKeyWord"] + "',type:'" + aParamValues["SearchType"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetCircleSearchList",
        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(CreateLatestCircleListData(item, aParamValues));
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div width=\"width:100%;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitCircleSearchListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}

/******************************************************************/
//系统文章密码访问处理
/******************************************************************/

//具体显示文章时密码验证处理(与列表中验证有所区别)
function CheckSystemArticlePwdAccess1(articleId) {

    var password = jQuery("#AccessPwd").val();
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pwd:'" + password + "',pkId:'" + articleId + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/CheckSystemArticlePwdAccess",
        success: function(result) {
            if (result.d == 0) {
                _error_msg_show("您输入的密码不正确，请重试!", '', 'sorry', "错误");
            }
            else {
                _error_msg_show("重定向中，请稍候...", '', 'succ', "成功");
                location.href = document.location;
            }
        }
    });
}

/******************************************************************/
//加载系统文章评论
/******************************************************************/
function InitArticleComments(articleId) {
    document.getElementById("Comments").innerText = "数据加载中...";
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ articleId:'" + articleId + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetSystemCommentsByArticleId",
        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\" align=\"left\">" + new Date(parseInt(item.CommentDate.substring(6, item.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 StartCount() {
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ i:'1'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/StartStatisticCount",
        success: function(result) {

        }
    });
}

/******************************************************************/
//访问记录
/******************************************************************/
function LogSystemArticleCount(articleId) {
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ articleId:'" + articleId + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/LogSystemArticleCount"
    });
}

/******************************************************************/
//系统文章签收
/******************************************************************/
function LogReceiptData(articleId, userId, userName, isReceipt) {
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ articleId:'" + articleId + "',userId:'" + userId + "',userName:'" + userName + "',isReceipt:'" + isReceipt + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/LogReceiptData"
    });
}

/******************************************************************/
//系统资源信息签收
/******************************************************************/
function LogResourceReceiptData(rid, userId, userName, isReceipt) {
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ rid:'" + rid + "',userId:'" + userId + "',userName:'" + userName + "',isReceipt:'" + isReceipt + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/LogResourceReceiptData"
    });
}

/******************************************************************/
//发布留言信息
/******************************************************************/
function AddGuestBookMessage(guestBookId, type, objectId) {
    openWindow('/OperationManage/AddGuestBookMessage.aspx?type=' + type + '&oid=' + objectId + '&gid=' + guestBookId, '480', '450', '我要留言', false);
}

/******************************************************************/
//查看留言信息
/******************************************************************/
function ViewGuestBookMessage(guestBookMessageId, type, objectId) {
    openWindow('../OperationManage/ViewGuestBookMessage.aspx?gid=' + guestBookMessageId + '&oid=' + objectId + '&type=' + type, '500', '410', '查看留言信息', false);
}

/******************************************************************/
//处理留言信息
/******************************************************************/
function DealGuestBookMessage(guestBookMessageId, type, objectId) {
    openWindow('../SystemManage/GuestBook/DealGuestBookMessage.aspx?gid=' + guestBookMessageId + '&oid=' + objectId + '&type=' + type, '500', '410', '处理留言信息', false);
}

/******************************************************************/
//查看保密信息
/******************************************************************/
function ViewSecrecyGuestBookMessage(snId, spId, type, objectId) {
    var sn = $(snId).value;
    var sp = $(spId).value;
    openWindow('../OperationManage/ViewSecrecyGuestBookMessage.aspx?sn=' + sn + '&sp=' + sp + '&oid=' + objectId + '&type=' + type, '500', '450', '查看保密留言信息', true);
}

/******************************************************************/
//加载网站留言信息
/******************************************************************/
function InitSystemGuestBookMessageListData(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;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',guestBookId:'" + aParamValues["GuestBookId"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "', guestBookFrom:'" + (aParamValues["GuestBookFrom"] == null ? 0 : aParamValues["GuestBookFrom"]) + "', guestBookGroupId:'" + aParamValues["GuestBookGroupId"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetSystemGuestBookMessageList",
        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(CreateSystemGuestBookMessageList(item, aParamValues));
                        break;
                    case "1":
                        jQuery(div).append(CreateSystemGuestBookMessageListForTile(item, aParamValues));
                        break;
                }
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitSystemGuestBookMessageListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}

//列表显示
function CreateSystemGuestBookMessageList(item, aParamValues) {
    var content = document.createElement("div");
    var link = document.createElement("div");
    link.className = "TitleBox";
    link.title = item == null ? "&nbsp;" : item.Title;

    var stime = document.createElement("div");
    stime.className = 'text-float-right Time'; //发布时间样式
    stime.innerHTML = item == null ? "&nbsp;" : new Date(parseInt(item.CreateTime.substring(6, item.CreateTime.length - 2))).formatt("yyyy-MM-dd");
    stime.style["padding-left"] = "5px";
    stime.title = item == null ? "&nbsp;" : "发布时间：" + new Date(parseInt(item.CreateTime.substring(6, item.CreateTime.length - 2))).formatt("yyyy-MM-dd hh:mm:ss");
    link.appendChild(stime);


    var sviewcount = document.createElement("div");
    sviewcount.className = 'text-float-right ViewCount'; //浏览次数样式	
    sviewcount.innerHTML = item == null ? "&nbsp;" : item.Click;
    sviewcount.style["padding-left"] = "5px";
    sviewcount.title = "浏览次数";
    link.appendChild(sviewcount);

    if (aParamValues["IsShowUser"] == 1) {
        var suser = document.createElement("div");
        suser.className = 'text-float-right Name'; //发布者名称样式	    
        suser.innerHTML = item == null ? "&nbsp;" : item.UserName;
        suser.style["padding-left"] = "5px";
        suser.title = "发布者";
        link.appendChild(suser);
    }

    var sicon = document.createElement("div");
    sicon.className = "text-float-left TitleIcon";
    link.appendChild(sicon)   

    if (aParamValues["IsShowGuestBook"] == 1) 
    {
        var cate = document.createElement("div");
        cate.className = "text-float-left Category";
        cate.title = "所属留言咨询";
        cate.innerHTML = item == null ? "&nbsp;" : "<a href=" + item.GuestBookUrl + " target=\"_blank\">" + item.GuestBookName + "</a>";
        link.appendChild(cate); 
    }

    var s2 = document.createElement("div");
    s2.className = 'text-overflow Title'; //标题样式

    if (item != null) {
        if (item.IsReply == 1) {
            s2.innerHTML = "<a href='javascript:' onclick='javascript:ViewGuestBookMessage(" + item.PkId + ",2,0)'>[<font color=red>已回复</font>]" + item.Title + "</a>";
        }
        else {
            s2.innerHTML = "<a href='javascript:' onclick='javascript:ViewGuestBookMessage(" + item.PkId + ",2,0)'>" + item.Title + "</a>";
        }
    }
    link.appendChild(s2);
    content.appendChild(link);
    return content.innerHTML;
}

//平铺显示
function CreateSystemGuestBookMessageListForTile(item, aParamValues, width, height) {
    var content = document.createElement("div");
    var link = document.createElement("div");
    var title = document.createElement("div");


    var sname = document.createElement("div");
    sname.className = 'text-float-right Name'; //回复者名称样式	
    sname.innerHTML = item == null ? "&nbsp;" : item.ReplyUserName;
    sname.style["padding-left"] = "5px";
    sname.title = "回复者";
    link.appendChild(sname);

    var stime = document.createElement("div");
    stime.className = 'text-float-right Time'; //回复时间样式
    stime.innerHTML = item == null ? "&nbsp;" : "回复时间：" + new Date(parseInt(item.ReplyTime.substring(6, item.ReplyTime.length - 2))).formatt("yyyy-MM-dd");
    stime.style["padding-left"] = "5px";
    stime.title = item == null ? "&nbsp;" : "回复时间：" + new Date(parseInt(item.ReplyTime.substring(6, item.ReplyTime.length - 2))).formatt("yyyy-MM-dd hh:mm:ss");
    link.appendChild(stime);

    var sviewcount = document.createElement("div");
    sviewcount.className = 'text-float-right ViewCount'; //浏览次数样式	
    sviewcount.innerHTML = item == null ? "&nbsp;" : "浏览：" + item.Click;
    sviewcount.style["padding-left"] = "5px";
    sviewcount.title = "浏览次数";
    link.appendChild(sviewcount);

    if (aParamValues["IsShowUser"] == 1) {
        var suser = document.createElement("div");
        suser.className = 'text-float-right Name'; //发布者名称样式	    
        suser.innerHTML = item == null ? "&nbsp;" : "来自：" + item.UserName;
        suser.style["padding-left"] = "5px";
        suser.title = "发布者";
        title.appendChild(suser);
    }

    var supdate = document.createElement("div");
    supdate.className = 'text-float-right Time'; //发布时间样式
    supdate.innerHTML = item == null ? "&nbsp;" : new Date(parseInt(item.CreateTime.substring(6, item.CreateTime.length - 2))).formatt("yyyy-MM-dd");
    supdate.style["padding-left"] = "5px";
    supdate.title = item == null ? "&nbsp;" : "发布时间：" + new Date(parseInt(item.CreateTime.substring(6, item.CreateTime.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);

    if (aParamValues["IsShowGuestBook"] == 1) {
        var cate = document.createElement("div");
        cate.className = "text-float-left Category";
        cate.title = "所属留言咨询";
        cate.innerHTML = item == null ? "&nbsp;" : "<a href=" + item.GuestBookUrl + " target=\"_blank\">" + item.GuestBookName + "</a>";
        title.appendChild(cate);
    }
    
    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) {
        if (item.IsReply == 1) {
            s2.innerHTML = "<a href='javascript:' onclick='javascript:ViewGuestBookMessage(" + item.PkId + ",2,0)'>[<font color=red>已回复</font>]" + item.Title + "</a>";
        }
        else {
            s2.innerHTML = "<a href='javascript:' onclick='javascript:ViewGuestBookMessage(" + item.PkId + ",2,0)'>" + item.Title + "</a>";
        }
    }
    title.appendChild(s2);

    var sreport = document.createElement("div");
    sreport.className = "Reply"; //我要举报样式
    sreport.align = "left";
    sreport.innerHTML = item == null ? "&nbsp;" : "<a href='javascript:' onclick=\"javascript:DealGuestBookMessage(" + item.PkId + ",2, 0)\">回复处理</a>";
    link.appendChild(sreport)

    var str = "<table width=\"100%\"  border=\"0\" cellspacing=\"0\" class=TitleBox cellpadding=\"0\"><tr>"
	          + "<td valign=\"top\">" + title.innerHTML + "</td><td width=\"0\"></td>"
	          + "</tr><tr>"
	          + "<td class=Content valign=\"top\" align=left style=\"padding-left:5px\">" + (item == null ? "&nbsp;" : item.Content) + "</td></tr><tr>"
	          + "<td class=ReplyContent valign=\"top\" align=left style=\"padding-left:5px\"><div class=ReplyContentTip>回复内容：</div>" + (item == null ? "&nbsp;" : item.ReplyContent) + "</td>"
	          + "</tr><tr>"
	          + "<td valign=\"top\">" + link.innerHTML + "</td>"
	          + "</tr></table>";

    return str;
}

/******************************************************************/
//加载资源库信息
/******************************************************************/
function InitSystemResourceInfomationListData(param, dataDivId, resourceIds, pageIndex, rankStr, type)//此处传入resourceIds为了便于资源库树形显示时用
{
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    aParamValues["ResourceId"] = resourceIds;
    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    if (aParamValues["ResourceGroupId"] == null || aParamValues["ResourceGroupId"] == "") {
        aParamValues["ResourceGroupId"] = 0;
    }
    if (aParamValues["IsShowChildResourceInfo"] == null) {
        aParamValues["IsShowChildResourceInfo"] = 0;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "',resourceId:'" + aParamValues["ResourceId"] + "',resourceNature:'" + (aParamValues["ResourceNature"] == null ? 0 : aParamValues["ResourceNature"]) + "',resourceGroupId:'" + aParamValues["ResourceGroupId"] + "',rankStr:'" + rankStr + "',type:'" + type + "', resourceFrom: '" + (aParamValues["ResourceFrom"] == null ? 0 : aParamValues["ResourceFrom"]) + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetSystemResourceInformationList",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], aParamValues["IsFixed"]);
            jQuery(div).addClass("clearfix");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                if (aParamValues["PostShowMode"] == "1") {
                    jQuery(div).append(CreateSystemResourceInfomationListForPic(item, aParamValues));
                }
                else {
                    jQuery(div).append(CreateSystemResourceInfomationList(item, aParamValues));
                }
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitSystemResourceInfomationListData('" + param + "','" + dataDivId + "','" + resourceIds + "' ,{0},'" + rankStr + "', '" + type + "')", "PageNav")); //文章列表分页样式
            }

            InitContentDiv(aParamValues, div);
        }
    });
}
/******************************************************************/
//加载资源库搜索信息
/******************************************************************/
function InitSystemResourceInfomationSearchListData(param, dataDivId, resourceIds, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    aParamValues["ResourceId"] = resourceIds;
    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',kw:'" + aParamValues["SearchKeyWord"] + "',type:'" + aParamValues["SearchType"] + "',resourceIds:'" + aParamValues["SearchObj"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetSystemResourceInformationSearchList",
        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(CreateSystemResourceInfomationList(item, aParamValues));
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitSystemResourceInfomationSearchListData('" + param + "','" + dataDivId + "','" + resourceIds + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}

//列表显示
function CreateSystemResourceInfomationList(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.CreateTime.substring(6, item.CreateTime.length - 2))))) + "</div>";
    }
    if (aParamValues["IsShowClick"] == 1) {
        str += "<div class=\"text-float-right Click\" title=\"下载次数\">" + (item == null ? "&nbsp;" : item.Click) + "</div>";
    }
    if (aParamValues["IsShowUser"] == 1) {
        str += "<div class=\"text-float-right Name\" title=\"发布者\">" + (item == null ? "&nbsp;" : item.UserName) + "</div>";
    }
    str += "<div class=\"text-float-left TitleIcon\"></div>";
    if (aParamValues["IsShowResource"] == 1) {
        str += "<div class=\"text-float-left Category\" title=\"所属资源库\">" + (item == null ? "&nbsp;" : "<a href=" + item.ResourceUrl + ">" + item.ResourceName + "</a>") + "</div>";
    }
    str += "<div class=\"text-overflow Title\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>" + item.Title + "</a>") + "</div>";
    str += "</div>";
    return str;
}

//图片列表显示
function CreateSystemResourceInfomationListForPic(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>") + "</div>" +
              "<div class=\"text-float-left TitleIcon\"></div>" +
              "<div class=\"text-overflow Title\" style=\"width:65px;\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>" + item.Title + "</a>") + "</div>" +
              "</div>";

    return str;
}


/******************************************************************/
//系统资源密码访问处理
/******************************************************************/

//具体显示文章时密码验证处理(与列表中验证有所区别)
function CheckSystemResourcePwdAccess(rid) {

    var password = jQuery("#AccessPwd").val();
    var aParamValues = new Array();
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pwd:'" + password + "',pkId:'" + rid + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/CheckSystemResourcePwdAccess",
        success: function(result) {
            if (result.d == 0) {
                _error_msg_show("您输入的密码不正确，请重试!", '', 'sorry', "错误");
            }
            else {
                //重新加载文章内容
                location.href = location.href;
            }
        }
    });
}

/******************************************************************/
//选择资源库
/******************************************************************/
function SelectResource(nameId, valueId) {
    var ids = document.getElementById(valueId).value;
    var url = "/OperationManage/ResourceSelect.aspx?type=2&obId=0&ids=" + ids + "&nId=" + nameId + "&vId=" + valueId;
    showModalDialog(url, window, "dialogWidth:400px;dialogHeight:400px;help:no;scroll:no;status:no;resizable:no");
}

/******************************************************************/
//网站资源搜索模块
/******************************************************************/
function RedirectToResourceSearch(param, txtId, objId, typeId) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);

    if ($(txtId).value.Trim() == "") {
        _error_msg_show("请输入查询关键字", '', 'smile', "提醒");
    }
    else {
        location.href = "/MoreIndex.aspx?pkId=" + aParamValues["MoreMenuId"] + "&kw=" + $(txtId).value + "&obj=" + $(objId).value + "&st=" + $(typeId).value + "&t=3";

    }
}

/******************************************************************/
//网站自定义数据提交报表模块
/******************************************************************/
function InitSignUpShowListData(param, dataDivId, pageIndex) {

    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    var dataDiv = document.getElementById(dataDivId);
    if (dataDiv.innerHMTL == "") {
        dataDiv.innerText = "数据加载中...";
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "',newsMenuId:'" + aParamValues["NewsMenuId"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetSystemSignUpShowList",
        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(CreateSignUpShowListData(item, aParamValues));
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitSignUpShowListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}

function CreateSignUpShowListData(item, aParamValues) {
    var str = "<div class=\"TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.Title) + "\">";
    if (aParamValues["IsShowTime"] == 1) {
        var temp = GetDateFormat(aParamValues["TimeFormat"], new Date(parseInt(item.EndTime.substring(6, item.EndTime.length - 2))));
        if (temp != "" && temp != null) {
            temp = "截止时间：" + temp;
        }
        str += "<div class=\"text-float-right Date\">" + (item == null ? "&nbsp;" : temp) + "</div>";
    }
    str += "<div class=\"text-overflow Title\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target='_blank'>" + item.TitleName + "</a>") + "</div>";
    str += "</div>";
    return str;
}


/******************************************************************/
//加载资源信息评论
/******************************************************************/
function InitResourceCommentList(resourceId, t) {
    if (t == null) t = 0;
    document.getElementById("Comments").innerText = "数据加载中...";
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ resourceId:'" + resourceId + "', t:'" + t + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetSystemResourceComments",
        success: function(result) {
            jQuery("#Comments").html("");
            jQuery.each(result.d, function(i, item) {
                jQuery("#Comments").append(CreateResourceCommentList(item, i));
            });
        }
    });
}
function CreateResourceCommentList(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.CreateTime.substring(6, item.CreateTime.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;
    }
    else {
        suser.innerHTML = "<a href=" + item.UserUrl + " >" + item.UserName + "</a>";
    }
    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:ResourceComments('@" + item.UserName + "：\\r\\n')\">回复</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#top\" title='回到顶部'><img src='/Images/icon_up_gray.gif' boder=0/></a></td>"
	          + "</tr></table>";

    return str;
}
function ResourceComments(name) {

    document.getElementById("frmResourceComments").contentWindow.SetContent(name);
}


/******************************************************************/
//加载视频评论
/******************************************************************/
function InitVideoCommentList(videoId, t, pageIndex) {
    if (t == null) t = 0;
    document.getElementById("Comments").innerText = "数据加载中...";
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ videoId:'" + videoId + "', t:'" + t + "', pageIndex:'" + pageIndex + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetVideoComments",
        success: function(result) {
            jQuery("#Comments").html("");
            jQuery.each(result.d.List, function(i, item) {
                jQuery("#Comments").append(CreateResourceCommentList(item, i));
            });
            jQuery("#CommentCount").text(result.d.RecordCount);
            jQuery("#Comments").append(CreatePageNav(pageIndex, result.d.PageCount, "InitVideoCommentList('" + videoId + "','" + t + "',{0})", "PageNav"));
        }
    });
}


/******************************************************************/
//加载视频列表
/******************************************************************/
function InitVideoListData(param, dataDivId, pageIndex, rankStr, type) {

    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    var newsMenuId = aParamValues["NewsMenuId"];
    if (newsMenuId == null) newsMenuId = "0";
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',categoryId:'" + aParamValues["VideoCategoryId"] + "',rankStr:'" + rankStr + "',type:'" + type + "',newsMenuId:'" + newsMenuId + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetVideoList",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], 1);
            jQuery(div).addClass("clearfix VideoListBox");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                jQuery(div).append(CreateVideoList(item, aParamValues, result.d.PlayForPoint));
            });
            jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitVideoListData('" + param + "','" + dataDivId + "',{0}, '" + rankStr + "', '" + type + "')", "PageNav")); //文章列表分页样式
            InitContentDiv(aParamValues, div);
            jQuery("#divProgress").hide();
            SetAllVideoDemand();
        }
    });
}

/******************************************************************/
//加载视频搜索列表
/******************************************************************/
function InitVideoSearchListData(param, dataDivId, pageIndex, rankStr, type) {

    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    var newsMenuId = aParamValues["NewsMenuId"];
    if (newsMenuId == null) newsMenuId = "0";
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',kw:'" + aParamValues["SearchKeyWord"] + "',rankStr:'" + rankStr + "',type:'" + type + "',newsMenuId:'" + newsMenuId + "'}",
        dataType: "json",
        url: "/Service/VideoService.asmx/GetVideoSearchList",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], 1);
            jQuery(div).addClass("clearfix VideoListBox");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                jQuery(div).append(CreateVideoList(item, aParamValues, result.d.PlayForPoint));
            });
            jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitVideoSearchListData('" + param + "','" + dataDivId + "',{0},  '" + rankStr + "','" + type + "')", "PageNav")); //文章列表分页样式
            InitContentDiv(aParamValues, div);
            jQuery("#divProgress").hide();
            SetAllVideoDemand();
        }
    });
}

//图片列表显示
function CreateVideoList(item, aParamValues, playForPoint) {
    var str = "<ul class=\"text-float-left TitleBox\" >" +
                "<li class=\"VideoImage\" style=\"overflow: hidden; width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";\">" +
                    "<a title='" + (item == null ? "" : "名称：" + item.Name + (playForPoint == 1 ? "\n观看点数：" + (item.Point == "0" ? "免费" : item.Point + "点") : "") + "\n播放：" + item.PlayCount + "\n评分：" + item.AverageScore + "\n评论：" + item.CommentCount + "\n收藏：" + item.FavoriteCount + "\n被顶数：" + item.TopCount + "\n被踩数：" + item.BottomCount + "\n引用：" + item.QuoteCount + "\n播放时间：" + item.PlayTimeStr) + "' href='" + (item == null ? "" : item.VideoUrl) + "' target=\"_blank\" style=\"display: " + (item == null ? "none" : "") + "\"><img src='/" + (item == null ? "" : item.CoverImage) + "' width=\"100%\" height=\"100%\" border=\"0\"  /></a>" +
                    "<div style=\"position: relative; display: " + (item == null ? "none" : "") + "\">" +
                        "<img src=\"/Images/Video/qls.gif\" li=\"VideoDemand\" alt=\"添加到点播单\" style=\"cursor: pointer;display: none;\" onclick=\"javascript:SetDemandCookie('" + (item == null ? "" : item.PkId) + "', this)\" v='" + (item == null ? "" : item.PkId) + "' />" +
                    "</div>" +
                "</li>" +
                "<li class=\"text-float-left TitleIcon\" style=\"display: " + (item == null ? "none" : "") + "\"></li>" +
                "<li class=\"Title text-wrap1\" style=\"width: 128px;\">" +
                    "<a title='" + (item == null ? "" : "名称：" + item.Name + (playForPoint == 1 ? "\n观看点数：" + (item.Point == "0" ? "免费" : item.Point + "点") : "") + "\n播放：" + item.PlayCount + "\n评分：" + item.AverageScore + "\n评论：" + item.CommentCount + "\n收藏：" + item.FavoriteCount + "\n被顶数：" + item.TopCount + "\n被踩数：" + item.BottomCount + "\n引用：" + item.QuoteCount + "\n播放时间：" + item.PlayTimeStr) + "' href='" + (item == null ? "" : item.VideoUrl) + "' target=\"_blank\" style=\"display: " + (item == null ? "none" : "") + "\">" + (item == null ? "" : item.Name) + "</a><img src=\"/Images/Video/ico_locked.gif\" border=\"0\" align=\"absmiddle\" style=\"display: " + (item == null ? "none" : (item.ShowCtrl == 0 ? "none" : "")) + "\" title='" + (item == null ? "" : (item.ShowCtrl == 1 ? "仅对好友公开" : "密码保护")) + "' />&nbsp;<span class=\"PlayTime\">" + (item == null ? "" : item.PlayTimeStr) + "</span>" +
                "</li>" +
                "<li class=\"UpLower text-wrap1\" style=\"width: 128px;\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\"><img src=\"/Images/Video/ico_up.gif\" />" + (item == null ? "" : item.TopCount) + "&nbsp;<img src=\"/Images/Video/ico_down.gif\" />" + (item == null ? "" : item.BottomCount) + "</span>&nbsp;" +
                "</li>" +
                "<li class=\"User text-wrap1\" style=\"width: 128px;\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">用户:" + (item == null ? "" : (item.IsSystem == 1 ? "管理员发布" : "<a href='" + (item == null ? "" : item.UserUrl) + "' target='_blank'>" + (item == null ? "" : item.UserName) + "</a>")) + "</span>&nbsp;" +
                "</li>" +
                "<li class=\"Date text-wrap1\" style=\"width: 128px;\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">发布:" + (item == null ? "" : item.DateStr) + "</span>&nbsp;" +
                "</li>" +
                "<li class=\"Play text-wrap1\" style=\"width: 128px;\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">播放:" + (item == null ? "" : item.PlayCount) + "</span>&nbsp;" +
                "</li>" +
                "<li class=\"Comment text-wrap1\" style=\"width:128px;\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">评论:" + (item == null ? "" : item.CommentCount) + "</span>&nbsp;" +
                "</li>" +
              "</ul>";

    return str;
}


/******************************************************************/
//加载视频专辑列表
/******************************************************************/
function InitVideoAlbumListData(param, dataDivId, pageIndex, rankStr, type) {

    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    var newsMenuId = aParamValues["NewsMenuId"];
    if (newsMenuId == null) newsMenuId = "0";
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',categoryId:'" + aParamValues["VideoCategoryId"] + "',rankStr:'" + rankStr + "',type:'" + type + "',newsMenuId:'" + newsMenuId + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetVideoAlbumList",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], 1);
            jQuery(div).addClass("clearfix VideoAlbumListBox");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                jQuery(div).append(CreateVideoAlbumList(item, aParamValues));
            });
            jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitVideoAlbumListData('" + param + "','" + dataDivId + "',{0}, '" + rankStr + "', '" + type + "')", "PageNav")); //文章列表分页样式
            InitContentDiv(aParamValues, div);
            jQuery("#divProgress").hide();
        }
    });
}

/******************************************************************/
//加载视频专辑搜索列表
/******************************************************************/
function InitVideoAlbumSearchListData(param, dataDivId, pageIndex, rankStr, type) {

    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    var newsMenuId = aParamValues["NewsMenuId"];
    if (newsMenuId == null) newsMenuId = "0";
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',kw:'" + aParamValues["SearchKeyWord"] + "',rankStr:'" + rankStr + "',type:'" + type + "',newsMenuId:'" + newsMenuId + "'}",
        dataType: "json",
        url: "/Service/VideoService.asmx/GetVideoAlbumSearchList",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], 1);
            jQuery(div).addClass("clearfix VideoAlbumListBox");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                jQuery(div).append(CreateVideoAlbumList(item, aParamValues));
            });
            jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitVideoAlbumSearchListData('" + param + "','" + dataDivId + "',{0}, '" + rankStr + "',  '" + type + "')", "PageNav")); //文章列表分页样式
            InitContentDiv(aParamValues, div);
            jQuery("#divProgress").hide();
        }
    });
}

//图片列表显示
function CreateVideoAlbumList(item, aParamValues) {
    var str = "<div class=\"TitleBox\" title='" + (item == null ? "" : item.Name) + "' style=\"clear:both;\">" +
                "<div class=\"VideoAlbumImage\" style=\"overflow: hidden;width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";float:left;\">" +
                    "<a href='" + (item == null ? "" : item.AlbumListUrl) + "' target=\"_blank\" style=\"display: " + (item == null ? "none" : "") + "\"><img src='/" + (item == null ? "" : item.CoverImage) + "' width=\"100%\" height=\"100%\" border=\"0\" alt='" + (item == null ? "" : item.Name) + "' onerror=\"javascript:this.src='/Images/Video/icon_video.jpg'\"  /></a>" +
                "</div>" +
                "<div style=\"float:left;\">" +
                    "<div class=\"text-float-left TitleIcon\" style=\"display: " + (item == null ? "none" : "") + "\"></div>" +
                    "<div class=\"Title text-wrap1\">" +
                        "<a href='" + (item == null ? "" : item.AlbumListUrl) + "' target=\"_blank\" style=\"display: " + (item == null ? "none" : "") + "\">" + (item == null ? "" : item.Name) + "</a>&nbsp;<span class=\"PlayTime\">" + (item == null ? "" : item.PlayTimeStr) + "</span>" +
                    "</div>" +
                    "<div class=\"Intro text-wrap1\">" +
                        "<span style=\"display: " + (item == null ? "none" : "") + "\">" + (item == null ? "" : item.Intro) + "</span>&nbsp;" +
                    "</div>" +
                    "<div class=\"User text-wrap1\">" +
                        "<span style=\"display: " + (item == null ? "none" : "") + "\">用户:" + (item == null ? "" : (item.IsSystem == 1 ? "管理员发布" : "<a href='" + (item == null ? "" : item.UserUrl) + "' target='_blank'>" + (item == null ? "" : item.UserName) + "</a>")) + " | 视频:" + (item == null ? "" : item.VideoCount) + " | 播放:" + (item == null ? "" : item.PlayCount) + "</span>&nbsp;" +
                    "</div>" +
                    "<ul class=\"VideoListBox\">" +
                    (item == null ? "" : CreateAlbumVideoList(item.VideoList)) +
                    "</ul>" +
                    "<div class=\"PlayNav\">" +
                        "<span style=\"display: " + (item == null ? "none" : "") + "\"><a href=\"" + (item == null ? "" : item.AlbumListUrl) + "\" target=\"_blank\">本专辑全部视频列表</a> | <a href=\"" + (item == null ? "" : item.AlbumPlayUrl) + "\" target=\"_blank\">全部播放</a></span>&nbsp;" +
                    "</div>" +
                "</div>" +
              "</div>";

    return str;
}

function CreateAlbumVideoList(list) {
    var str = "";
    jQuery.each(list, function() {
        str += "<li class=\"VideoName\"><a href='" + this.VideoUrl + "' target=\"_blank\">" + this.Name + "</a>&nbsp;<span class=\"PlayTime\">" + this.PlayTimeStr + "</span></li>";
    });
    return str;
}


/******************************************************************/
//加载专辑视频列表
/******************************************************************/
function InitVideoListDataForAlbum(dataDivId, albumId, pageIndex) {

    var aParamValues = new Array();
    aParamValues["DataDivId"] = dataDivId;
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', albumId:'" + albumId + "', count:'20'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetVideoListForAlbum",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            jQuery(div).addClass("clearfix VideoListBox");
            jQuery(div).html("");
            jQuery.each(result.d.List, function(i, item) {
                jQuery(div).append(CreateVideoListForAlbum(item, aParamValues));
            });
            jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitVideoListDataForAlbum('" + dataDivId + "','" + albumId + "',{0})", "PageNav"));
            InitContentDiv(aParamValues, div);
            SetAllVideoDemand();
        }
    });
}

function CreateVideoListForAlbum(item, aParamValues) {
    var str = "<ul class=\"text-float-left TitleBox\" >" +
                "<li class=\"VideoImage\" style=\"overflow: hidden; width: 128px; height: 96px;\">" +
                    "<a title='" + (item == null ? "" : "名称：" + item.Name + "\n播放：" + item.PlayCount + "\n评分：" + item.AverageScore + "\n评论：" + item.CommentCount + "\n收藏：" + item.FavoriteCount + "\n被顶数：" + item.TopCount + "\n被踩数：" + item.BottomCount + "\n引用：" + item.QuoteCount + "\n播放时间：" + item.PlayTimeStr) + "' href='" + (item == null ? "" : item.VideoUrl) + "' target=\"_blank\" style=\"display: " + (item == null ? "none" : "") + "\"><img src='" + (item == null ? "" : item.CoverImage) + "' width=\"100%\" height=\"100%\" border=\"0\"  /></a>" +
                     "<div style=\"position: relative; display: " + (item == null ? "none" : "") + "\">" +
                        "<img src=\"/Images/Video/qls.gif\" li=\"VideoDemand\" alt=\"添加到点播单\" style=\"cursor: pointer;display: none;\" onclick=\"javascript:SetDemandCookie('" + (item == null ? "" : item.PkId) + "', this)\" v='" + (item == null ? "" : item.PkId) + "' />" +
                    "</div>" +
                "</li>" +
                "<li class=\"text-float-left TitleIcon\" style=\"display: " + (item == null ? "none" : "") + "\"></li>" +
                "<li class=\"Title text-wrap1\" style=\"width: 128px;\">" +
                    "<a href='" + (item == null ? "" : item.VideoUrl) + "' target=\"_blank\" style=\"display: " + (item == null ? "none" : "") + "\">" + (item == null ? "" : item.Name) + "</a><img src=\"/Images/Video/ico_locked.gif\" border=\"0\" align=\"absmiddle\" style=\"display: " + (item == null ? "none" : (item.ShowCtrl == 0 ? "none" : "")) + "\" title='" + (item == null ? "" : (item.ShowCtrl == 1 ? "仅对好友公开" : "密码保护")) + "' />&nbsp;<span class=\"PlayTime\">" + (item == null ? "" : item.PlayTimeStr) + "</span>" +
                "</li>" +
                "<li class=\"Play text-wrap1\" style=\"width: 128px;\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">播放:" + (item == null ? "" : item.PlayCount) + "</span>&nbsp;" +
                "</li>" +
              "</ul>";

    return str;
}


/******************************************************************/
//加载专辑视频列表
/******************************************************************/
function InitVideoListDataForAlbumPlay(dataDivId, albumId, videoId, pageIndex) {

    var aParamValues = new Array();
    aParamValues["DataDivId"] = dataDivId;
    aParamValues["VideoId"] = videoId;
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', albumId:'" + albumId + "', count:'10'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetVideoListForAlbum",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            jQuery(div).addClass("clearfix VideoListBox");
            jQuery(div).html("");
            jQuery.each(result.d.List, function(i, item) {
                jQuery(div).append(CreateVideoListForAlbumPlay(item, aParamValues));
            });
            jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitVideoListDataForAlbumPlay('" + dataDivId + "','" + albumId + "','" + videoId + "',{0})", "PageNav"));
            InitContentDiv(aParamValues, div);
        }
    });
}

function CreateVideoListForAlbumPlay(item, aParamValues) {
    var str = "";
    if (aParamValues["VideoId"] == item.PkId) {
        str = "<li class=\"VideoName PlayVideo\"><a href='" + item.VideoUrl + "'>" + item.Name + "</a>&nbsp;<span class=\"PlayTime\">" + (item == null ? "" : item.PlayTimeStr) + "</span></li>";
    }
    else {
        str = "<li class=\"VideoName\"><a href='" + item.VideoUrl + "'>" + item.Name + "</a>&nbsp;<span class=\"PlayTime\">" + (item == null ? "" : item.PlayTimeStr) + "</span></li>";
    }
    return str;
}


/******************************************************************/
//加载点播单
/******************************************************************/
function InitVideoDemandListData(param, dataDivId, pageIndex) {

    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'20'}",
        dataType: "json",
        url: "/Service/VideoService.asmx/GetVideoDemandList",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], 1);
            jQuery(div).addClass("clearfix VideoListBox");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                jQuery(div).append(CreateVideoDemandList(item, aParamValues, result.d.PlayForPoint));
            });
            jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitVideoDemandListData('" + param + "','" + dataDivId + "',{0})", "PageNav")); //文章列表分页样式
            InitContentDiv(aParamValues, div);
            SetAllRemoveVideoDemand();
        }
    });
}

//图片列表显示
function CreateVideoDemandList(item, aParamValues, playForPoint) {
    var str = "<ul class=\"text-float-left TitleBox\" >" +
                "<li class=\"VideoImage\" style=\"overflow: hidden; width: 128px; height: 96px;\">" +
                    "<a title='" + (item == null ? "" : "名称：" + item.Name + (playForPoint == 1 ? "\n观看点数：" + (item.Point == "0" ? "免费" : item.Point + "点") : "") + "\n播放：" + item.PlayCount + "\n评分：" + item.AverageScore + "\n评论：" + item.CommentCount + "\n收藏：" + item.FavoriteCount + "\n被顶数：" + item.TopCount + "\n被踩数：" + item.BottomCount + "\n引用：" + item.QuoteCount + "\n播放时间：" + item.PlayTimeStr) + "' href='" + (item == null ? "" : item.VideoUrl) + "' target=\"_blank\" style=\"display: " + (item == null ? "none" : "") + "\"><img src='/" + (item == null ? "" : item.CoverImage) + "' width=\"100%\" height=\"100%\" border=\"0\"  /></a>" +
                    "<div style=\"position: relative; display: " + (item == null ? "none" : "") + "\">" +
                        "<img src=\"/Images/Video/qlus.gif\" li=\"VideoDemandR\" alt=\"从点播单中移除\" style=\"cursor: pointer;display: none;\" onclick=\"javascript:RemoveDemandCookie('" + (item == null ? "" : item.PkId) + "', this)\" v='" + (item == null ? "" : item.PkId) + "' />" +
                    "</div>" +
                "</li>" +
                "<li class=\"text-float-left TitleIcon\" style=\"display: " + (item == null ? "none" : "") + "\"></li>" +
                "<li class=\"Title text-wrap1\" style=\"width: 128px;\">" +
                    "<a title='" + (item == null ? "" : "名称：" + item.Name + (playForPoint == 1 ? "\n观看点数：" + (item.Point == "0" ? "免费" : item.Point + "点") : "") + "\n播放：" + item.PlayCount + "\n评分：" + item.AverageScore + "\n评论：" + item.CommentCount + "\n收藏：" + item.FavoriteCount + "\n被顶数：" + item.TopCount + "\n被踩数：" + item.BottomCount + "\n引用：" + item.QuoteCount + "\n播放时间：" + item.PlayTimeStr) + "' href='" + (item == null ? "" : item.VideoUrl) + "' target=\"_blank\" style=\"display: " + (item == null ? "none" : "") + "\">" + (item == null ? "" : item.Name) + "</a><img src=\"/Images/Video/ico_locked.gif\" border=\"0\" align=\"absmiddle\" style=\"display: " + (item == null ? "none" : (item.ShowCtrl == 0 ? "none" : "")) + "\" title='" + (item == null ? "" : (item.ShowCtrl == 1 ? "仅对好友公开" : "密码保护")) + "' />&nbsp;<span class=\"PlayTime\">" + (item == null ? "" : item.PlayTimeStr) + "</span>" +
                "</li>" +
                "<li class=\"UpLower text-wrap1\" style=\"width: 128px;\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\"><img src=\"/Images/Video/ico_up.gif\" />" + (item == null ? "" : item.TopCount) + "&nbsp;<img src=\"/Images/Video/ico_down.gif\" />" + (item == null ? "" : item.BottomCount) + "</span>&nbsp;" +
                "</li>" +
                "<li class=\"User text-wrap1\" style=\"width: 128px;\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">用户:" + (item == null ? "" : (item.IsSystem == 1 ? "管理员发布" : "<a href='" + (item == null ? "" : item.UserUrl) + "' target='_blank'>" + (item == null ? "" : item.UserName) + "</a>")) + "</span>&nbsp;" +
                "</li>" +
                "<li class=\"Date text-wrap1\" style=\"width: 128px;\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">发布:" + (item == null ? "" : item.DateStr) + "</span>&nbsp;" +
                "</li>" +
                "<li class=\"Play text-wrap1\" style=\"width: 128px;\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">播放:" + (item == null ? "" : item.PlayCount) + "</span>&nbsp;" +
                "</li>" +
                "<li class=\"Comment text-wrap1\" style=\"width:128px;\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">评论:" + (item == null ? "" : item.CommentCount) + "</span>&nbsp;" +
                "</li>" +
              "</ul>";

    return str;
}

function InitVideoLoginModuleData(param, divLoginId, divNotLoginId, dataDivId) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ }",
        dataType: "json",
        url: "/Service/ShareService.asmx/CheckBlogIsLogin",
        success: function(result) {

            var div = GetContentDiv(aParamValues);
            if (result.d[0] == "1") {
                jQuery("#" + divLoginId).show();
                jQuery("#" + divNotLoginId).hide();
                jQuery("#" + divLoginId).html("欢迎您，" + result.d[1] + "</a> | <a href=\"/Home.aspx\" target=\"_blank\">我的个人工作空间</a> | <a href=\"javascript:\" onclick=\"SetVideoLoginOut();\">登出</a>");
            }
            else {
                jQuery("#" + divLoginId).hide();
                jQuery("#" + divNotLoginId).show();
            }
            InitContentDiv(aParamValues, div);
        }
    });
}
function SetVideoLoginOut() {
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ }",
        dataType: "json",
        url: "/Service/ShareService.asmx/LogOut",
        success: function(result) {
            location.href = location.href;
        }
    });
}


/******************************************************************/
//加载子网站列表
/******************************************************************/
function InitSubSiteListData(param, dataDivId, pageIndex) {
    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;

    document.getElementById(dataDivId).innerText = "数据加载中...";
    if (aParamValues["MoreMenuId"] == null) {
        aParamValues["MoreMenuId"] = 0;
    }
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',moreMenuId:'" + aParamValues["MoreMenuId"] + "',unitId:'" + aParamValues["UnitId"] + "',departmentId:'" + aParamValues["DepartmentId"] + "'}",
        dataType: "json",
        url: "/Service/SystemService.asmx/GetSubSiteList",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], "1");
            jQuery(div).addClass("clearfix Box");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                switch (aParamValues["PostShowMode"]) {
                    case "0":
                        jQuery(div).append(CreateSubSiteListData(item, aParamValues));
                        break;
                    case "1":
                        jQuery(div).append(CreateSubSiteForPhotoListData(item, aParamValues));
                        break;
                }
            });
            if (aParamValues["IsShowPageNav"] == "1") {
                jQuery(div).append("<div width=\"width:100%;\">" + CreatePageNav(pageIndex, result.d.PageCount, "InitSubSiteListData('" + param + "','" + dataDivId + "' ,{0})", "PageNav")); //文章列表分页样式
            }
            InitContentDiv(aParamValues, div);
        }
    });
}

//带照片显示
function CreateSubSiteForPhotoListData(item, aParamValues) {
    var s1 = document.createElement("div");
    s1.innerHTML = item == null ? "&nbsp;" : "<a href=" + item.Url + " target=_blank>" + item.Photo + "</a>";
    if (s1.document.getElementById("SubSitePhoto") != null) {
        s1.document.getElementById("SubSitePhoto").style.width = "100%";
        s1.document.getElementById("SubSitePhoto").style.height = "100%";
    }
    var str = "<div class=\"text-float-left TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.Name) + "\">" +
              "<div class=\"text-float-left Photo\" style=\"width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";\">" + s1.innerHTML + "</div>" +
              "<div class=\"text-float-left\">" +
              "<div class=\"Des\">" + (item == null ? "&nbsp;" : item.Description) + "</div>" +
              "<div class=\"text-float-left TitleIcon\"></div>" +
              "<div class=\"text-overflow Title\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target=_blank>" + item.Name + "</a>") + "</div>";
    if (aParamValues["IsShowTime"] == 1) {
        str += "<div class=\"Date\">" + (item == null ? "&nbsp;" : GetDateFormat(aParamValues["TimeFormat"], new Date(parseInt(item.CreateTime.substring(6, item.CreateTime.length - 2))))) + "</div>";
    }
    str += "</div></div>";

    return str;

}
//列表显示
function CreateSubSiteListData(item, aParamValues) {
    var str = "<div class=\"TitleBox\" title=\"" + (item == null ? "&nbsp;" : item.Name) + "\">";
    if (aParamValues["IsShowTime"] == 1) {
        str += "<div class=\"text-float-right Date\">" + ((item == null ? "&nbsp;" : GetDateFormat(aParamValues["TimeFormat"], new Date(parseInt(item.CreateTime.substring(6, item.CreateTime.length - 2)))))) + "</div>";
    }
    str += "<div class=\"text-float-left TitleIcon\"></div><div class=\"text-overflow Title\">" + (item == null ? "&nbsp;" : "<a href=" + item.Url + " target=_blank>" + item.Name + "</a>") + "</div>";
    str += "</div>";

    return str;
}


/******************************************************************/
//频道轮播操作
/******************************************************************/
var PlayItem;
function SetChannelPlay(partId, obj, playId, channelId, nameId) {
    jQuery("#" + partId + " li[t=Name]").removeClass().addClass("Name");
    jQuery("#" + partId + " li[t=Image]").hide();
    jQuery(obj).parent().removeClass().addClass("Name").addClass("Selected");
    jQuery(obj).parent().prev().show();
    GetStartPlayVideo(playId, channelId, nameId);
}
//一个视频播放后自动播放下面一个视频
function GetNextPlayVideo(playId, nameId) {
    SetCookie("Edjoy_VideoChannelPlay_" + PlayItem.ChannelId, PlayItem.ChannelItemId + "@" + PlayItem.VideoId);
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ channelId:'" + PlayItem.ChannelId + "', itemId : '" + PlayItem.ChannelItemId + "', currentVideoId: '" + PlayItem.VideoId + "'}",        
        dataType: "json",
        url: "/Service/VideoService.asmx/GetNextChannelPlayVideo",
        success: function(result) {
            var item = result.d;
            PlayChannelVideo(item, playId, nameId);
        }
    });
}

function GetStartPlayVideo(playId, channelId, nameId) {
    if (!PlayCookieVideo(channelId, playId, nameId)) {
        jQuery.ajax({
            type: "POST",
            contentType: "application/json",
            data: "{ channelId:'" + channelId + "'}",
            dataType: "json",
            url: "/Service/VideoService.asmx/GetNextVideoFromStart",
            success: function(result) {
                var item = result.d;
                PlayChannelVideo(item, playId, nameId);
            }
        });
    }
}

function PlayCookieVideo(channelId, playId, nameId) {
    
    var cookie = GetCookie("Edjoy_VideoChannelPlay_" + channelId);
    if (cookie == null) {
        return false;
    }
    else {
        var ss = cookie.split('@');
        var itemId = parseInt(ss[0], 10);
        var videoId = parseInt(ss[1], 10);
        if (isNaN(itemId) || isNaN(videoId)) {
            return false;
        }
        else {
            jQuery.ajax({
                type: "POST",
                contentType: "application/json",
                data: "{ channelId:'" + channelId + "', itemId : '" + itemId + "', currentVideoId: '" + videoId + "'}",
                dataType: "json",
                url: "/Service/VideoService.asmx/GetNextChannelPlayVideo",
                success: function(result) {
                    var item = result.d;
                    PlayChannelVideo(item, playId, nameId);
                }
            });
            return true;
        }
    }
}

function PlayChannelVideo(item, playId, nameId) {
    var flashvars = {
        image: "/" + item.ImageUrl,
        file: "/" + item.FlvUrl,
        autostart: true,
        skin: "/Tools/Skins/modieus/modieus.swf",
        wmode: "Opaque",
        controlbar : "none",
        displayclick: "fullscreen"
    };
    var params = {
        allowfullscreen: true,
        allowscriptaccess: "always",
        wmode: "Opaque"
    };
    parent.swfobject.embedSWF("/Tools/player.swf", playId, "100%", "100%", "9.0.0", "/Tools/expressInstall.swf", flashvars, params);
    if (item.VideoId != "0") {
        jQuery("#" + playId + "Image").hide();
        jQuery("#" + playId).show();
        jQuery("#" + nameId).text(item.ItemName + "-->" + item.VideoName);       
        PlayItem = item;
    }
    else {
        jQuery("#" + nameId).text("");       
        jQuery("#" + playId).hide();
        jQuery("#" + playId + "Image").show().html("<img src=\"/Images/Video/NochannelVideo.jpg\" align=\"absmiddle\" border=\"0\" width=\"100%\" height=\"100%\" />");        
    }
}




/******************************************************************/
//加载直播频道列表
/******************************************************************/
function InitVideoLiveChannelListData(param, dataDivId, pageIndex, type, recommend, categoryId) {

    var aParamValues = new Array();
    InitParams(param, aParamValues);
    aParamValues["DataDivId"] = dataDivId;
    var newsMenuId = aParamValues["NewsMenuId"];
    if (newsMenuId == null) newsMenuId = "0";
    jQuery.ajax({
        type: "POST",
        contentType: "application/json",
        data: "{ pageIndex:'" + pageIndex + "', pageSize:'" + aParamValues["PageSize"] + "',type:'" + type + "',categoryId:'" + categoryId + "',newsMenuId:'" + newsMenuId + "',recommend:'" + recommend + "'}",
        dataType: "json",
        url: "/Service/VideoService.asmx/GetVideoLiveChannel",
        success: function(result) {
            var div = GetContentDiv(aParamValues);
            var list = InitFixed(result.d.List, aParamValues["PageSize"], 1);
            jQuery(div).addClass("clearfix ListBox");
            jQuery(div).html("");
            jQuery.each(list, function(i, item) {
                jQuery(div).append(CreateVideoLiveChannelList(item, aParamValues));
            });
            jQuery(div).append(CreatePageNav(pageIndex, result.d.PageCount, "InitVideoLiveChannelListData('" + param + "','" + dataDivId + "',{0}, '" + type + "', '" + recommend + "', "+categoryId+")", "PageNav")); //文章列表分页样式
            InitContentDiv(aParamValues, div);
            jQuery("#divProgress").hide();            
        }
    });
}


//图片列表显示
function CreateVideoLiveChannelList(item, aParamValues) {
    var str = "<ul class=\"text-float-left TitleBox\" >" +
                "<li class=\"Photo\" style=\"overflow: hidden; width:" + aParamValues["ImageWidth"] + ";height:" + aParamValues["ImageHeight"] + ";\">" +
                    "<a href='" + (item == null ? "" : item.LiveUrl) + "' target=\"_blank\" style=\"display: " + (item == null ? "none" : "") + "\">" + ((item == null ? "" : item.UserPhoto)) + "</a>" +                    
                "</li>" +
                "<li class=\"Title\" style=\"width:" + aParamValues["ImageWidth"] + ";\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">直播名称:<a href='" + (item == null ? "" : item.LiveUrl) + "' target=\"_blank\">" + (item == null ? "" : item.Name) + "</a></span>" +
                "</li>" +               
                "<li class=\"User text-wrap1\" style=\"width:" + aParamValues["ImageWidth"] + ";\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">主持人:" + (item == null ? "" : ("<a href='" + (item == null ? "" : item.UserUrl) + "' target='_blank'>" + (item == null ? "" : item.FullName) + "</a>")) + "</span>&nbsp;" +
                "</li>" +
                "<li class=\"Category text-wrap1\" style=\"width:" + aParamValues["ImageWidth"] + ";\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">直播类别:" + (item == null ? "" : item.CategoryName) + "</span>&nbsp;" +
                "</li>" +
                "<li class=\"Date text-wrap1\" style=\"width:" + aParamValues["ImageWidth"] + ";\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">直播时间:" + (item == null ? "" : new Date(parseInt(item.LiveTime.substring(6, item.CreateTime.length - 2))).formatt("yyyy-MM-dd")) + "</span>&nbsp;" +
                "</li>" +
                "<li class=\"Control text-wrap1\" style=\"width:" + aParamValues["ImageWidth"] + ";\">" +
                    "<span style=\"display: " + (item == null ? "none" : "") + "\">权限:" + (item == null ? "" : item.ShowCtrlStr) + "</span>&nbsp;" +
                "</li>" +
              "</ul>";

    return str;
}

//查看网站之星详细列表
function ViewDetail(oriDiv, targetDiv) {
    jQuery("#" + targetDiv).html(jQuery("#" + oriDiv).html());
}