﻿/// <reference path="~/Scripts/jquery-1.3.2-vsdoc.js" />
var noticeStr = new Object();
var menuresult = "";
function ExecMethod(obj) {
    switch (obj.Type) {
        //信息列表
        case "NotList": { var n = new NoticeList(obj); n.GetNotice(); break; }
        //获取综合信息
        case "NotZhList": { var n = new NoticeList(obj); n.GetZhNotice();break;}
        //获取父级栏目下的信息
        case "NotFList": { var n = new NoticeList(obj); n.GetFNotice();break;}
        case "Menu": { var m = new Menu(obj); m.GetMenu(); break;}
        case "MenuLong": { var m = new Menu(obj); m.GetMenu(); break;}
        default: alert(obj.Type); alert("出错");
    }
}

//六大模块

var size = 5;
var len = 25;
var lens = 25;
var img = "";
function Getarr() {
    var size = 5;
    var arr = new Array();
    arr[0] = new Array();
    arr[1] = new Array();
    arr[2] = new Array();
    arr[3] = new Array();
    arr[4] = new Array();
    arr[5] = new Array();
    arr[6] = new Array();

    //******************---------综合服务----------------****************/
    
    var obj = new Object();
    obj.id = "zhtzgg";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength =len;
    obj.Model = "Model1";
    obj.Type = "NotZhList";
    obj.Title = "通知公告";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-010000000001";
    obj.Size = size;
    obj.LinkId = "zhtzggmore";
    obj.TitleId = "zhtzggtitle";
    obj.DataId = "zhtzggdata";
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-010000000001";
    obj.PageSize = 8;

    arr[0][0] = obj;

    obj = new Object();

    obj.id = "zhzbxx";
    obj.DataLength = len;
    obj.ModelId = "tabnotice";
    obj.Model = "Model1";
    obj.Type = "NotList";
    obj.Image = img;
    obj.Title = "招标信息";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-010000000002";
    obj.LinkId = "zhzbxxmore";
    obj.TitleId = "zhzbxxtitle";
    obj.DataId = "zhzbxxdata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-010000000002";
    obj.PageSize = 6;
    arr[0][1] = obj;
    

    obj = new Object();
    obj.size = 5;
    obj.id = "zhryzl";
    obj.ModelId = "tabnotice";
    obj.DataLength = len;
    obj.Image = img;
    obj.Model = "Model1";
    obj.Type = "NotList";
    obj.Title = "人才招录";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-010000000003";
    obj.Size = size;
    obj.LinkId = "zhryzlmore";
    obj.TitleId = "zhryzltitle";
    obj.DataId = "zhryzldata";
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-010000000003";
    obj.PageSize = 6;
    arr[0][2] = obj;


    obj = new Object();
    obj.id = "zhflfg";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = len;
    obj.Model = "Model1";
    obj.Type = "NotFList";
    obj.Title = "海事法规";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-110000000001";
    obj.LinkId = "zhflfgmore";
    obj.TitleId = "zhflfgtitle";
    obj.DataId = "zhflfgdata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0000-030000000011";
    obj.PageSize = 8;
    arr[0][3] = obj;
    //******************---------通航管理----------------****************/
    var obj = new Object();
    obj.id = "thtzgg";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = len;
    obj.Model = "Model1";
    obj.Type = "NotList";
    obj.Title = "通知公告";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-020000000001";
    obj.Size = size;
    obj.LinkId = "thtzggmore";
    obj.TitleId = "thtzggtitle";
    obj.DataId = "thtzggdata";
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-020000000001";
    obj.PageSize = 4;
    arr[1][0] = obj;

    obj = new Object();

    obj.id = "thbszn";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = lens;
    obj.Model = "Model3";
    obj.Type = "Menu";
    obj.Image = img;
    obj.Title = "办事指南";
    obj.More = "Notice/CatgNotice/00000000-0000-0300-0200-020000000001";
    obj.LinkId = "thbsznmore";
    obj.TitleId = "thbszntitle";
    obj.DataId = "thbszndata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-020000000002";
    obj.PageSize = 4;
    arr[1][1] = obj;

    obj = new Object();
    obj.id = "thcbdxz";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = 24;
    obj.Model = "Model1";
    obj.Type = "NotList";
    obj.Title = "船舶定线制、报告制";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-020000000005";
    obj.LinkId = "thcbdxzmore";
    obj.TitleId = "thcbdxztitle";
    obj.DataId = "thcbdxzdata";
    obj.Method = "GetNotice";
    obj.LinkId = "thcbdxzmore";
    obj.TitleId = "thcbdxztitle";
    obj.DataId = "thcbdxzdata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-020000000005";
    obj.PageSize = 4;
    arr[1][2] = obj;


    obj = new Object();
    obj.size = 4;
    obj.ModelId = "tabnotice";
    obj.DataLength = len;
    obj.id = "thvts";
    
    obj.Image = img;
    obj.Model = "Model1";
    obj.Type = "NotList";
    obj.Title = "VTS指南";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-020000000004";
    obj.Size = size;
    obj.LinkId = "thvtsmore";
    obj.TitleId = "thvtstitle";
    obj.DataId = "thvtsdata";
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-020000000004";
    obj.PageSize = 4;
    arr[1][3] = obj;

//    obj = new Object();
//    obj.size = 4;
//    obj.DataLength = len;
//    obj.id = "thbgt";
//    obj.ModelId = "tabnotice";
//    obj.Image = img;
//    obj.Model = "Model1";
//    obj.Type = "NotList";
//    obj.Title = "航行警告";
//    obj.More = "Notice/NotList/00000000-0000-0000-0300-020000000006";
//    obj.Size = size;
//    obj.LinkId = "bgtmore";
//    obj.TitleId = "bgttitle";
//    obj.DataId = "bgtdata";
//    obj.Method = "NotList";
//    obj.Para = "00000000-0000-0000-0300-020000000006";
//    obj.PageSize = 4;
//    arr[1][4] = obj;
   
   
    //******************---------船舶信息----------------****************/
    obj = new Object();
    obj.id = "cbtzgg";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = len;
    obj.Model = "Model1";
    obj.Type = "NotList";
    obj.Title = "通知公告";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-030000000001";
    obj.Size = size;
    obj.LinkId = "cbtzggmore";
    obj.TitleId = "cbtzggtitle";
    obj.DataId = "cbtzggdata";
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-030000000001";
    arr[2][0] = obj;
    obj.PageSize = 7;
    obj = new Object();

    obj.id = "cbbszn";
    obj.ModelId = "tabnotice";
    obj.DataLength = lens;
    obj.Model = "Model3";
    obj.Type = "Menu";
    obj.Image = img;
    obj.Title = "办事指南";
    obj.More = "Notice/CatgNotice/00000000-0000-0300-0300-020000000001";
    obj.LinkId = "cbbsznmore";
    obj.TitleId = "cbbszntitle";
    obj.DataId = "cbbszndata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-030000000002";
    obj.PageSize = 5;
    arr[2][1] = obj;

    obj = new Object();
    obj.id = "cbxxcx";
    obj.ModelId = "tabnotice";
    obj.Type = "MenuLong";
    obj.Model = "Model1";
    obj.DataLength = lens;
    obj.Title = "信息查询";
    obj.More = "Ship/Aqcxcbmd/00000000-0000-0300-0300-030000000001";
    obj.LinkId = "cbxxcxmore";
    obj.TitleId = "cbxxcxtitle";
    obj.DataId = "cbxxcxdata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-030000000003";
    obj.PageSize = 8;
    arr[2][2] = obj;


    obj = new Object();
    obj.id = "cbajxx";
    obj.ModelId = "tabnotice";
    obj.Type = "NotList";
    obj.Model = "Model1";
    obj.DataLength = len;
    obj.Title = "船舶安检信息";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-030000000004";
    obj.LinkId = "cbajxxmore";
    obj.TitleId = "cbajxxtitle";
    obj.DataId = "cbajxxdata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-030000000003";
    obj.PageSize = 5;
    arr[2][3] = obj;

    //******************---------危防信息----------------****************/
    obj = new Object();
    obj.id = "wftzgg";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = len;
    obj.Model = "Model1";
    obj.Type = "NotList";
    obj.Title = "通知公告";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-040000000001";
    obj.Size = size;
    obj.LinkId = "wftzggmore";
    obj.TitleId = "wftzggtitle";
    obj.DataId = "wftzggdata";
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-040000000001";
    arr[3][0] = obj;
    obj.PageSize = 7;
    
    obj = new Object();

    obj.id = "cbbszn";
    obj.ModelId = "tabnotice";
    obj.DataLength = lens;
    obj.Model = "Model3";
    obj.Type = "Menu";
    obj.Image = img;
    obj.Title = "办事指南";
    obj.More = "Notice/CatgNotice/00000000-0000-0300-0400-020000000001";
    obj.LinkId = "wfbsznmore";
    obj.TitleId = "wfbszntitle";
    obj.DataId = "wfbszndata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-040000000002";
    obj.PageSize = 7;
    arr[3][1] = obj;

    obj = new Object();
    obj.id = "wftzgg";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = len;
    obj.Model = "Model1";
    obj.Type = "NotList";
    obj.Title = "通知公告";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-040000000004";
    obj.Size = size;
    obj.LinkId = "wfrkdyjcpmore";
    obj.TitleId = "wfrkdyjcptitle";
    obj.DataId = "wfrkdyjcpdata";
    obj.Method = "NotList";

    obj.Para = "00000000-0000-0000-0300-040000000004";
    obj.PageSize = 7;

    obj.Para = "00000000-0000-0000-0300-040000000004";

    arr[3][2] = obj;



    /**************** 船员管理****************************/
    
    var obj = new Object();
    obj.Image = img;
    obj.ModelId = "tabnotice";
    obj.DataLength = len;
    obj.id = "cytzgg";
    obj.Model = "Model1";
    obj.Type = "NotList";
    obj.Title = "通知公告";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-050000000001";
    obj.Size = size;
    obj.LinkId = "cytzggmore";
    obj.TitleId = "cytzggtitle";
    obj.DataId = "cytzggdata";
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-050000000001";
    obj.PageSize = 8;
    arr[4][0] = obj;

    obj = new Object();
    obj.id = "cybszn";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = len;
    obj.Model = "Model3";
    obj.Type = "Menu";
    obj.Image = img;
    obj.Title = "办事指南";
    obj.LinkId = "cybsznmore";
    obj.TitleId = "cybszntitle";
    obj.DataId = "cybszndata";
    obj.More = "Notice/CatgNotice/00000000-0000-0300-0500-020000000001";
    obj.Size = size;
    obj.Method = "NotiList";
    obj.Para = "00000000-0000-0000-0300-050000000002";
    obj.PageSize = 8;
    arr[4][1] = obj;


    obj = new Object();
    obj.id = "cyxxcx";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = len;
    obj.Model = "Model1";
    obj.Type = "MenuLong";
    obj.Title = "信息查询";
    obj.LinkId = "cyxxcxmore";
    obj.TitleId = "cbxxcxtitle";
    obj.DataId = "cyxxcxdata";
    obj.More = "";
    obj.Size = size;
    obj.Method = "Menu"
    obj.Para = "00000000-0000-0000-0300-050000000003";
    obj.PageSize = 4;
    arr[4][2] = obj;
    
    obj = new Object();
    obj.id = "cyxxzl";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = len;
    obj.Model = "Model1";
    obj.Type = "NotList";
    obj.Title = "学习资料";
    obj.LinkId = "cyxxzlmore";
    obj.TitleId = "cyxxzltitle";
    obj.DataId = "cyxxzldata";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-050000000004";
    obj.Size = size;
    obj.Method = "NotList"
    obj.Para = "00000000-0000-0000-0300-050000000004";
    obj.PageSize = 5;
    arr[4][3] = obj;
    
   /**************** 公司管理****************************/
    var obj = new Object();
    obj.id = "gstzgg";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = len;
    obj.Model = "Model1";
    obj.Type = "NotList";
    obj.Title = "通知公告";
    obj.LinkId = "gstzggmore";
    obj.TitleId = "gstzggtitle";
    obj.DataId = "gstzggdata";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-060000000001";
    obj.Size = size;
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-060000000001";
    obj.PageSize = 8;
    arr[5][0] = obj;

    obj = new Object();
    obj.id = "gsbszn";
    obj.ModelId = "tabnotice";
    obj.Model = "Model3";
    obj.DataLength = lens;
    obj.Type = "Menu";
    obj.Image = img;
    obj.Title = "办事指南";
    obj.More = "Notice/CatgNotice/00000000-0000-0300-0600-020000000001";
    obj.Size = size;
    obj.LinkId = "gsbsznmore";
    obj.TitleId = "gsbszntitle";
    obj.DataId = "gsbszndata";
    obj.Method = "NotiList";
    obj.PageSize = 7;
    obj.Para = "00000000-0000-0000-0300-060000000002";
    
    arr[5][1] = obj;

    obj = new Object();
    obj.id = "gsshgf";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength =len;
    obj.Model = "Model1";
    obj.Type = "NotFList";
    obj.Title = "审核管理规范";
    obj.LinkId = "gsshgfmore";
    obj.TitleId = "gsshgftitle";
    obj.DataId = "gsshgfdata";
    obj.More = "Notice/NotList/00000000-0000-0300-0600-030000000001";
    obj.Size = size;
    obj.Method = "GetNotice";
    obj.Para ="00000000-0000-0000-0300-060000000003";
    obj.PageSize = 6;
    arr[5][2] = obj;

    /***********船检*********/
    var obj = new Object();
    obj.id = "cjtzgg";
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = len;
    obj.Model = "Model1";
    obj.Type = "NotFList";
    obj.Title = "通知公告";
    obj.More = "Notice/NotList/00000000-0000-0300-0700-030000000002";
    obj.LinkId = "cjtzggmore";
    obj.TitleId = "cjtzggtitle";
    obj.DataId = "cjtzggdata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0300-070000000001";
    obj.PageSize = 8;
    arr[6][0] = obj;

    obj = new Object();
    obj.ModelId = "tabnotice";
    obj.Image = img;
    obj.DataLength = len;
    obj.id = "cjbszn";
    obj.Model = "Model3";
    obj.Type = "Menu";
    obj.Image = img;
    obj.Title = "办事指南";
    obj.More = "Notice/CatgNotice/00000000-0000-0300-0700-020000000001";
    obj.Size = size;
    obj.LinkId = "cjbsznmore";
    obj.TitleId = "cjbszntitle";
    obj.DataId = "cjbszndata";
    obj.Method = "NotiList";
    obj.Para = "00000000-0000-0000-0300-070000000002";
    obj.PageSize = 8;
    arr[6][1] = obj;


    obj = new Object();
    obj.id = "cjycslt";
    obj.ModelId = "tabnotice";
    obj.Model = "Model2";
    obj.DataLength = len;
    obj.Image = img;
    obj.Type = "Menu";
    obj.Title = "船舶检验监督管理";
    obj.More = "";
    obj.LinkId = "cjjsfglmore";
    obj.TitleId = "cjjsfgltitle";
    obj.DataId = "cjjsfgldata";
    obj.Size = size;
    obj.Method = "Link"
    obj.Para = "00000000-0000-0000-0300-070000000008";
    obj.PageSize = 8;
    arr[6][2] = obj;

    obj = new Object();
    obj.id = "cjycslt";
    obj.ModelId = "tabnotice";
    obj.Model = "Model2";
    obj.DataLength = lens;
    obj.Image = img;
    obj.Type = "Menu";
    obj.Title = "其它";
    obj.More = "";
    obj.LinkId = "cjothermore";
    obj.TitleId = "cjothertitle";
    obj.DataId = "cjotherdata";
    obj.Size = size;
    obj.Method = "Link"
    obj.Para = "00000000-0000-0000-0300-070000000010";
    obj.PageSize = 8;
    arr[6][3] = obj;

    return arr;

}
/*****************六小模块信息**********************/
function Getlastarr() {
    var size = 5;
    var lastarr = new Array();
    lastarr[0] = new Array();
    lastarr[1] = new Array();
    lastarr[2] = new Array();


    /* ***************安全管理 ****************/
    var img = "";
    obj = new Object();
    obj.id = "aqgl";
    obj.ModelId = "lastnotice";
    obj.Image = img;
    obj.DataLength = 15;
    obj.Type = "LastNotList";
    obj.Title = "安全管理信息";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-080000000001";
    obj.LinkId = "aqglmore";
    obj.TitleId = "aqgltitle";
    obj.DataId = "aqgldata";
    obj.Size = size;
    obj.Method = "NotiList";
    obj.Para = "00000000-0000-0000-0300-080000000001";
    obj.PageSize = 5;
    lastarr[0][0] = obj;

    obj = new Object();
    obj.id = "aqdxsgal";
    obj.ModelId = "lastnotice";
    obj.Image = img;
    obj.DataLength = 15;
    obj.Type = "LastNotList";
    obj.Title = " 典型案例";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-080000000003";
    obj.LinkId = "aqdxsgalmore";
    obj.TitleId = "aqdxsgaltitle";
    obj.DataId = "aqdxsgaldata";
    obj.Size = size;
    obj.Method = "NotiList";
    obj.Para = "00000000-0000-0000-0300-080000000003";
    obj.PageSize = 5;
    lastarr[0][1] = obj;



    /* 搜救管理 */
    obj = new Object();
    obj.id = "sjgzdt";
    obj.ModelId = "lastnotice";
    obj.Image = img;
    obj.DataLength = 15;
    obj.Type = "LastNotList";
    obj.Title = "通知公告";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-090000000001";
    obj.LinkId = "sjgzdtmore";
    obj.TitleId = "sjgzdttitle";
    obj.DataId = "sjgzdtdata";
    obj.Size = size;
    obj.Method = "NotiList";
    obj.Para = "00000000-0000-0000-0300-090000000001";
    obj.PageSize = 5;
    lastarr[1][0] = obj;
    
    obj = new Object();
    obj.id = "sjgl";
    obj.ModelId = "lastnotice";
    obj.Image = img;
    obj.DataLength = 15;
    obj.Type = "LastNotList";
    obj.Title = "搜寻快报";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-090000000004";
    obj.LinkId = "sjglmore";
    obj.TitleId = "sjgltitle";
    obj.DataId = "sjgldata";
    obj.Size = size;
    obj.Method = "NotiList";
    obj.Para = "00000000-0000-0000-0300-090000000004";
    obj.PageSize = 5;
    lastarr[1][1] = obj;
    
    
    
    


    


    /* 航标测绘 */
    obj = new Object();
    obj.id = "hbceggxx";
    obj.ModelId = "lastnotice";
    obj.Image = img;
    obj.DataLength = 15;
    obj.Type = "LastNotList";
    obj.Title = "公告信息";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-100000000001";
    obj.LinkId = "hbceggxxmore";
    obj.TitleId = "hbceggxxtitle";
    obj.DataId = "hbceggxxdata";
    obj.Size = size;
    obj.Method = "NotiList";
    obj.Para = "00000000-0000-0000-0300-100000000001";
    obj.PageSize = 5;
    lastarr[2][0] = obj;


    obj = new Object();
    obj.id = "hbcehcfg";
    obj.ModelId = "lastnotice";
    obj.Image = img;
    obj.DataLength = 15;
    obj.Type = "LastNotList";
    obj.Title = "航测法规";
    obj.More = "Notice/NotList/00000000-0000-0000-0300-100000000002";
    obj.LinkId = "hbcehcfgmore";
    obj.TitleId = "hbcehcfgtitle";
    obj.DataId = "hbcehcfgdata";
    obj.Size = size;
    obj.Method = "NotiList";
    obj.Para = "00000000-0000-0000-0300-100000000002";
    obj.PageSize = 5;
    lastarr[2][1] = obj;
    
    return lastarr;
   

} 
function NoticeList(obj) {
    this.id = obj.id;
    this.obj =obj;
    $("#" + this.obj.LinkId).empty();
    $("#" + this.obj.LinkId).append("<a href=\"" + _baseUrl + this.obj.More + "\" target=\"_blank\">更多>></a>")

}
NoticeList.prototype.Sucessed = function(result, obj) {
    if (result == "") {
        return false;
    }
    var c = "";
    var data = result;
    //回车前后的空格都替换掉
    if (!String.isNullOrEmpty(data)) {
       var oxmlDom = createXMLDOM(data);
       var tablestr = $("#tabnotice").html();
       $(oxmlDom).find('NoticeId').each(function(i) {

             if (i < obj.PageSize) {
               var showtitle = "";
               var id = $(oxmlDom).find('NoticeId').eq(i).text();
               var title = $(oxmlDom).find('Title').eq(i).text();
               var time = $(oxmlDom).find('SubmitTime').eq(i).text();
               var noticeDelay = $(oxmlDom).find('NoticeDelay').eq(i).text();
               var notTime = $(oxmlDom).find('NoticeNew').eq(i).text();
               var top = isTop(_today, formatXmlDates(notTime), noticeDelay);
               if (top) {
                   showtitle = String.SubStr(title, obj.DataLength - 2) + isTopImg;
               }
               else {
                   showtitle = String.SubStr(title, obj.DataLength);
               }
               var url = _baseUrl + "Notice/Notice/" + id;
               c += String.format(tablestr, url, title, showtitle);
           }
           
        })

    }
    $("#" + obj.DataId).empty();
    $("#" + obj.DataId).append(c);
   
}

