
var dynamicDomain = "http://r2.club.china.com";
var staticDomain = "http://club.china.com";
var forumid="27490960";
//var forumid = "3000259";
function createscript(url) {
	var s = document.createElement("SCRIPT");
	s.id = "createscript";
	document.getElementsByTagName("HEAD")[0].appendChild(s);
	s.src = url;
}
function $(id) {
	return document.getElementById(id);
}
function getCookie(str) {
	var tmp, reg = new RegExp("(^| )" + str + "=([^;]*)(;|$)", "gi");
	if (tmp = reg.exec(document.cookie)) {
		return (unescape(tmp[2]));
	}
	return null;
}

//删除Cookie 
function ClearCookie(name) {
	var ThreeDays = 3 * 24 * 60 * 60 * 1000;
	var expDate = new Date();
	expDate.setTime(expDate.getTime() - ThreeDays);
	document.cookie = name + "=;domain=.club.china.com;path=/;expires=" + expDate.toGMTString();
}
function createCookie(name, value, days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
		var expires = "; expires=" + date.toGMTString();
	} else {
		var expires = "";
	}
	document.cookie = name + "=" + value + expires + "; domain=.club.china.com; path=/";
}
function wind() {
	var windImg1 = document.getElementById("wind");
	windImg1.setAttribute("className", "window_out22");
	windImg1.setAttribute("class", "window_out22");
	var windImg1 = document.getElementById("aphl");
	windImg1.setAttribute("className", "window_outAp");
	windImg1.setAttribute("class", "window_outAp");
	tagTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
	windo1 = document.getElementById("window1");
	windo1.style.top = document.documentElement.clientHeight / 3 + tagTop;
}
function LTrim(str) {
	var whitespace = new String("\t\n \u3000");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(0)) != -1) {
		var j = 0, i = s.length;
		while (j < i && whitespace.indexOf(s.charAt(j)) != -1) {
			j++;
		}
		s = s.substring(j, i);
	}
	return s;
}
function RTrim(str) {
	var whitespace = new String("\t\n \u3000");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(s.length - 1)) != -1) {
		var i = s.length - 1;
		while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) {
			i--;
		}
		s = s.substring(0, i + 1);
	}
	return s;
}
function Trim(str) {
	return RTrim(LTrim(str));
}
function Next(obj, e) {
	var evt = e || window.event;
	if (evt.keyCode != 13) {//回车
		return;
	}
	nextInput(obj);
}
function nextInput(curobj) {
	try {
		obj = curobj;
		if (matchInput(curobj)) {
		  //跳转到下一个input对象
			var str = obj.getAttribute("next");
			if (str == null || str == "") {
				return;
			} else {
				var nextObj = document.getElementById(obj.getAttribute("next"));
				while (nextObj != null) {
					if (nextObj.type == "button") {
						nextObj.onclick();
						return;
					} else {
						if (nextObj.type != "hidden" && nextObj.readOnly == false && nextObj.disabled == false) {
							nextObj.focus();
							break;
						} else {
							nextObj = document.getElementById(obj.getAttribute("next"));
							if (nextObj != null) {
								continue;
							} else {
								return;
							}
						}
					}
				}
			}
		}
	}
	catch (e) {
		alert(e);
	}
}
function matchInput(curobj) {
	obj = curobj;
	var matchbl = false;
	if (obj.value == "" || obj.value == null) {//if
		obj.code = "";
		obj.value = "";
		matchbl = true;
	} else {
		if (obj.dict_num == null || obj.dict_num == "") {
			matchbl = true;
		} else {
		}
	}
	if (matchbl == false) {
		curobj.value = "";
		curobj.focus();
		return false;
	} else {
		return true;
	}
}
_normal_charset = "0123456789";
function noChar(intPage) {
	for (i = 0; i <= intPage.length - 1; i++) {
		char1 = intPage.charAt(i);
		if (_normal_charset.indexOf(char1) == -1) {
			return true;
		}
	}
	return false;
}
function changeMyStory(page) {
	var url = dynamicDomain + "/xx.do?event=DECADEPAGE&action=mystory&page=" + page;
	createscript(url);
	return ;
}
doMyStoryback = function (data) {
	//document.getElementsByTagName("HEAD")[0].removeChild(document.getElementById("createscript"));
	var MainTxt = document.getElementById("MainTxt");
	var next2 = document.getElementById("next2");
	var next1 = document.getElementById("next1");
	next1.innerHTML = data["next1"];
	MainTxt.innerHTML = data["MainTxt"];
	next2.innerHTML = data["next2"];
};
findpage = function (theform, totalpage) {
	var pageno = theform.intPage.value;
	if (theform.intPage.value == "") {
		alert("\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u9875\u6570\uff01");
		theform.intPage.focus();
		return false;
	} else {
		if (noChar(theform.intPage.value)) {
			alert("\u542b\u6709\u975e\u6cd5\u5b57\u7b26,\u8bf7\u8f93\u5165\u6b63\u786e\u9875\u6570");
			theform.intPage.focus();
			return false;
		} else {
			if (theform.intPage.value > totalpage || theform.intPage.value <= 0) {
				alert("\u6b64\u4e3b\u9898\u5171\u6709" + totalpage + "\u9875,\u8bf7\u8f93\u51651--" + totalpage + "\u9875");
				theform.intPage.focus();
				return false;
			} else {
				var url = dynamicDomain + "/xx.do?event=DECADEPAGE&action=mystory&page=" + pageno;
				createscript(url);
				return false;
			}
		}
	}
};
function getFBody(strbody) {
	strbody = strbody.replace(/(\r|\n|\r\n)/g, "");
	strbody = strbody.replace(/&nbsp;/g, "");
	strbody = strbody.replace(/<br \/>/g, "");
	strbody = strbody.replace(/<p>/g, "");
	strbody = strbody.replace(/<\/p>/g, "");
	return strbody;
}
function strLen(key) {
	var l = escape(key), len;
	len = l.length - (l.length - l.replace(/\%u/g, "u").length) * 4;
	l = l.replace(/\%u/g, "uu");
	len = len - (l.length - l.replace(/\%/g, "").length) * 2;
	return len;
}




