﻿function ConfirmAddLang()
{
   if(document.cookie.indexOf("zh-CN")>=0)
   return confirm("是否要新增?");
   else
   if(document.cookie.indexOf("en-us")>=0)
   return confirm("Are you Sure to Add?");
   else
   return confirm("是否要新增?");
}

function EditAdmins()
{
   if(document.cookie.indexOf("zh-CN")>=0)
   return "版块阅读权限已经变更,请重新设置管理员";
   else
   if(document.cookie.indexOf("en-us")>=0)
   return "reset the administrator";
   else
   return "版塊閱讀權限已經變更,請重新設置管理員";
}

function ConfirmBoardSort()
{
  if(document.cookie.indexOf("zh-CN")>=0)
   return confirm("是否要排序?");
   else
   if(document.cookie.indexOf("en-us")>=0)
   return confirm("Are you Sure to Sort?");
   else
   return confirm("是否要排序?");
}

function IsSelect(select)
{
  if(document.cookie.indexOf("zh-CN")>=0)
  {
   if(select=="请选择")
   return true;
   }
   else
   if(document.cookie.indexOf("en-us")>=0)
   {
   if(select=="Please Select")
   return true;
   }
   else
   {
    if(select=="請選擇")
   return true;
   }
   return false;
}

function ConfirmModLang()
{
   if(document.cookie.indexOf("zh-CN")>=0)
   return confirm("是否要修改?");
   else
   if(document.cookie.indexOf("en-us")>=0)
   return confirm("Are you Sure to Modify?");
   else
   return confirm("是否要修改?");
}

function ConfirmNotReselesLang()
{
  if(document.cookie.indexOf("zh-CN")>=0)
   return confirm("是否要撤销发布?");
   else
   if(document.cookie.indexOf("en-us")>=0)
   return confirm("Do you want to remove released?");
   else
   return confirm("是否要撤銷發佈?");
}

function ConfirmDeleteLang()
{
   if(document.cookie.indexOf("zh-CN")>=0)
   return confirm("是否要删除?");
   else
   if(document.cookie.indexOf("en-us")>=0)
   return confirm("Are you Sure to Delete?");
   else
   return confirm("是否要刪除?");
}

function ConfirmEmptyLang()
{
   if(document.cookie.indexOf("zh-CN")>=0)
   return confirm("是否要清空?");
   else
   if(document.cookie.indexOf("en-us")>=0)
   return confirm("Are you Sure to Empty?");
   else
   return confirm("是否要清空?");
}

function AlertNotnullLang()
{
   if(document.cookie.indexOf("zh-CN")>=0)
   alert("带*号的不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Textbox with * can not be null!");
   else
   alert("帶*號的不能爲空!");
}

function AlertContentNotnull()
{
   if(document.cookie.indexOf("zh-CN")>=0)
   alert("三个版本的内容都不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Three versions of the content can not be empty!");
   else
   alert("三個版本的內容都不能為空!");
}

function AlertHaveSelect()
{
   if(document.cookie.indexOf("zh-CN")>=0)
   alert("年刊名称，主刊名称，部门类别都得选择!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Annual name, the Lord s name, department category had to choose!");
   else
   alert("年刊名稱，主刊名稱，部門類別都得選擇!");
}