NoticeList.prototype.GetNotice = function(result) {
if (noticeStr[this.obj.Para] == "" || noticeStr[this.obj.Para] == "undefined") {
         GetAllNews(this.obj, this);
    }
    else {
        ShowNotice(noticeStr[this.obj.Para],this.obj)
    }
}

NoticeList.prototype.GetZhNotice = function(result) {
if (noticeStr[this.obj.Para] == "" || noticeStr[this.obj.Para] == "undefined") {
        GetZhNoticeList(this.obj, this);
    }
    else {
        ShowNotice(noticeStr[this.obj.Para],this.obj)
    }

}
NoticeList.prototype.GetFNotice = function(result) {
if (noticeStr[this.obj.Para] == "" || noticeStr[this.obj.Para] == "undefined") {
        GetFNoticeList(this.obj, this);
    }
    else {
        ShowNotice(noticeStr[this.obj.Para], this.obj)
    }
}

function GetZhNoticeList(arr, obj) {
    if (!String.isNullOrEmpty(obj)) {
       $.ajax({
            type: "Post",
            url: _baseUrl + "Notice/GetZhNotList",
            data: { "resourceId": arr.Para, "pageSize": 8 },
            dataType: "json",
            success: function(result) {
            obj.Sucessed(result, arr);
        },
        error: Failed

    })
    }
}
function GetFNoticeList(arr, obj) {
    if (!String.isNullOrEmpty(obj)) {
        $.ajax({
            type: "Post",
            url: _baseUrl + "Notice/GetFNotList",
            data: { "resourceId": arr.Para, "pageSize": 8 },
            dataType: "json",
            success: function(result) {
            obj.Sucessed(result, arr);
        },
            error: Failed

        })
    }
}
function Sucesseds(result) {
    alert("获取信息成功");
}
function Failed(result) {
    //alert("获取信息失败");
}

