var APP_PATH = "";function $ID(idVal) {return document.getElementById(idVal);}
function OutFrame() {if (self != top) {top.location = self.location;}
}
function InFrame(url) {if (self == top) {window.location = url;}
}
function hiddenByTagIdName(tagId) {var p = $ID(tagId);if (p != null) {p.style.display = "none";}
}
function displayByTagIdName(tagId) {var p = $ID(tagId);if (p != null) {p.style.display = "block";}
}
function hiddenByTagObject(obj) {if (obj != null) {obj.style.display = "none";}
}
function displayByTagObject(obj) {if (obj != null) {obj.style.display = "block";}
}
function getHttpRequest(){var xmlHttp;if (typeof XMLHttpRequest != "undefined") {try {xmlHttp = new XMLHttpRequest();} catch (e) {xmlHttp = null;}
} else if (window.ActiveXObject) {var aVersions = ["Msxml2.XMLHttp.5.0", "Msxml2.XMLHttp.4.0", "Msxml2.XMLHttp.3.0", "Msxml2.XMLHttp", "Microsoft.XMLHttp"];for (var i = 0; i < aVersions.length; i++) {try {xmlHttp = new ActiveXObject(aVersions[i]);break;} catch (e) {xmlHttp = null;}
}
}
return xmlHttp;}
function setAjaxValue(url, tagId) {var httpRequest = getHttpRequest();if (httpRequest == null) {return;}
httpRequest.open("GET", url);httpRequest.onreadystatechange = function() {var state = httpRequest.readyState;if (state == 4) {if (httpRequest.responseText.indexOf("customErrorPage") < 0 && $ID(tagId) != null) {$ID(tagId).innerHTML = httpRequest.responseText;}
}
};httpRequest.send("");}
function callbackAjaxValue(url, values, callback) {var httpRequest = getHttpRequest();if (httpRequest == null) {return;}
if (values = null) {httpRequest.open("GET", url);} else {httpRequest.open("POST", url);}
httpRequest.onreadystatechange = function() {var state = httpRequest.readyState;if (state == 4) {var result;var contentType = httpRequest.getResponseHeader("Content-Type");if (contentType != null && contentType.indexOf("text/json") >= 0) {result = window["eval"]("(" + httpRequest.responseText + ")");callback(result);} else {result = httpRequest.responseText;if (result == null || result.indexOf("customErrorPage") < 0) {callback(result);}
}
}
};if (values == null) {httpRequest.send("");} else {httpRequest.send(HTTPEncodeFormData(values));}
}
HTTPEncodeFormData = function(data) {var pairs = [];var regexp = /%20/g;for (var name in data) {var value = data[name].toString();var pair = encodeURIComponent(name).replace(regexp, "+") + '=' + encodeURIComponent(value).replace(regexp, "+");pairs.push(pair);}
return pairs.join('&');};var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var base64DecodeChars = new Array(
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);function base64encode(str) {str = utf16to8(str);var out, i, len;var c1, c2, c3;len = str.length;i = 0;out = "";while (i < len) {c1 = str.charCodeAt(i++) & 0xff;if (i == len) {out += base64EncodeChars.charAt(c1 >> 2);out += base64EncodeChars.charAt((c1 & 0x3) << 4);out += "==";break;}
c2 = str.charCodeAt(i++);if (i == len) {out += base64EncodeChars.charAt(c1 >> 2);out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));out += base64EncodeChars.charAt((c2 & 0xF) << 2);out += "=";break;}
c3 = str.charCodeAt(i++);out += base64EncodeChars.charAt(c1 >> 2);out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));out += base64EncodeChars.charAt(c3 & 0x3F);}
return out;}
function base64decode(str) {var c1, c2, c3, c4;var i, len, out;len = str.length;i = 0;out = "";while (i < len) {do {c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];} while (i < len && c1 == -1);if (c1 == -1) {break;}
do {c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];} while (i < len && c2 == -1);if (c2 == -1) {break;}
out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));do {c3 = str.charCodeAt(i++) & 0xff;if (c3 == 61) {out = utf8to16(out);return out;}
c3 = base64DecodeChars[c3];} while (i < len && c3 == -1);if (c3 == -1) {break;}
out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));do {c4 = str.charCodeAt(i++) & 0xff;if (c4 == 61) {out = utf8to16(out);return out;}
c4 = base64DecodeChars[c4];} while (i < len && c4 == -1);if (c4 == -1) {break;}
out += String.fromCharCode(((c3 & 0x03) << 6) | c4);}
out = utf8to16(out);return out;}
function utf16to8(str) {var out, i, len, c;out = "";len = str.length;for (i = 0; i < len; i++) {c = str.charCodeAt(i);if ((c >= 0x0001) && (c <= 0x007F)) {out += str.charAt(i);} else if (c > 0x07FF) {out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));} else {out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));}
}
return out;}
function utf8to16(str) {var out, i, len, c;var char2, char3;out = "";len = str.length;i = 0;while (i < len) {c = str.charCodeAt(i++);switch (c >> 4) {case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
{out += str.charAt(i - 1);break;}
case 12: case 13:
{char2 = str.charCodeAt(i++);out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));break;}
case 14:
{char2 = str.charCodeAt(i++);char3 = str.charCodeAt(i++);out += String.fromCharCode(((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));break;}
}
}
return out;}
function getRequestValue(name) {var URLParams = new Object();var aParams = document.location.search.substr(1).split('&');for (i = 0; i < aParams.length; i++) {var aParam = aParams[i].split('=');URLParams[aParam[0]] = aParam[1];}
return URLParams[name];}
function readCookie(name) {var cookieValue = "";var search = name + "=";if (document.cookie.length > 0) {offset = document.cookie.indexOf(search);if (offset != -1) {offset += search.length;end = document.cookie.indexOf(";", offset);if (end == -1) {end = document.cookie.length;}
cookieValue = unescape(document.cookie.substring(offset, end))
}
}
return cookieValue;}
function writeCookie(name, value, hours) {var expire = "";if (hours != null) {expire = new Date((new Date()).getTime() + hours * 3600000);expire = "; expires=" + expire.toGMTString();}
document.cookie = name + "=" + escape(value) + expire + ";path=/";}
function cmsLogin() {var loginNameObj = $ID("LoginName");var loginName = loginNameObj.value;if(loginName.length == 0){var loginNameNotNull =  $ID("LoginNameNotNull");if(loginNameNotNull!=null){loginNameNotNull.innerHTML = "User name is Required.";}
loginNameObj.focus();return;}
writeCookie("cookieAccountName", loginName, null);var passwordObj = $ID("Password");var password = passwordObj.value;if (password.length == 0) {var passwordNotNull = $ID("PasswordNotNull");if (passwordNotNull != null) {passwordNotNull.innerHTML = "Password is Required.";}
passwordObj.focus();return;}
var inputCheckCodeObj = $ID("InputCheckCode");if (inputCheckCodeObj != null) {var checkCode = inputCheckCodeObj.value;if (checkCode.length == 0) {var checkCodeNotNull = $ID("CheckCodeNotNull");if (checkCodeNotNull != null) {checkCodeNotNull.innerHTML = "Check Code is Required.";}
inputCheckCodeObj.focus();return;}
}
loginNameObj.value = enCryptFormString(loginName);passwordObj.value = enCryptFormString(password);$ID("loginForm").submit();}
function enCryptFormString(str) {var tmpStr = base64encode(str);return randomChar() + tmpStr.substring(0, 1) + randomChar() + tmpStr.substring(1, tmpStr.length) + randomChar();}
function randomChar() {return base64EncodeChars.charAt(Math.floor(Math.random() * 1000 % 64));}
function readCookieAccountName() {var cookieAccountName = readCookie("cookieAccountName");if (cookieAccountName != "") {$ID("LoginName").value = cookieAccountName;}
}
var constLoginName = "LoginName";function loginNameClick() {var loginName = $ID("LoginName").value;if (loginName == constLoginName) {$ID("LoginName").value = "";$ID("LoginName").style.color = "#272727";}
}
function loginNameBlur() {var loginName = $ID("LoginName").value;if (loginName == "") {$ID("LoginName").value = constLoginName;$ID("LoginName").style.color = "#ADADAD";}
}
function passwordClick() {var password = $ID("Password").value;if (password == "guest") {$ID("Password").value = "";$ID("Password").style.color = "#272727";}
}
function passwordBlur() {var password = $ID("Password").value;if (password == "") {$ID("Password").value = "guest";$ID("Password").style.color = "#ADADAD";}
}
function execLogInfoAjax() {initLogInfo();}
function initLogInfo() {callbackAjaxValue(APP_PATH + "/commonop/LogInfo.ashx?" + new Date().getTime(), null, callbackInitLogInfoValue);}
function callbackInitLogInfoValue(values) {if (values != null && values != "" && values != " ") {if ($ID("LoginInfo") != null) {$ID("LoginInfo").innerHTML = values;}
} else {if ($ID("LoginName") != null) {constLoginName = $ID("LoginName").value;}
}
}
function cmsSearchBtn() {var searchKeywordObj = $ID("searchKeyword");var searchKeyword = searchKeywordObj.value;if (searchKeyword.length == 0) {searchKeywordObj.focus();return;}
$ID("searchForm").submit();}
function TabFrameOnClick(contentId, eventTarget, TabID) {var tabHeadDiv = eventTarget.parentNode;var headChilds = tabHeadDiv.getElementsByTagName("div")
for (var i = 1; i < headChilds.length; i++) {headChilds[i].className = "TabHeadLabel";}
headChilds[TabID].className = "TabHeadLabelActive";headChilds[TabID].style.cursor = 'pointer';for (var i = 1; i < headChilds.length; i++) {if ($ID(contentId + i) != null) {$ID(contentId + i).style.display = "none";}
}
$ID(contentId + TabID).style.display = "block";tabHeadDiv = null;headChilds = null;}
function replaceI18nValue() {var url = APP_PATH + "/commonop/GetI18nValues.ashx?lang=" + readCookie("lang") +"&" + new Date().toLocaleString();callbackAjaxValue(url, null, callbackI18nValue);}
function callbackI18nValue(values) {if (values != null) {for (var key in values) {document.body.innerHTML = document.body.innerHTML.replace("${i18n." + key + "}", values[key]);}
var url = "" + window.location;if (url.indexOf("/index") >= 0) {document.title = values["webTitle"];}
}
}
function setDefaultEdition() {var lang = readCookie("lang");hiddenMultiLangTag("SJCurrPos");hiddenMultiLangTag("SJTitle");if (lang == "simp") {var tab1 = $ID("TabMatterLabel1");if (tab1 != null) {TabFrameOnClick('ArticleI18nList', tab1, 1);}
displayByTagIdName("SJCurrPosSimp");displayByTagIdName("SJTitleSimp");} else if (lang == "trad") {var tab2 = $ID("TabMatterLabel2");if (tab2 != null) {TabFrameOnClick('ArticleI18nList', tab2, 2);}
displayByTagIdName("SJCurrPosTrad");displayByTagIdName("SJTitleTrad");} else {var tab3 = $ID("TabMatterLabel3");if (tab3 != null) {TabFrameOnClick('ArticleI18nList', tab3, 3);}
displayByTagIdName("SJCurrPosEn");displayByTagIdName("SJTitleEn");}
}
function setEdition(edition) {hiddenMultiLangTag("SJCurrPos");hiddenMultiLangTag("SJTitle");if (edition == "simp") {var tab1 = $ID("TabMatterLabel1");if (tab1 != null) {TabFrameOnClick('ArticleI18nList', tab1, 1);}
displayByTagIdName("SJCurrPosSimp");displayByTagIdName("SJTitleSimp");} else if (edition == "trad") {var tab2 = $ID("TabMatterLabel2");if (tab2 != null) {TabFrameOnClick('ArticleI18nList', tab2, 2);}
displayByTagIdName("SJCurrPosTrad");displayByTagIdName("SJTitleTrad");} else {var tab3 = $ID("TabMatterLabel3");if (tab3 != null) {TabFrameOnClick('ArticleI18nList', tab3, 3);}
displayByTagIdName("SJCurrPosEn");displayByTagIdName("SJTitleEn");}
}
function hiddenMultiLangTag(tagName) {hiddenByTagIdName(tagName + "Simp");hiddenByTagIdName(tagName + "Trad");hiddenByTagIdName(tagName + "En");}

