﻿function ShowBulletinIndex(sIndex){
    if (sIndex=='1') {
        var sTemp = '<span class="red01">(置顶)</span>'
        document.write(sTemp);
    }
}
function GetBulletinType(sStatus){
    var sTemp = '';
    switch(sStatus){
        case '1':
        case '40':
            sTemp = '<span class="os11">首页公告</span>';break;
        case '10':
	    case '11':sTemp = '<span class="os90">登录公告</span>';break;
        case '20':sTemp = '<span class="os14">弹出公告</span>';break;
        case '30':sTemp = '<span class="os20">滚动公告</span>';break;
        default:sTempL = 'UNKNOW';break;
    }
    document.write(sTemp);
}
function preView(code)
{
   window.open("/Bulletin/"+code+".htm","公告预览","height=500, width=900, top=0, left=0, menubar=no, resizable=no,location=no, status=no");
}
/*
 *	输出首页公告
 */
function ShowHomeBulletin(nShowCount){
    if (typeof(BulletinHomeDataArr)=='undefined'||BulletinHomeDataArr==null) return;
    try
    {
     ShowBulletin(nShowCount,BulletinHomeDataArr);
    }
    catch(e)
    {
     
    }
}
/*
 *	输出登录公告
 */
function ShowLoginBulletin(nShowCount){
    if (typeof(BulletinDataArr)=="undefined"||BulletinDataArr==null) return;
     ShowBulletin(nShowCount,BulletinDataArr);
}

function ShowBulletin(nShowCount,pDataArr){
    if (pDataArr==null)return;
    var sTemp = '<table style="width:100%" border="0" cellpadding="0" cellspacing="0"  >';
    var nCount = pDataArr.length;
    if (nCount>nShowCount) nCount = nShowCount;
    else nCount = pDataArr.length;
    
    for(var n=0;n<nCount;n++){
        sTemp += '<tr><td><img src="/images/ico/point_blue.gif" />&nbsp;';
        sTemp += '<a href="/Bulletin/'+pDataArr[n][0]+'.htm" target="_blank">'+pDataArr[n][1]+'</a>';
        sTemp += GetNewImg(pDataArr[n][2]); 
        sTemp += '</td><td style="width:112px;text-align:right" >'+pDataArr[n][2]+'</td>';
        sTemp += '</tr><tr><td colspan="2" style="background-image:url(\'/Images/Line/Line004.jpg\');height:2px"></td></tr>';
    }
    if (pDataArr.length > nShowCount)
        sTemp += '<tr><td colspan="2" style="text-align:right"><a href="/WebPage/MainPage/MoreBulletinList.aspx">更多...</a></td></tr>';
    sTemp += '</table>';
    document.write(sTemp);
}

function Verification(){
        var title=document.getElementById("title");
        if(title.value.isEmpty){
            alert("标题不能为空");
            title.focus();
            return false;
        }
        var editorContent = document.getElementById('CE_AddBulletinPage1_Editor1_ID').getHTML()
        if(editorContent.value.isEmpty)
        {
            alert("内容不能为空");
            return false;
        }
        return true;
}
function ToSub(){
	if(Verification())
        	document.forms[0].submit();
}
   
function WriteBulletinFooter(){
    var sTemp = '1234567890';
    document.write(sTemp);
}
function  InitAnouncement(taregetArea,taregetType,title,coding)
{
     document.getElementById("_Coding").value=coding;
     document.getElementById("btnInsert").disabled=true;
     document.getElementById("title").value=title;
     var select_area=document.getElementById("ReleaseArea");
     var select_type=document.getElementById("AnType");
     if(select_area!=null&&select_area.options!=undefined)
     {
         for(var i=0;i<select_area.options.length;i++){
           if(select_area.options[i].value==taregetArea){
             select_area.options[i].selected=true;
             break;
           }
         }
     }
     if(select_type!=null&&select_type.options!=undefined)
     {
         for(var i=0;i<select_type.options.length;i++){
           if(select_type.options[i].value==taregetType){
             select_type.options[i].selected=true;
             break;
           }
         }
     }
   }
