
/*
* Show gsxw tab or zcfg tab.
*/
function showTab(tabshow) {
	var tabhide;
	if (tabshow == "gsxw") {
		tabhide = "zcfg";
	} else {
		tabhide = "gsxw";
	}
	(document.getElementById(tabshow)).style.display = "block";
	(document.getElementById(tabhide)).style.display = "none";
	changeBGImgSub(tabshow + "head", "true");
	changeBGImgSub(tabhide + "head", "false");
}
/*
*@author ww
*Change the index page's background image together with its fonts.
*/
function changeBGImg(id, b) {
	var e = document.getElementById(id);
	if (b == "true") {
		e.style.backgroundImage = "url('img/gset/bg0.jpg')";
		e.style.fontSize = 16;
		e.style.color = "#00ffff";
	} else {
		e.style.backgroundImage = "url('img/gset/bg1.jpg')";
		e.style.fontSize = 13;
		e.style.color = "#ffffff";
	}
}
/*
*@author ww
*Change the index page's background image together with its fonts.
*/
function changeBGImgSub(id, b) {
	var e = document.getElementById(id);
	e.style.width = 190;
	if (b == "true") {
		e.style.backgroundImage = "url('img/gset/btn2.jpg')";
		e.style.fontSize = 16;
		e.style.color = "#00ffff";
	} else {
		e.style.backgroundImage = "url('img/gset/btn1.jpg')";
		e.style.fontSize = 13;
		e.style.color = "#ffffff";
	}
}
/*
*
*/
function changeBGColor(id, b) {
	var tr = document.getElementById(id);
	if (b == "true") {
		tr.style.background = "rgb(244,248,252)";
	} else {
		tr.style.background = "#ffffff";
	}
}
/*
*
*/
function spanChangeColor(id, b) {
	var tr = document.getElementById(id);
	if (b == "1") {
		if (tr.style.color == "rgb(102,0,102)") {
		} else {
			if (tr.style.color == "" || tr.style.color == "rgb(127,127,127)") {
				tr.style.color = "#0000ff";
			}
		}
	} else {
		if (b == "2") {
			if (tr.style.color == "rgb(102,0,102)") {
			} else {
				if (tr.style.color == "" || tr.style.color == "#0000ff") {
					tr.style.color = "rgb(127,127,127)";
				}
			}
		} else {
			tr.style.color = "rgb(102,0,102)";
		}
	}
}
/*
*validate the form to be submitted.
*/
function validateForm() {
	var code = document.getElementById("code");
	if (code.value == "") {
		alert("\u8bf7\u8f93\u5165\u7528\u6237\u540d\uff01");
		code.focus();
		return false;
	} else {
		if (code.value == "admin") {
		} else {
			if (/^(\-?)(\d+)$/.test(code.value)) {
			} else {
				alert("\u7528\u6237\u540d\u4e0d\u6b63\u786e\uff0c\u8bf7\u91cd\u8f93\uff01");
				code.focus();
				code.value = "";
				return false;
			}
		}
	}
	var pwd = document.getElementById("pwd");
	if (pwd.value == "") {
		alert("\u8bf7\u8f93\u5165\u5bc6\u7801\uff01");
		pwd.focus();
		return false;
	}
	var rand = document.getElementById("rand");
	if (rand.value == "") {
		alert("\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801\uff01");
		rand.focus();
		return false;
	}
	document.forms[0].submit();
	return true;
}
/*
*Reset form values.
*/
function reset() {
	var code = document.getElementById("code");
	var pwd = document.getElementById("pwd");
	code.value = "";
	pwd.value = "";
	code.focus();
}
/*
*showModal 
*/
function showModal(elements) {
	var ele0 = elements[0];
	if (ele0 == "recentNews" || ele0 == "recentDealers" || ele0 == "recentLaws" || ele0 == "product") {
		window.showModalDialog("page/indexModalDialog.jsp", elements, "dialogWidth:800px;dialogHeight:500px;status:no;help:no;unadorned:yes");
	}
}
/*
*showModal 
*/
function showArticleModal(artId) {
	//if (ele0 == "recentNews" || ele0 == "recentDealers" || ele0 == "recentLaws"||ele0 == "product") {
	var toUrl = "index!showArticle.action?artId=" + artId;
	window.showModalDialog(toUrl, artId, "dialogWidth:800px;dialogHeight:500px;status:no;help:no;unadorned:yes");
//	}
}
/*
* @superess warning(unchecked)!!!!!!
* test function for 'rn' replace.
*/
function replaceReturn(str) {
	str.replace("\r\n", "&lt;br&gt;");
	str.replace("\r", "&lt;br&gt;");
	str.replace("\n", "&lt;br&gt;");
	return str;
}