function Link(obj) {
    this.id = obj.id;
    this.obj = obj;
    this.str = " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" style=\"background-image: url(" + _baseUrl + "Images/Public/tonghang_left.jpg)\">"
           + "<tr><td  style=\"width:15px;  height:33px; background-image: url(" + _baseUrl + "Images/Public/tonghang_left.jpg)\"></td>"
           + "<td    style=\"width:15px;  height:33px ;background-image: url(" + _baseUrl + "Images/Public/tonghang_bg.jpg)\"><img src=\"" + _baseUrl + "Images/Public/dian1.jpg\" /></td>"
           + "<td style=\"width:255px ; height:33px \" class=\"thTitle\">" + obj.Title + "</td>"
           + "<td style=\"width:60px\"   class=\"thMore\"><a href=\""+_baseUrl   + obj.More + "\">更多>></a></td>"
           + "<td style=\"width:15px;background-image: url("+_baseUrl +"Images/Public/tonghang_right.jpg)\"></td>"
           + "</tr> </table>"
           + " <table style=\"width:350px; heigth:auto\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"  style=\"background-color:#ecf6f7\"><tr><td>"
           + "<a href=\"" + this.obj.Para + "\">此模块是连接到其它网站</a></td></tr></table>";

}



Link.prototype.GetLink = function() {
   $("#" + this.obj.id).empty();
   $("#" + this.obj.id).append(this.str);
   
}