function AlertBoardNameCHT()
{
if(document.cookie.indexOf("zh-CN")>=0)
   alert("版块名称(繁体)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("CHT can not be empty!");
   else
   alert("版塊名稱(繁體)不能為空!");
}

function AlertBoardNameCHS()
{
if(document.cookie.indexOf("zh-CN")>=0)
   alert("版块名称(简体)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("CHS can not be empty!");
   else
   alert("版塊名稱(簡體)不能為空!");
}

function AlertBoardNameENG()
{
if(document.cookie.indexOf("zh-CN")>=0)
   alert("版块名称(英文)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("ENG can not be empty!");
   else
   alert("版塊名稱(英文)不能為空!");
}
 
function ConfirmBoardHaveChild()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   return confirm("目前版块有子版块,确定要修改吗?");
   else
   if(document.cookie.indexOf("en-us")>=0)
   return confirm("Currently there are sub-Forum Forum, you sure you want to modify?");
   else
   return confirm("目前版塊有子版塊,確定要修改嗎?");
}

function  AlertBoardUp()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("已经是第一项了,无法再向上移动!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Already is the first, and can not move up!");
   else
   alert("已經是第一項,無法再向上移動!");
}

function  AlertBoardDown()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("已经是最后一项了,无法再向下移动!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Is the last one, can not move down!");
   else
   alert("已經是最後一項,無法再向下移動!");
}

function AlertBBSSystemManagetxtBBSBulletinCHT()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("论坛公告(繁体)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Forum Notice CHT can not be empty!");
   else
   alert("論壇公告(繁體)不能為空!");
}

function AlertBBSSystemManagetxtBBSBulletinCHS()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("论坛公告(简体)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Forum Notice CHS can not be empty!");
   else
   alert("論壇公告(簡體)不能為空!");
}

function AlertBBSSystemManagetxtBBSBulletinENG()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("论坛公告(英文)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Forum Notice ENG can not be empty!");
   else
   alert("論壇公告(英文)不能為空!");
}

function AlertBBSSystemManagetxtPopHot()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("最低人气不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("The lowest popularity can not be empty!");
   else
   alert("最低人氣不能為空!");
}

function AlertBBSSystemManagetxtPostTime()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("发帖间隔时间不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Posted interval can not be empty!");
   else
   alert("發帖間隔時間不能為空!");
}

function AlertBBSSystemManagetxtPostPoints()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("发帖增加积分不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Posted increased integration can not be empty!");
   else
   alert("發帖增加積分不能為空!");
}

function AlertBBSSystemManagetxtReplyPoints()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("回帖增加积分不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Replies to increase integration can not be empty!");
   else
   alert("回帖增加積分不能為空!");
}

function AlertBBSSystemManagetxtTopPoints()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("置顶增加积分不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Top increasing integration can not be empty!");
   else
   alert("置頂增加積分不能為空!");
}

function AlertBBSSystemManagetxtGoodPoints()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("精华增加积分不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Can not be empty essence increase the points!");
   else
   alert("精華增加積分不能為空!");
}

function AlertBBSSystemManagetxtMaxFile()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("上传限制大小不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Upload size limit can not be empty!");
   else
   alert("上傳限制大小不能為空!");
}

function AlertBBSSystemManagetxtTypeFile()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("允许上传类型不能为空");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Type can not be empty to allow upload");
   else
   alert("允許上傳類型不能為空!");
}

function AlertUserManageMove()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("请至少选择一个用戶进行添加!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Please at least select a user to Add!");
   else
   alert("請至少選擇一個用戶進行添加!");
}

function ConfirmUserManageMove()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   return confirm("是否移动所有选中用戶?");
   else
   if(document.cookie.indexOf("en-us")>=0)
   return confirm("Whether the move all selected users?");
   else
   return confirm("是否移動所有選中用戶?");
}

function AlertProClassCHT()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("类别名称(繁体)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Category name (Traditional) can not be empty!");
   else
   alert("類別名稱(繁體)不能為空!");
}

function AlertProClassCHS()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("类别名称(简体)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Category name (Simplified) can not be empty!");
   else
   alert("類別名稱(簡體)不能為空!");
}

function AlertProClassENG()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("类别名称(英文)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Category name (English) can not be empty!");
   else
   alert("類別名稱(英文)不能為空!");
}

function AlertProClassSortID()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("排序不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Order can not be empty!");
   else
   alert("排序不能為空!");
}

function AlertPNameCHT()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("产品名称(繁体)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Product name (Traditional) can not be empty!");
   else
   alert("產品名稱(繁體)不能為空!");
}

