﻿var MEMBER_LOGIN_STATUS_JS_DATA = "https://member.muchina.com/Login/jsdata/getaccount.asp";	// 角色账号获取地址
//var MEMBER_LOGIN_STATUS_JS_DATA = "http://evt.muchina.com/MuMembLogin/GetAccount.aspx";	// 角色账号获取地址
var NOTICE_HISTORY_JS_DATA = "http://evt.muchina.com/MuNotice/jsdata/noticehistory.aspx";	// 公告获取地址
var NOTICE_HISTORY2_JS_DATA = "http://evt.muchina.com/MuNotice/jsdata/noticehistory2.aspx";	// 全部公告获取地址
var CDKEY_74_JS_DATE = "http://evt.muchina.com/GetCDKeySpeeding/jsdata/cdkey.aspx";	// 74区激活码状态获取地址

function CNoticeHistory(historyID, accountID, name, partitionID, groupID, itemName, 
						itemCount, message, type, stat, createDatetime, sendDatetime) {	// 公告类
	this.HistoryID		= historyID;			// 编号
	this.AccountID		= accountID;			// 账号
	this.Name			= name;					// 角色名
	this.PartitionID	= partitionID;			// 区号
	this.GroupID		= groupID;				// 服号
	this.ItemName		= itemName;				// 物品名称
	this.ItemCount		= itemCount;			// 物品数量
	this.Message		= message;				// 信息
	this.Type			= type;					// 公告类型
	this.Stat			= stat;					// 公告状态
	this.CreateDatetime	= createDatetime;		// 公告创建时间
	this.SendDatetime	= sendDatetime;			// 公告发送时间
}

var AccountID = "";					// 账号
var NoticeItem = new Array();		// 公告列表
var NoticeItem2 = new Array();		// 公告列表
var ItemCount = 0;					// 公告总数
var CurrPage = 0;

function CCDKey(key, password, stat) { // CDKEY类
	this.Key = key;
	this.Password = password;
	this.Stat = stat;
}

var CDKey = new Array();		// CDKEY列表
var CDKeyRemainingTime = "";		// CDKEY刷新的时间
var CDKeyReturn = "0000";			// 获取CDKEY时返回的信息

function getQueryStringRegExp(param) {
    var query = location.search;
    var iLen = param.length;
    var iStart = query.indexOf(param);
    if (iStart == -1) return "";
    iStart += iLen + 1;
    var iEnd = query.indexOf("&", iStart);
    if (iEnd == -1) return query.substring(iStart);
    return query.substring(iStart, iEnd);
}

function getChineseDateString(date) {
	var d = StringToDate(date);
	return pad(d.getFullYear(),4)+"年"+pad(d.getMonth()+1,2)+"月"+pad(d.getDate(),2)+"日";
}

function getChineseTimeString(date) {
	var d = StringToDate(date);
	return pad(d.getHours(),2)+":"+pad(d.getMinutes(),2)+":"+pad(d.getSeconds(),2);
}

function StringToDate(DateStr) {
	var myDate = new Date(DateStr);
	if (isNaN(myDate)) {      
		var arys = DateStr.split(' ');
		var arysDate = arys[0].split('-');
		var arysTime = arys[1].split(':');
		myDate = new Date(arysDate[0], arysDate[1], arysDate[2], arysTime[0], arysTime[1], arysTime[2]);
	}     
	return myDate;     
}

function pad(num, n) {
    var len = num.toString().length;
    while(len < n) {
        num = "0" + num;
        len++;
    }
    return num;
}

function RemainingTime(str) {
	var ret = str.split('.')[0];
	return ret.split(':')[1]+":"+ret.split(':')[2];
}

function showPanel(cover, id) {
	var objCover = document.getElementById(cover);
	var objId = document.getElementById(id);
	var scrollW = document.documentElement.scrollWidth;
	var scrollH = document.documentElement.scrollHeight;
	var T = (document.documentElement.clientHeight-objId.clientHeight)/2+document.documentElement.scrollTop;
	var L = (document.documentElement.clientWidth-objId.clientWidth)/2+document.documentElement.scrollLeft;
	objCover.style.width = scrollW+"px";
	objCover.style.height = scrollH+"px";
	objCover.style.visibility = "visible";
	objId.style.top = T+"px";
	objId.style.left = L+"px";
	objId.style.visibility = "visible";
	
	var shtml = objCover.innerHTML;
    var ifm = document.createElement('<iframe frameborder="0" marginheight="0" marginwidth="0" hspace="0" vspace="0" scrolling="no"></iframe>');
    ifm.style.width = scrollW;
    ifm.style.height = scrollH;
    ifm.name = ifm.uniqueID;
    objCover.innerHTML = "";
    objCover.appendChild(ifm);
    window.frames[ifm.name].document.write('<html><body leftmargin="0" topmargin="0">'+shtml+'</body></html>');
}

function hidePanel(cover, id) {
	var objCover = document.getElementById(cover);
	var objId = document.getElementById(id);
	objCover.style.visibility = "hidden";
	objId.style.visibility = "hidden";
}