/** 获取资源列表信息   ** ** ** ** ** ** ** ** ** ** ** **/
function Menu(obj) {
    this.obj = obj;

    if (!String.isNullOrEmpty(this.obj.More)) {
        $("#" + this.obj.LinkId).empty();
        $("#" + this.obj.LinkId).append("<a href=\"" + _baseUrl + this.obj.More + "\" target=\"_blank\">更多>></a>");
    }  
}

Menu.prototype.GetHeadSus = function(result) {
    menuresult = result;
    this.str = "";
    var m = "";
    if (!String.isNullOrEmpty(result)) {
        var t = 1;
        var res = eval('(' + result + ')');
        if (!String.isNullOrEmpty(res)) {
            //分成一列显示
            for (var i = 0; i < res.length; i++) {
                if (res[i].ParentId == this.obj.Para) {
                    var url = GetUrl(_baseUrl, res[i].Uri);
                    m = "<tr  align=\"center\">"
                      + "<td align=\"left\"  width=\"70%\"  class=\"bszn_bg\"><a href=\"" + url + "\" title=\"" + res[i].Name + "\"   target=\"_blank\">" + String.SubStr(res[i].Name, this.obj.DataLength - 5)
                      + "</tr>"
                    this.str = this.str + m;
                    t++;
                    if (t > this.obj.PageSize) {
                        break;
                    }
                }
            }
        }
        else {
            this.str + "<tr><td>暂时没有信息</td></tr>"
        }

    }
    else {
        this.str + "<tr><td>暂时没有信息</td></tr>"
    }
    $("#" + this.obj.DataId).empty();
    $("#" + this.obj.DataId).append(this.str);



}