function AlertPNameCHS()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("产品名称(简体)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Product name (Simplified) can not be empty!");
   else
   alert("產品名稱(簡體)不能為空!");
}

function AlertPNameENG()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("产品名称(英文)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Product name (English) can not be empty!");
   else
   alert("產品名稱(英文)不能為空!");
}

function AlertTypeName()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("产品品名不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Product Name can not be empty!");
   else
   alert("產品品名不能為空!");
}

function AlertFeatureCHT()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("产品特色(繁体)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Features (Traditional) can not be empty!");
   else
   alert("產品特色(繁體)不能為空!");
}

function AlertFeatureCHS()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("产品特色(简体)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Features (Simplified) can not be empty!");
   else
   alert("產品特色(簡體)不能為空!");
}

function AlertFeatureENG()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("产品特色(英文)不能为空!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Features (English) can not be empty!");
   else
   alert("產品特色(英文)不能為空!");
}

function AlertFileUpLoad()
{
  if(document.cookie.indexOf("zh-CN")>=0)
   alert("上传文件不能为空！");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Upload file can not be empty!");
   else
   alert("上傳檔不能為空！");
}

function AlertBBSTitle()
{
  if(document.cookie.indexOf("zh-CN")>=0)
   alert("标题不能为空！");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Title can not be empty!");
   else
   alert("標題不能為空！");
}

function AlertMsgPostName()
{
  if(document.cookie.indexOf("zh-CN")>=0)
   alert("发送对象不能为空！");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Object Can not be empty!");
   else
   alert("發送對象不能為空！");
}

function AlertBBSDelete()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("请至少选择一个进行删除!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Please at least select a user to delete!");
   else
   alert("請至少選擇一個用進行删除!");
}
function WebBrowserErr()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("无法使用打印功能!浏览器菜单栏->工具->internet选项->安全->自定义级别->对没有标记安全的ActiveX控件进行初始化和脚本运行->选择'启用'->确定");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Can not use the print function! Your browser menu bar -> Tools -> internet options -> Security -> Custom Level -> on ActiveX controls not marked safe for initialization and script -> select 'Enable' -> OK ");
   else
   alert("無法使用打印功能!瀏覽器菜單欄->工具->internet選項->安全->自定義級別->對沒有標記安全的ActiveX控件進行初始化和腳本運行->選擇'啟用'->確定");
}
function VoteMost(Mosttimes)
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("最多选择"+ Mosttimes +"项!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Most choose"+ Mosttimes +"!");
   else
   alert("最多選擇"+ Mosttimes +"項!");
}
function VoteLeast()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("最少选择一项!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Select at least one!");
   else
   alert("最少選擇一項!");
}
function Voteconfirm(Mosttimes)
{
  if(document.cookie.indexOf("zh-CN")>=0)
   return confirm("只有一次投票机会,每次最多可投"+ Mosttimes +",是否确认投票?");
   else
   if(document.cookie.indexOf("en-us")>=0)
   return confirm("Only one vote to each may cast"+ Mosttimes +",Confirm the vote?");
   else
   return confirm("只有一次投票機會,每次最多可投"+ Mosttimes +",是否確認投票?");
}
function ConfirmUserManageSetReg()
{
  if(document.cookie.indexOf("zh-CN")>=0)
   return confirm("是否认证所有选中用戶?");
   else
   if(document.cookie.indexOf("en-us")>=0)
   return confirm("Whether the Activation all selected users?");
   else
   return confirm("是否認證所有選中用戶?");
}

function AlertAutoReseleOne()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("请至少选择一个版本进行发布!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Please select at least one version of release!");
   else
   alert("請至少選擇一個版本進行發佈!");
}

function AlertAutoReseleOneType()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("请至少选择一个类型进行发布!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Please select at least one type of release!");
   else
   alert("請至少選擇一個類型進行發佈!");
}

