
function $$(Obj) {
	return document.getElementById(Obj);
}
//导航提示显示
function t(num) {
	for (var i = 0; i < 6; i++) {
		var lid = "cue" + i;
		document.getElementById(lid).style.display = "none";
	}
	if (num != null) {
		var dqshow = "cue" + num;
		document.getElementById(dqshow).style.display = "";
	}
}

//层控制函数
function OpenDiv(UrlInfo, Width) {
	if (!Width) {
		Width = 560;
	}
	if (document.body.scrollHeight < document.body.offsetHeight) {
		$$("oDiv1").style.height = "100%";
	} else {
		$$("oDiv1").style.height = document.body.scrollHeight + "px";
	}
	$$("oDiv1").style.display = "block";
	$$("oDiv2").style.top = document.body.scrollTop + 90 + "px";
	$$("oDiv2").style.display = "block";
	$$("oDiv2").innerHTML = "<iframe name=\"IndexFrame\" id=\"IndexFrame\" src=" + UrlInfo + " frameborder=\"0\" scrolling=\"no\" width=\"" + Width + "\" onLoad=\"document.all['IndexFrame'].style.height=IndexFrame.document.body.scrollHeight\"></iframe>";
	$$("IndexFrame").src = $$("IndexFrame").src;
}
function FIHeight() {
	window.parent.document.all["IndexFrame"].style.height = document.body.scrollHeight;
}
function CloseDiv() {
	window.parent.$$("oDiv2").style.display = "none";
	window.parent.$$("oDiv1").style.display = "none";
}
function InEditor(Obj) {
	parent.parent.window.Editor.window.Editor.document.body.focus();
	parent.parent.window.Editor.window.Editor.document.selection.createRange().pasteHTML(Obj);
}
//滑动门函数
function setTab(A, B, C, D) {
	for (i = 1; i <= C; i++) {
		var MenuObj = document.getElementById(A + i);
		var ConObj = document.getElementById("Con" + A + i);
		if (D) {
			MenuObj.className = i == B ? D + "_On" : D + "_Off";
		}
		ConObj.style.display = i == B ? "block" : "none";
	}
}
//下拉菜单
var MPoint = 0;
function FindPosX(Obj) {
	var CurLeft = -1;
	if (Obj.offsetParent) {
		while (Obj.offsetParent) {
			CurLeft += Obj.offsetLeft;
			Obj = Obj.offsetParent;
		}
	} else {
		if (Obj.x) {
			CurLeft += Obj.x;
		}
	}
	return CurLeft;
}
function FindPosY(Obj) {
	var CurTop = 0;
	if (Obj.offsetParent) {
		while (Obj.offsetParent) {
			CurTop += Obj.offsetTop;
			Obj = Obj.offsetParent;
		}
	} else {
		if (Obj.y) {
			CurTop += Obj.y;
		}
	}
	return CurTop;
}
function OverMenu(A, B, C) {
	for (var D = 1; D < C + 1; D++) {
		$$("oP" + D).style.display = "none";
	}
	$$(A).style.left = document.body.offsetLeft + FindPosX(B) + "px";
	$$(A).style.top = document.body.offsetTop + FindPosY(B) + B.offsetHeight + "px";
	$$(A).style.width = (B.offsetWidth + 2) + "px";
	$$(A).style.display = "block";
	MPoint += 1;
}
function LastMenu(A, B, C) {
	for (var D = 1; D < C + 1; D++) {
		$$("sP" + D).style.display = "none";
	}
	$$(A).style.left = document.body.offsetLeft + FindPosX(B) + "px";
	$$(A).style.top = document.body.offsetTop + FindPosY(B) + B.offsetHeight + "px";
	$$(A).style.width = (B.offsetWidth + 2) + "px";
	$$(A).style.display = "block";
	MPoint += 1;
}
function OutMenu(A, B) {
	MPoint += B;
	setTimeout("Close('" + A + "')", 0);
}
function Close(A) {
	if (MPoint <= 0) {
		$$(A).style.display = "none";
	}
}
function rSTO() {
	var A, B, C = document.Str;
	for (A = 0; C && A < C.length && (B = C[A]) && B.oSrc; A++) {
		B.src = B.oSrc;
	}
}
function rIMG() {
	var A, B = 0, C, D = rIMG.arguments;
	document.Str = new Array;
	for (A = 0; A < (D.length); A += 3) {
		if ((C = $$(D[A])) != null) {
			document.Str[B++] = C;
			if (!C.oSrc) {
				C.oSrc = C.src;
			}
			C.src = D[A + 1];
		}
	}
}
//反选函数
function SelectAllCheckBox(Obj) {
	var Coll = document.all.item(Obj);
	if (!Coll) {
		return;
	}
	if (Coll.length) {
		for (var NumID = 0; NumID < Coll.length; NumID++) {
			Coll.item(NumID).checked = !Coll.item(NumID).checked;
		}
	} else {
		document.all.item(Obj).checked = !document.all.item(Obj).checked;
	}
}
function GetCheckBoxList(Obj) {
	var Result = "";
	var Coll = document.all.item(Obj);
	if (!Coll) {
		return Result;
	}
	if (Coll.length) {
		for (var NumID = 0; NumID < Coll.length; NumID++) {
			if (Coll.item(NumID).checked) {
				Result += (Result == "") ? Coll.item(NumID).value : ("," + Coll.item(NumID).value);
			}
		}
	} else {
		if (document.all.item(Obj).checked) {
			Result = document.all.item(Obj).value;
		}
	}
	return Result;
}
//复制函数
function ClsCopy(Obj) {
	window.clipboardData.setData("Text", Obj);
	OpenDiv("/homepage/Member/Copy.jsp");
}
//语音验证码
function ChkAudio() {
	$$("ChkDiv").innerHTML = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"0\" height=\"0\"><param name=\"movie\" value=\"/Images/Script/Validate.swf?Number=" + getChkCode() + "\"><param name=\"quality\" value=\"high\"><param name=\"wmode\" value=\"transparent\"><embed pluginspage=\"http://www.macromedia.com/go/getflashplayer\" width=\"0\" height=\"0\" type=\"application/x-shockwave-flash\" src=\"/Images/Script/Validate.swf?Number=" + getChkCode() + "\"></object>";
}
function getChkCode() {
	var xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	xmlHTTP.open("Get", "/Ajax/xHttp.jsp?Action=getChkCode", false);
	xmlHTTP.send();
	if (xmlHTTP.readyState == 4) {
		if (xmlHTTP.status == 200) {
			return xmlHTTP.responseText;
		}
	}
}
//搜索关键字自动完成
function sAuto() {
	var xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	xmlHTTP.onreadystatechange = function () {
		if (xmlHTTP.readyState == 4) {
			if (xmlHTTP.status == 200) {
				$$("sDiv").innerHTML = unescape(xmlHTTP.responseText);
			}
		}
	};
	xmlHTTP.open("post", "/Ajax/xHttp.jsp?Action=sResult", true);
	xmlHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHTTP.send("KeyWord=" + escape($$("KeyWord").value));
}
function setDraw(Para) {
	setTimeout("setDraw('" + Para + "')", 1000);
	$$(Para + "Draw").innerHTML = getDraw(Para);
}
function getDraw(Para) {
	var xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	xmlHTTP.open("Get", "/Ajax/xHttp.jsp?Action=getDraw&DrawType=" + Para, false);
	xmlHTTP.send();
	if (xmlHTTP.readyState == 4) {
		if (xmlHTTP.status == 200) {
			return xmlHTTP.responseText;
		}
	}
}
function setOrder(Para) {
	setTimeout("setOrder('" + Para + "')", 1000);
	$$("nOrder" + Para).innerHTML = getOrder(Para);
}
function getOrder(Para) {
	var xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	xmlHTTP.open("Get", "/Ajax/xHttp.jsp?Action=getOrder&BOID=" + Para, false);
	xmlHTTP.send();
	if (xmlHTTP.readyState == 4) {
		if (xmlHTTP.status == 200) {
			return xmlHTTP.responseText;
		}
	}
}
function setALiPay() {
	setTimeout("setALiPay()", 1000);
	$$("nALiPay").innerHTML = getALiPay();
}
function getALiPay() {
	var xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	xmlHTTP.open("Get", "/Ajax/xHttp.jsp?Action=getALiPay", false);
	xmlHTTP.send();
	if (xmlHTTP.readyState == 4) {
		if (xmlHTTP.status == 200) {
			return xmlHTTP.responseText;
		}
	}
}
function ChkNum(obj) {
	var val = obj.value;
	if (val == "") {
		obj.value = 1;
	} else {
		var reg = /\D/g;
		if (val.match(reg)) {
			obj.value = 1;
		} else {
			if (parseInt(val) <= 0 || parseInt(val) > 50) {
				alert("最大不能超过50倍");
				obj.value = 1;
			}
		}
	}
}
//以下是身份证验证需要的函数------------开始
function ValidatorIdcard(Number) {
	var DateValue, Ai;
	var Verify = "10x98765432";
	var Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
	var AreaValue = ["", "", "", "", "", "", "", "", "", "", "", "\u5317\u4eac", "\u5929\u6d25", "\u6cb3\u5317", "\u5c71\u897f", "\u5185\u8499\u53e4", "", "", "", "", "", "\u8fbd\u5b81", "\u5409\u6797", "\u9ed1\u9f99\u6c5f", "", "", "", "", "", "", "", "\u4e0a\u6d77", "\u6c5f\u82cf", "\u6d59\u6c5f", "\u5b89\u5fae", "\u798f\u5efa", "\u6c5f\u897f", "\u5c71\u4e1c", "", "", "", "\u6cb3\u5357", "\u6e56\u5317", "\u6e56\u5357", "\u5e7f\u4e1c", "\u5e7f\u897f", "\u6d77\u5357", "", "", "", "\u91cd\u5e86", "\u56db\u5ddd", "\u8d35\u5dde", "\u4e91\u5357", "\u897f\u85cf", "", "", "", "", "", "", "\u9655\u897f", "\u7518\u8083", "\u9752\u6d77", "\u5b81\u590f", "\u65b0\u7586", "", "", "", "", "", "\u53f0\u6e7e", "", "", "", "", "", "", "", "", "", "\u9999\u6e2f", "\u6fb3\u95e8", "", "", "", "", "", "", "", "", "\u56fd\u5916"];
	var RegValue = Number.match(/^(\d{2})\d{4}(((\d{2})(\d{2})(\d{2})(\d{3}))|((\d{4})(\d{2})(\d{2})(\d{3}[x\d])))$/i);
	if (RegValue == null) {
		return false;
	}
	if (RegValue[1] >= AreaValue.length || AreaValue[RegValue[1]] == "") {
		return false;
	}
	if (RegValue[2].length == 12) {
		Ai = Number.substr(0, 17);
		DateValue = [RegValue[9], RegValue[10], RegValue[11]].join("-");
	} else {
		Ai = Number.substr(0, 6) + "19" + Number.substr(6);
		DateValue = ["19" + RegValue[4], RegValue[5], RegValue[6]].join("-");
	}
	if (!IsDate(DateValue, "ymd")) {
		return false;
	}
	var Sum = 0;
	for (var i = 0; i <= 16; i++) {
		Sum += Ai.charAt(i) * Wi[i];
	}
	Ai += Verify.charAt(Sum % 11);
	return (Number.length == 15 || Number.length == 18 && Number == Ai);
}
function IsDate(Obj, FormatString) {
	FormatString = FormatString || "ymd";
	var M, Year, Month, Day;
	switch (FormatString) {
	  case "ymd":
		M = Obj.match(new RegExp("^((\\d{4})|(\\d{2}))([-./])(\\d{1,2})\\4(\\d{1,2})$"));
		if (M == null) {
			return false;
		}
		Day = M[6];
		Month = M[5] * 1;
		Year = (M[2].length == 4) ? M[2] : GetFullYear(parseInt(M[3], 10));
		break;
	  case "dmy":
		M = Obj.match(new RegExp("^(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))$"));
		if (M == null) {
			return false;
		}
		Day = M[1];
		Month = M[3] * 1;
		Year = (M[5].length == 4) ? M[5] : GetFullYear(parseInt(M[6], 10));
		break;
	  default:
		break;
	}
	if (!parseInt(Month)) {
		return false;
	}
	Month = Month == 0 ? 12 : Month;
	var date = new Date(Year, Month - 1, Day);
	return (typeof (date) == "object" && Year == date.getFullYear() && Month == (date.getMonth() + 1) && Day == date.getDate());
	function GetFullYear(y) {
		return ((y < 30 ? "20" : "19") + y) | 0;
	}
}
//以上是身份证验证需要的函数------------结束

//滚动函数
var annst = 0;
var anncount = 0;
function announcementScroll(rollNum,rollHeight){
	announcement="announcement_"+rollNum;
	announcementbody="announcementbody_"+rollNum;
	annheight=rollHeight;
   if( ! annst)
   {
      $$(announcementbody).innerHTML += ' ' + $$(announcementbody).innerHTML;
      $$(announcementbody).scrollTop = 0;
      if($$(announcementbody).scrollHeight > annheight * 3)
      {
         annst = setTimeout('announcementScroll('+rollNum+','+annheight+')', 3000);
      }
      else
      {
         $$(announcement).onmouseover = $$(announcement).onmouseout = null;
      }
      return;
   }
   if(anncount == annheight)
   {
      if($$(announcementbody).scrollHeight - annheight <= $$(announcementbody).scrollTop)
      {
         $$(announcementbody).scrollTop = $$(announcementbody).scrollHeight / 2 - annheight;
      }
      anncount = 0;
	  
      annst = setTimeout('announcementScroll('+rollNum+','+annheight+')', 3000);
   }
   else
   {
      $$(announcementbody).scrollTop ++ ;
      anncount ++ ;
      annst = setTimeout('announcementScroll('+rollNum+','+annheight+')', 10);
   }
}