Menu.prototype.GetMenu = function() {
    GetMenus(this);
}
function GetMenus(obj) {
    if (!String.isNullOrEmpty(obj)) {
    if (menuresult == "") {
        $.ajax({
            type: "Post",
            url: _baseUrl + "Menu/GetHeadList/",
            dataType: "json",
            success: function(result) {
                obj.GetHeadSus(result);
                  },
            error: GetHeadFal
        })
    } else {
        obj.GetHeadSus(menuresult);
    }

    }
}
function GetHeadFal() {
   // alert("获取信息失败");
}

/****新闻**************/

function Getnews() {

    
    var obj = new Object();
    obj.id = "txtnews";
    obj.DataLength = 26;
    obj.Type = "TxtNews";
    obj.Title = "海事新闻";
    obj.More = "Notice/NotList/00000000-0000-0000-1100-010000000001";
    obj.LinkId = "txtmore";
    obj.TitleId = "txttitle";
    obj.DataId = "txtdata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.PageSize = 8;
    obj.KeyFst="";
    obj.Para = "00000000-0000-0000-1100-010000000001";

    return obj;
     
}
function GetzshsInfo() {
   var obj = new Object();
    obj.id = "zshsnews";
    obj.DataLength = 40;
    obj.Type = "TxtNews";
    obj.Title = "直属海事";
    obj.More = "Notice/NotList/00000000-0000-0000-1100-010000000001";
    obj.LinkId = "zshsnewsmore";
    obj.TitleId = "zshsnewstitle";
    obj.DataId = "zshsnewsdata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.PageSize = 8;
    obj.KeyFst=1;
    obj.Para = "00000000-0000-0000-1100-010000000001";
return obj;
}
function GetdfhsInfo() {

    var size = 5;
    var obj = new Object();
    obj.id = "dfhsnews";
    obj.DataLength = 40;
    obj.Type = "TxtNews";
    obj.Title = "地方海事";
    obj.More = "Notice/NotList/00000000-0000-0000-1100-010000000001";
    obj.LinkId = "dfhsmore";
    obj.TitleId = "dfhstitle";
    obj.DataId = "dfhsdata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.PageSize = 8;
    obj.KeyFst=2;
    obj.Para = "00000000-0000-0000-1100-010000000001";

     return obj;
}




/***********专题栏目************/

function GetSndList(n, m) {
    var ts = new SndList(lastarr[n][m]);
    ts.GetSndLists();

}

function SndList(obj) {
    this.obj = obj;
    this.str = "";
    $("#" + this.obj.LinkId).empty();
    $("#" + this.obj.LinkId).append("<a href=\"" + _baseUrl + this.obj.More + "\" target=\"_blank\">更多>></a>")
}
SndList.prototype.Sucessed = function(result, obj) {
    if (result == "") {
        return false;
    }
    var c = "";
    var data = result;
    //回车前后的空格都替换掉
    if (!String.isNullOrEmpty(data)) {
        var oxmlDom = createXMLDOM(data);
        var tablestr = $("#lastnotice").html();
        var pub = 0;
        $(oxmlDom).find('NoticeId').each(function(i) {
        if (i < obj.PageSize) {
            var showtitle = "";
            var id = $(oxmlDom).find('NoticeId').eq(i).text();
            var title = $(oxmlDom).find('Title').eq(i).text();
            var time = $(oxmlDom).find('SubmitTime').eq(i).text();
            var noticeDelay = $(oxmlDom).find('NoticeDelay').eq(i).text();
            var notTime = $(oxmlDom).find('NoticeNew').eq(i).text();
            var top = isTop(_today, formatXmlDates(notTime), noticeDelay);
            if (top) {
                showtitle = String.SubStr(title, obj.DataLength - 2) + isTopImg;
            }
            else {
                showtitle = String.SubStr(title, obj.DataLength);
            }
            var url = _baseUrl + "Notice/Notice/" + id;
            c += String.format(tablestr, url, title, showtitle);
        }
        })

    }
    $("#" + obj.DataId).empty();
    $("#" + obj.DataId).append(c);

}

SndList.prototype.GetSndLists = function() {
if (noticeStr[this.obj.Para] == "" || noticeStr[this.obj.Para] == "undefined") {
        GetAllNews(this.obj, this);
    }
    else {
        ShowNotice(noticeStr[this.obj.Para],this.obj)
    }
    
}

/* 切换政务服务六大模块*/
var sign = null;
function changeBg(obj, n) {
    document.getElementById("node1").className = "past";
    if (sign != null) {
        sign.className = "past";
        sign = null;
    }
    obj.className = "now";
    sign = obj;
    var showdiv = document.getElementById("tablist").getElementsByTagName("div");
    for (i = 0; i < showdiv.length; i++) {
        showdiv[i].style.display = (i == n ? "block" : "none");
    }
    Tab(n);
}

//安全管理
function change(obj, n) {
    var actObj = obj.parentNode.id;
    obj.parentNode.firstChild.className = "aq_normal";
    var actSign = obj.parentNode.activeId;
    if (actSign != null) {
        document.getElementById(actSign).className = "aq_normal";

        obj.parentNode.activeId = null;
    }
    obj.className = "aq_active";
    obj.parentNode.activeId = obj.id;


    var showdiv = document.getElementById(actObj + "Div").getElementsByTagName("table");

    for (i = 0; i < showdiv.length; i++) {
        if (i == n) {
            showdiv[i].style.display = "block";


        }
        else {
            showdiv[i].style.display = "none";
        }

    }
}