function AlertUpdateDownload()
{
 if(document.cookie.indexOf("zh-CN")>=0)
   alert("请上传下载资料!");
   else
   if(document.cookie.indexOf("en-us")>=0)
   alert("Please upload and download data!");
   else
   alert("請上傳下載資料!");
}

function ConfirmDownDate()
{
    if(document.cookie.indexOf("zh-CN")>=0)
       return confirm("是否确认无下架时间?(无下架时间表示该公告会一直存在公布栏中)");
       else
       if(document.cookie.indexOf("en-us")>=0)
       return confirm("No time to confirm the shelf? (No time indicated that the shelf has been there in the notice published column)");
       else
       return confirm("是否確認無下架時間?(無下架時間表示該公告會一直存在公佈欄中)");
}

function UrlError()
{
    if(document.cookie.indexOf("zh-CN")>=0)
    {
        alert("文件路径不正确或文件已损坏！");
    }
    else
    {
        if(document.cookie.indexOf("en-us")>=0)
        {
            alert("File path is incorrect or the file is corrupted！");
        }
        else
        {
            alert("文件路徑不正確或文件已損壞！");
        }
    }
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 ;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) 
    {c_end=document.cookie.length;}
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
var cookie_path  = window.location.pathname;  
cookie_path=cookie_path.substring(0, cookie_path.lastIndexOf('/')+1);  
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? ";path=/":";path=/;expires="+exdate.toUTCString());
}

function checkCookie()
{
  var username=getCookie('LastModify');
  if (username==null || username=="")
  {
  var myDate = new Date();
  username=myDate.getTime();
  setCookie('LastModify',username,1);
  }  
}
function checkNowTime()
{
  var NowDate = new Date();
  var username="";
  username=NowDate.getTime();
  setCookie('NowTime',username,1);
}

function SetLastModify(mod)
{
  var myDate = new Date();
  var username= 0;  
  if(mod=="0")
  {
    username=myDate.getTime();
  }
  setCookie('LastModify',username,1);
}

function delCookie(c_name){//为了删除指定名称的cookie，可以将其过期时间设定为一个过去的时间
   var date = new Date();
   var cookie_path  = window.location.pathname;  
   cookie_path=cookie_path.substring(0, cookie_path.lastIndexOf('/')+1);  
   date.setTime(date.getTime() - 10000);
   document.cookie = name + "=a;path=/;expires=" + date.toUTCString();
}

function read_cookie(key){
var str,ary;
str = document.cookie;    //获取Cookie的值
//用正则表达式去掉分号前后的空格，在JS中正则表达式需要用两个斜杠夹着，g表示全局搜索，然后用分号分割开各个键值对，放到ary数组中
ary=str.replace(/ *; */g,";").split(";");
//遍历ary数组，寻找是否存在以key为关键字的键值对，若有，则返回对应的值 key=escape(key)+"=";
for(var i=0;i<ary.length;i++){
if(ary[i].indexOf(key)==0){           //indexOf返回的值为0即代表其位于字符串的头部
return (unescape(ary[i].split("=")[1]));
}
}
}

Date.prototype.format = function(format) //author: meizz 
{ 
  var o = { 
    "M+" : this.getMonth()+1, //month 
    "d+" : this.getDate(),    //day 
    "h+" : this.getHours(),   //hour 
    "m+" : this.getMinutes(), //minute 
    "s+" : this.getSeconds(), //second 
    "q+" : Math.floor((this.getMonth()+3)/3),  //quarter 
    "S" : this.getMilliseconds() //millisecond 
  } 
  if(/(y+)/.test(format)) format=format.replace(RegExp.$1, 
    (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
  for(var k in o)if(new RegExp("("+ k +")").test(format)) 
    format = format.replace(RegExp.$1, 
      RegExp.$1.length==1 ? o[k] : 
        ("00"+ o[k]).substr((""+ o[k]).length)); 
  return format; 
} 