/*********专题栏目*************/
function GetZtlmArr() {
    var obj = new Object();
    obj.id = "ztlm";
    obj.Image = img;
    obj.DataLength = 15;
    obj.Model = "Model1";
    obj.Type = "Ztlm";
    obj.Title = "专题栏目";
    obj.More = "Notice/NotList/00000000-0000-0000-1200-010000000013";
    obj.Size = size;
    obj.LinkId = "ztlmmore";
    obj.TitleId = "ztlmtitle";
    obj.DataId = "ztlmdata";
    obj.Method = "NotList";
    obj.Para = "00000000-0000-0000-0000-120000000001";
    obj.PageSize = 8;
    return obj;
}


function Ztlm() {
    var obj = GetZtlmArr();
    this.obj = obj;
    $("#" + this.obj.LinkId).empty();
    $("#" + this.obj.LinkId).append("<a href=\"" + _baseUrl + this.obj.More + "\" target=\"_blank\">更多>></a>");
}

Ztlm.prototype.GetHeadSus = function(result) {
    menuresult = result;
    this.str = "";
    var m = "";
    if (!String.isNullOrEmpty(result)) {
        var t = 1;
        var res = eval('(' + result + ')');
        if (!String.isNullOrEmpty(res)) {
            for (var i = 0; i < res.length; i++) {
                if (res[i].ParentId == this.obj.Para) {
                    if (t > 5) {
                        break;
                    }
                    var url = GetUrl(_baseUrl, res[i].Uri);
                    m = "<tr  align=\"center\"><td><img src=\"" + _baseUrl + "Images/Public/dian5.jpg\" /></td>"
                      + "<td align=\"left\"  width=\"95%\" ><a href=\"" + url + " \" title=\"" + res[i].Name + "\"  target=\"_blank\">" + String.SubStr(res[i].Name, this.obj.DataLength)
                      + "</tr>";
                    this.str = this.str + m;
                    t += 1;

                }
            }

        }
        else {
            this.str + "<tr><td>暂时没有信息</td></tr>"
        }
    }
    else {
        this.str + "<tr><td>暂时没有信息</td></tr>"
    }
    $("#" + this.obj.DataId).empty();
    $("#" + this.obj.DataId).append(this.str);



}

Ztlm.prototype.GetZtlm = function() {
    GetZtlms(this);
}
function GetZtlms(obj) {
    if (!String.isNullOrEmpty(obj)) {
        if (menuresult == "") {
            $.ajax({
                type: "Post",
                url: _baseUrl + "Menu/GetHeadList/",
                dataType: "json",
                success: function(result) {obj.GetHeadSus(result);},
                error: GetHeadFal
            })
        } else {
        obj.GetHeadSus(menuresult);
        }

    }
}


/*直属海事 地方海事*/

/****新闻**************/

function Getnews() {
var obj = new Object();
    obj.id = "txtnews";
    obj.ModelId = "txtnews";
    obj.DataLength = 26;
    obj.Type = "TxtNews";
    obj.Title = "海事新闻";
    obj.More = "Notice/NotList/00000000-0000-0000-1100-010000000001";
    obj.LinkId = "txtmore";
    obj.TitleId = "txttitle";
    obj.DataId = "txtdata";
    obj.Size = size;
    obj.Method = "NotFList";
    obj.PageSize = 8;
    obj.KeyFst = "";
    obj.Para = "00000000-0000-0000-0000-110000000001";

    return obj;

}
function GetzshsInfo() {
    var obj = new Object();
    obj.id = "zshsnews";
    obj.ModelId = "zshsnews";
    obj.DataLength = 25;
    obj.Type = "TxtNews";
    obj.Title = "直属海事";
    obj.More = "Notice/NotList/00000000-0000-0000-1100-010000000002";
    obj.LinkId = "zshsnewsmore";
    obj.TitleId = "zshsnewstitle";
    obj.DataId = "zshsnewsdata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.PageSize = 8;
    obj.KeyFst = "";
    obj.Para = "00000000-0000-0000-1100-010000000002";
    return obj;
}
function GetdfhsInfo() {

    var size = 5;
    var obj = new Object();
    obj.id = "dfhsnews";
    obj.ModelId = "dfhsnews";
    obj.DataLength = 25;
    obj.Type = "TxtNews";
    obj.Title = "地方海事";
    obj.More = "Notice/NotList/00000000-0000-0000-1100-010000000003";
    obj.LinkId = "dfhsmore";
    obj.TitleId = "dfhstitle";
    obj.DataId = "dfhsdata";
    obj.Size = size;
    obj.Method = "NotList";
    obj.PageSize = 8;
    obj.KeyFst = "";
    obj.Para = "00000000-0000-0000-1100-010000000003";

    return obj;
}

function AllNews() {
    this.arrs = new Array();
    var newsObj = Getnews();
    var zshsObj = GetzshsInfo();
    var zfhsObj = GetdfhsInfo();
    this.arrs[0] = newsObj;
    this.arrs[1] = zshsObj;
    this.arrs[2] = zfhsObj;
}
AllNews.prototype.Sucessed = function(result, obj) {
    if (result == "") {
        return false;
    }
    var c = "";
    var data = result;
    //回车前后的空格都替换掉
    if (!String.isNullOrEmpty(data)) {
        var oxmlDom = createXMLDOM(data);
        var c = "";
        var tablestr = $("#" + obj.id).find("tr:eq(0)").html();
        tablestr = "<tr>" + tablestr + "</tr>";
        $(oxmlDom).find('NoticeId').each(function(i) {
            if (i < obj.PageSize) {
                var showtitle = "";
                var id = $(oxmlDom).find('NoticeId').eq(i).text();
                var title = $(oxmlDom).find('Title').eq(i).text();
                var time = $(oxmlDom).find('SubmitTime').eq(i).text();
                var noticeDelay = $(oxmlDom).find('NoticeDelay').eq(i).text();
                var notTime = $(oxmlDom).find('NoticeNew').eq(i).text();
                var top = isTop(_today, formatXmlDates(notTime), noticeDelay);
                if (top) {
                    showtitle = String.SubStr(title, obj.DataLength - 2) + isTopImg;
                }
                else {
                    showtitle = String.SubStr(title, obj.DataLength) ;
                }
                var url = _baseUrl + "Notice/Notice/" + id;
                c += String.format(tablestr, url, title,showtitle, formatXmlDates(time));
            }
        })
        $("#" + obj.id).find("option:gt(1)").remove();
        $("#" + obj.id).append(c);
    }


}
AllNews.prototype.GetNews = function(result) {
if (noticeStr[this.arrs[result].Para] == "" || noticeStr[this.arrs[result].Para] == "undefined") {
        
        GetAllNews(this.arrs[result], this);
    }
    else {
        ShowNew(noticeStr[this.arrs[result].Para], this.arrs[result])
    }
}
AllNews.prototype.GetFNews = function(result) {
if (noticeStr[this.arrs[result].Para] == "" || noticeStr[this.arrs[result].Para] == "undefined")
    {
        GetFNoticeList(this.arrs[result], this);
    }
    else
    {
        ShowNew(noticeStr[this.arrs[result].Para], this.arrs[result])
    }
}
function GetAllNews(arr,obj) {
    if (!String.isNullOrEmpty(obj)) {
        $.ajax({
            type: "Post",
            url: _baseUrl + "Notice/GetHomeNotice",
            data: { "resourceId": arr.Para, "pageSize": 10 },
            dataType: "json",
            success: function(result) {obj.Sucessed(result, arr);} 
        });
    }
}

//从后台获取首页第一屏显示的信息
function GetFstSrnShow() {
    $.ajax({
        type: "Post",
        url: _baseUrl + "Notice/GetFstSrnShow",
        dataType: "json",
        success: function(result) {
           noticeStr = result;
            //加载首屏新闻
            //加载首屏新闻
            var news = new AllNews();
            //news.GetFNews(0);
            //加载第一个六大模块信息
            arr = Getarr();
            //Tab(0);
            lastarr = Getlastarr();
            GetAllMenus();
           
            //获取下面六小块第一屏信息
            GetSndList(0, 0);
            GetSndList(1, 0);
            GetSndList(2, 0);

            //加载第一个个flash
           
           
            //获取已登录的用户名
            GetUserInfo();
            news.GetNews(1);
            news.GetNews(2);
            GetHomeFlashInfo(1);
            GetHomeFlashInfo(2);
            loadPhotos("photoList_container", "photoList_template");
            loadVideos("videoList_container", "videoList_template");
            GetSndList(0, 1);
            GetSndList(1, 1);
            GetSndList(2, 1);
            
            //*/
        }
    });
       
}
function ShowNew(result, obj) {
    if (result == "") {
        return false;
    }
    var c = "";
    var data = result;
    //回车前后的空格都替换掉
    if (!String.isNullOrEmpty(data)) {
        var oxmlDom = createXMLDOM(data);
        var c = "";
        var tablestr = $("#" + obj.ModelId).find("tr:eq(0)").html();
        tablestr = "<tr>" + tablestr + "</tr>";
        $(oxmlDom).find('NoticeId').each(function(i) {
            if (i < obj.PageSize) {
                var showtitle = "";
                var id = $(oxmlDom).find('NoticeId').eq(i).text();
                var title = $(oxmlDom).find('Title').eq(i).text();
                var time = $(oxmlDom).find('SubmitTime').eq(i).text();
                var noticeDelay = $(oxmlDom).find('NoticeDelay').eq(i).text();
                var notTime = $(oxmlDom).find('NoticeNew').eq(i).text();
                var top = isTop(_today, formatXmlDates(notTime), noticeDelay);
                if (top) {
                    showtitle = String.SubStr(title, obj.DataLength - 2) + isTopImg;
                }
                else {
                    showtitle = String.SubStr(title, obj.DataLength);
                }
                var url = _baseUrl + "Notice/Notice/" + id;
                c += String.format(tablestr, url, title, showtitle, formatXmlDates(time));
            }
        })
        $("#" + obj.id).find("option:gt(1)").remove();
        $("#" + obj.id).append(c);
    }
    
}

function ShowNotice(result, obj) {
    if (result == "") {
        return false;
    }
    var c = "";
    var data = result;
    //回车前后的空格都替换掉
    if (!String.isNullOrEmpty(data)) {
        var oxmlDom = createXMLDOM(data);
        var tablestr = $("#" + obj.ModelId).html();;
        $(oxmlDom).find('NoticeId').each(function(i) {
            if (i < obj.PageSize) {
                var showtitle = "";
                var id = $(oxmlDom).find('NoticeId').eq(i).text();
                var title = $(oxmlDom).find('Title').eq(i).text();
                var time = $(oxmlDom).find('SubmitTime').eq(i).text();
                var noticeDelay = $(oxmlDom).find('NoticeDelay').eq(i).text();
                var notTime = $(oxmlDom).find('NoticeNew').eq(i).text();
                var top = isTop(_today, formatXmlDates(notTime), noticeDelay);
                if (top) {
                    showtitle = String.SubStr(title, obj.DataLength - 2) + isTopImg;
                }
                else {
                    showtitle = String.SubStr(title, obj.DataLength);
                }
                var url = _baseUrl + "Notice/Notice/" + id;
                c += String.format(tablestr, url, title, showtitle);
            }

        })

    }
    $("#" + obj.DataId).empty();
    $("#" + obj.DataId).append(c);
    
}
function GetAllMenus() {
   if (menuresult == "") {
        $.ajax({
            type: "Post",
            url: _baseUrl + "Menu/GetHeadList/",
            dataType: "json",
            success: function(result) {
            menuresult = result;
            //显示专题栏目
            var t = new Ztlm();
            t.GetZtlm();
            Tab(1);
            Tab(2);
            Tab(3);
            Tab(4);
            Tab(5);
            Tab(6);
            },
            error: GetHeadFal
        })
    }


}

function GoToEmail() {
    window.open(_baseUrl + "Message/LeaveMsg");
    return false;
}

function openSelect(f) {
    if (f.options[f.selectedIndex].value != "") {
        url = f.options[f.selectedIndex].value
        window.open(url)
        return true;
    }
}


function Login() {
    if (document.getElementById("ddlx").options(document.getElementById("ddlx").selectedIndex).value == "email") {
        document.getElementById("Form1").action = "http://mail.msa.gov.cn/main/main.py";
        document.getElementById("Form1").submit();
        return false;
    }
    if (document.getElementById("ddlx").options(document.getElementById("ddlx").selectedIndex).value == "sb") {
        document.getElementById("txtUser").value = document.getElementById("username").value;
        document.getElementById("txtPass").value = document.getElementById("password").value;
         document.getElementById("Form1").action = "http://www.msa.gov.cn:8090/login/FormLogin.aspx";
        document.getElementById("Form1").__EVENTTARGET.value = "ImageButton1";
        document.getElementById("Form1").__EVENTARGUMENT.value = null;
        document.getElementById("Form1").submit();
        return false;
    }
    var loginName = document.getElementById("username");
    if (String.isNullOrEmpty(loginName.value)) {
        alert("请输入用户名");
        $("#username")[0].focus();
        return false;
    }
    var password = document.getElementById("password");
    if (String.isNullOrEmpty(password.value)) {
        alert("请输入密码");
        $("#password")[0].focus();
        return false;
    }
    if (password.value.length >= 15 || password.value.length < 3) {
        alert("请输入4-15位密码");
        password.focus();
        return false;
    }
    var authcode = document.getElementById("authcode").value;
    if (String.isNullOrEmpty(authcode)) {
        alert("请输入验证码");
        $("#authcode")[0].focus();
        return false;
    }
    if (authcode.length != 4) {
        alert("验证码错误");
        $("#authcode")[0].focus();
        return false;
    }

    $.ajax({
        type: "Post",
        url: _baseUrl + "Login/LoginOn/",
        data: { "loginName": loginName.value, "password": password.value, "authcode": authcode },
        success: LoginSucessed,
        error: LoginFailed
    })

}
function SignOut() {
    $.ajax({
        type: "Post",
        url: _baseUrl + "Login/SignOut",
        success: SignOutSucesseds,
        error: function() { alert("退出失败，请与管理员联系"); }
    })

}
function SignOutSucesseds(result) {
    Refresh();
}
///登陆成功刷新页面
function LoginSucessed(result) {
    if (!String.isNullOrEmpty(result)) {
        if (result == 1) {
            alert("验证码错误");
            document.getElementById("password").value = "";
            document.getElementById("authcode").value = "";
            return false;
        }

        OnManager();
    }
    else {

        document.getElementById("password").value = "";
        alert("用户名或密码错误");
    }
}
function Refresh() {
    window.location.reload();
    return true;
}
function LoginFailed(result) {
    alert("用户名或密码错误");
    document.getElementById("username").value = "";
    document.getElementById("password").value = "";
    return true;

}
function GetUserInfo() {
    $.ajax({
        type: "Post",
        url: _baseUrl + "Login/IsAuth",
        dataType: "json",
        success: Sucess
    })
    return true;
}
function Sucess(result) {
    if (result == null || typeof (result) == "undefined" || result == "") {
        document.getElementById("loginsucess").style.display = "none";
        document.getElementById("unlogin").style.display = "block";
    }
    else {
        document.getElementById("unlogin").style.display = "none";
        document.getElementById("loginsucess").style.display = "block";
        $("#lusername").text(result.ShortName);
        $("#lunits").text(result.UnitsName);

    }
    return true;
}

//政务服务切换

//新闻切换
function overBg(obj) {
    var tab = document.getElementById(obj.parentNode.attributes["activeId"].value);
    var content = document.getElementById(obj.parentNode.attributes["activeId"].value + "_content");
    var link = document.getElementById(obj.parentNode.attributes["activeId"].value + "_link");
    if (tab != null) {
        tab.className = "newsUp";
    }
    if (content != null) {
        content.className = "newTablist";
    }
    if (link != null) {
        link.style.display = "none";
    }
    obj.parentNode.attributes["activeId"].value = obj.id;
    obj.className = "newsDown";
    content = document.getElementById(obj.id + "_content");
    if (content != null) {
        content.className = "newTablist show";
    }
    link = document.getElementById(obj.id + "_link");
    if (link != null) {
        link.style.display = "";
    }
}

var pics;
var mylinks;
var texts;

/*******************获得首页Flash信息**********************/
function GetHomeFlashInfo(id) {
    var nid = GetId(id);
    $.ajax({
        type: "Post",
        url: _baseUrl + "Notice/GetFlashInfo/",
        data: { "pageSize": 5, "Id": nid, "Type": 1 },
        dataType: "json",
        success: function GetFlashInfoSuccess(result) {
            pics = ConvertToFlashInfo(String.GetNullValue(result[0]));
            mylinks = ConvertToFlashInfo(String.GetNullValue(result[1]));
            texts = String.GetNullValue(result[2]);
            var Flash2 = new Flash(_baseUrl + "Flash/news.swf", "pic" + id, "277", "212", "8", "#ffffff");
            Flash2.addParam("quality", "medium");
            Flash2.addParam("wmode", "opaque");
            Flash2.addVariable("speed", speed);
            Flash2.addVariable("p", pics);
            Flash2.addVariable("l", mylinks);
            Flash2.addVariable("icon", texts);
            Flash2.write("pic" + id);
        }
    })
}
function GetId(id) {
    switch (id) {
        case 0: return id = '00000000-0000-0000-0000-110000000001';
        case 1: return id = '00000000-0000-0000-1100-010000000002';
        case 2: return id = '00000000-0000-0000-1100-010000000003';
        default: return id = '00000000-0000-0000-0000-110000000001';
    }

}


function ConvertToFlashInfo(value) {
    var str = "";
    var valueSplit = value.split("$");
    for (var i = 0; i < valueSplit.length; i++) {
        if (valueSplit[i] != "") {
            str += _baseUrl + valueSplit[i] + "|";
        }
    }
    if (str.length > 0) {
        str = str.substring(0, str.length - 1);
    }
    return str;
}




function loadPhotos(containerId, templateId) {
    $.post(_baseUrl + "PhotoCatalog", { pageSize: 6, pageNumber: 1 }, function(data) {
        var c = "";
        var t = $("#" + templateId)[0].innerHTML;
        for (var i = 0; i < data.Result.length; i++) {
            var item = data.Result[i];
            c += String.format(t, item.PhotoCatalogId.Value, item.CoverFile.Value, item.Title.Value);
        }
        $("#" + containerId).html(c);
    }, "json");
}

function loadVideos(containerId, templateId) {
    $.post(_baseUrl + "VideoCatalog", { pageSize: 4, pageNumber: 1 }, function(data) {
        var c = "";
        var t = $("#" + templateId)[0].innerHTML;
        for (var i = 0; i < data.Result.length; i++) {
            var item = data.Result[i];
            c += String.format(t, item.VideoCatalogId.Value, item.CoverFile.Value, item.Title.Value);
        }
        $("#" + containerId).html(c);
    }, "json");
}

function OnManager() {
    window.location.href = _baseUrl + "Admin/Admin/00000000-0000-0000-0000-000000000001";
}

function GetAuthCode() {
    var rand = Math.ceil(Math.random() * 100);
    $("#codeImg").attr("src", _baseUrl + "AuthCode/Index?id=" + rand);
}


