// JavaScript Document
//定义层与浏览器版本显示问题
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//定义图像鼠标响应与浏览器版本显示问题
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//弹出窗口(宽、高、快速工具栏、状态栏、菜单、滚动条、改变大小)
var Widths=screen.width;
var Heights=screen.Height-26;
function full_screen(Url){
	var Windows=window.open('','Huarenxinxi_Chat','scrollbars')
	//location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes
	//width='+Widths+',height='+Heights+',left=0;top=0;toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,center=yes
	if (document.all){
		Windows.moveTo(0,0)
		Windows.resizeTo(Widths,Heights)
	}
	Windows.location=Url
}
function System_Win(Win_Name){
	if(window.name =! Win_Name){
		window.alert("一般性程序保护出错，你进行了不合法的操作！");
		window.close();
	}
}
function openWin(theURL,winName,width,height) {
	window.open(theURL,winName,'width='+width+',height='+height+',toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0');
}
function ViewPhoto(theURL) {
	var Width=screen.width-10;
	var Height=screen.height-30;
	window.open(theURL,'ViewPhoto','width='+Width+',height='+Height+',left=0,top=0,toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0');
}
function GoUrl(theURL,Windows){
	if (Windows == true){
		setTimeout("window.top.location='"+theURL+"';",3000);
	}else{
		setTimeout("window.location='"+theURL+"';",3000);
	}
}
//全选
function CheckAll(){
	for (var i=0;i<theForm.elements.length;i++){
		var e = theForm.elements[i];
		if (e.name != 'chkall')
		e.checked = theForm.chkall.checked;
	}
}
//设置字体大小
function fontZoom(size){
	document.getElementById('fontzoom').style.fontSize=size+'px'
}

//用户注册头像选择
function InsertFace(Path,File,Width,Height){
	self.opener.document.images['FaceImg'].src=Path+File;
//	self opener.document.theForm.Face.options[selectedIndex].value=File;
	self.opener.document.theForm.MyFace.value=Path+File;
	self.opener.document.theForm.MyFace_Width.value=Width;
	self.opener.document.theForm.MyFace_Height.value=Height;
//	window.close();
}
//检测用户注册帐号、邮箱合法性
function ChkUserName(Url){
	if (theForm.UserName.value == '' || theForm.UserEmail.value == ''){
		alert("请输入您注册的 [帐号] 与 [电子邮箱] ！");
		if (theForm.UserName.value == ''){
			theForm.UserName.focus();
		}else{
			theForm.UserEmail.focus();
		}
		return false;
	}else{
		if(Chk_Email(theForm.UserEmail.value)==false){
			alert("请您按正确的格式填写邮箱地址！");
			theForm.UserEmail.focus();
			theForm.UserEmail.select();
		}else{
			openWin(Url,'ChkUserName',420,250)
		}
	}
	return true;
}
function Change_State(Cue,Select_1,Select_2) {
	if (Cue == 1){
		Cue_China_1.style.display = 'none';
		Cue_China_2.style.display = 'block';
		Select_1.disabled = false;
		Select_2.disabled = false;
	}else{
		Cue_China_1.style.display = 'block';
		Cue_China_2.style.display = 'none';
		Select_1.disabled = true;
		Select_2.disabled = true;
	}
}
//检查email的合法性
function Chk_Email(Email){
	var i=Email.length;
	var temp  = Email.indexOf('@');
	var temp1 = Email.indexOf('.');
	if (temp > 1) {
		if ((i-temp) > 3){
			if ((i-temp1)>0){
				return true;
			}
		}
	}
	return false;
}
//用户更改籍贯、国家、职业、日本位置
function User_Update(){
	if (theForm.Province.options[theForm.Province.selectedIndex].value == ''){
		alert("请选择您的籍贯所属省份！");
		theForm.Province.focus();
		return false;
	}
	if (theForm.City.options[theForm.City.selectedIndex].value == ''){
		alert("请选择您的籍贯所属城市！");
		theForm.City.focus();
		return false;
	}
	if (theForm.Country.options[theForm.Country.selectedIndex].value == ''){
		alert("请选择您目前所处国家！");
		theForm.Country.focus();
		return false;
	}
	if (theForm.Occupation.options[theForm.Occupation.selectedIndex].value == ''){
		alert("请选择您目前身份！");
		theForm.Occupation.focus();
		return false;
	}
	if (theForm.Country.options[theForm.Country.selectedIndex].value == 2){
		if (theForm.O_Locus.options[theForm.O_Locus.selectedIndex].value == ''){
			alert("请选择您在日本所在位置区域！");
			theForm.O_Locus.focus();
			return false;
		}
		if (theForm.O_Seat.options[theForm.O_Seat.selectedIndex].value == ''){
			alert("请选择您在日本所在位置城市！");
			theForm.O_Seat.focus();
			return false;
		}
	}
	opener.document.theForm.Province.value=theForm.Province.options[theForm.Province.selectedIndex].value;
	opener.document.theForm.City.value=theForm.City.options[theForm.City.selectedIndex].value;
	if (theForm.Country.options[theForm.Country.selectedIndex].value == 1){
		opener.document.theForm.Country.value="中国";
		opener.document.theForm.O_Locus.value="";
		opener.document.theForm.O_Seat.value="";
	}else{
		opener.document.theForm.Country.value="日本";
		opener.document.theForm.O_Locus.value=theForm.O_Locus.options[theForm.O_Locus.selectedIndex].value;
		opener.document.theForm.O_Seat.value=theForm.O_Seat.options[theForm.O_Seat.selectedIndex].value;
	}
	opener.document.theForm.Occupation.value=theForm.Occupation.options[theForm.Occupation.selectedIndex].value;
	window.close();
}
//添加密码相册
function shareOnChange(Selects){
	if (Selects == 1){
		Passwords.style.display = "block"
		theForm.Password.focus();
	}else{
		Passwords.style.display = "none"
	}
}

//人力辞典
function China_Japan(UserName,Url){
	if (UserName == ""){
		alert('您当前还没有登陆或注册。\n\n请先完成登陆或注册，谢谢！');
		theForm.UserName.focus();
	}else{
		if(confirm(UserName+' 您确定发布需要翻译的内容吗？\n[YES/NO]')){
			if(Form_1.country[1].selected){
				Form_1.cn_jp.value="標準";
			}else{
				Form_1.cn_jp.value="标准";
			}
			Form_1.action=Url+"cn_jp/cn_jp_new.asp"
			Form_1.submit();
		}else{
			return false;
		}
	}
}

//滚动页面显示
function movstar(a,time,s_height){
	movx=setInterval("mov("+a+","+s_height+")",time)
}
function movover(){
	clearInterval(movx)
}
function mov(a,s_height){
	scrollx=Preview.document.body.scrollLeft
	scrolly=Preview.document.body.scrollTop
	scrolly=scrolly+a
	//window.status="scrolly:"+scrolly+",window.height:"+Preview.window.document.body.scrollHeight+",scrollbottom:"+Preview.document.body.scrollBottom;
	if (Preview.window.document.body.scrollHeight-scrolly<=s_height-2)
    scrolly = Preview.window.document.body.scrollHeight*2/3-s_height-2;
	if (scrolly <=0 )
	scrolly = Preview.window.document.body.scrollHeight*1/3;
	Preview.window.scroll(scrollx,scrolly)
}
function mover(src,dt){ 	 
	src.style.cursor = 'hand'; 
}
function mout(src,dt)  {	 
	src.style.cursor = 'default'; 
}

//显示/隐藏单元格
function Tbody_Display(Names,Url,ID){
	var Tbody = eval(Names + "_" + ID)
	if(Tbody.style.display == 'none'){
		Tbody.style.display = 'block';
		if (Names == "Reg"){
			//用户注册
			eval('Cue_'+ID).innerText='关闭';
		}else if(Names == "ManSortID"){
			//论坛版面分类
			eval('Arrowhead_'+ID).innerText='↑';
		}else{
			//论坛菜单转向地址
			//window.top.location=Url+'?'+Names+'='+ID
		}
	}else{
		Tbody.style.display = 'none';
		if (Names == "Reg"){
			//用户注册
			eval('Cue_'+ID).innerText='显示';
		}else if(Names == "ManSortID"){
			//论坛版面分类
			eval('Arrowhead_'+ID).innerText='↓';
		}else{
			//论坛菜单转向地址
			//window.top.location=Url+'?'+Names+'='+ID
		}
	}
}
function Show_Tbody(){
	if (theForm.Tbody.checked == true) {
		User_Q_A.style.display = "block";
	}else{
		User_Q_A.style.display = "none";
	}
}
//显示/隐藏论坛菜单
function SwitchLeft(T_ID){
	if (SwitchPoint.innerText == 3){
		SwitchPoint.innerText = 4
		if (T_ID == 2){
			document.all("Left_Tool").style.display="none"
		}
		document.all("Left_Toolbar").style.display="none"
	}else{
		SwitchPoint.innerText = 3
		if (T_ID == 2){
			document.all("Left_Tool").style.display="block"
		}
		document.all("Left_Toolbar").style.display="block"
	}
}
function ShowTitle(Retitle){
	if (document.theForm.ReplyTitle.checked == true)	{
		if (document.theForm.Title.value==''){
			document.theForm.Title.value=Retitle;
		}
		document.getElementById("Reply_Title").innerText="不采用";
	}else{
		if (document.theForm.Title.value==Retitle){
			document.theForm.Title.value='';
		}
		document.getElementById("Reply_Title").innerText="采用";
	}
}
//贴子操作选项
function Bbs_Work(SelDisable,DoWealth,DoUserCP,DoUserEP){
	//var SelDisable = 'disabled';
	//var DoWealth = Wealth;DoUserCP = UserCP;DoUserEP = UserEP;
	document.write ('<select name="DoWealth" size=1 '+SelDisable+'>');
	for (i=-50;i<51 ;i++ ){
		document.write ('<option value="'+i+'" ');
		if (DoWealth==i){
			document.write ('selected');
		}
		document.write ('>'+i+'</option>');
	}
	document.write ('</select>信用点 <input type="checkbox" name="CheckBox" value="CheckBox" onclick="Bbs_NoCent();" '+SelDisable+'>不对用户进行分值操作');
	document.write ('<input type="hidden" name="DoUserCP" value="0"><input type="hidden" name="DoUserEP" value="0">')
	//document.write (' <select name="DoUserCP" size=1 '+SelDisable+'>');
	//for (i=-50;i<51 ;i++ ){
	//	document.write ('<option value="'+i+'" ');
	//	if (DoUserCP==i){
	//		document.write ('selected');
	//	}
	//	document.write ('>'+i+'</option>');
	//}
	//document.write ('</select>魅力 <select name="DoUserEP" size=1 '+SelDisable+'>');
	//for (i=-50;i<51 ;i++ ){
	//	document.write ('<option value="'+i+'" ');
	//	if (DoUserEP==i){
	//		document.write ('selected');
	//	}
	//	document.write ('>'+i+'</option>');
	//}
	//document.write ('</select>经验');
}
function Bbs_NoCent(){
	if(document.theForm.DoWealth.disabled==true){
		document.theForm.DoWealth.disabled=false;
	//	document.theForm.DoUserCP.disabled=false;
	//	document.theForm.DoUserEP.disabled=false;
	}else{
		document.theForm.DoWealth.disabled=true;
	//	document.theForm.DoUserCP.disabled=true;
	//	document.theForm.DoUserEP.disabled=true;
	}
}
//预览贴子内容
function GoPreview(P_Title,P_Content){
	Preview.Title.value = P_Title;
	Preview.Body.value = P_Content;
	var popupWin = window.open('','Preview','left=0,top=0,scrollbars=yes,width=750,height=450');
	document.Preview.submit()
}
function UbbImg(o){
	var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}
function ViewCode(ReplyID){
	var bodyTag="<html><head><style type=text/css>.quote{margin:5px 20px;border:1px solid #CCCCCC;padding:5px; background:#F3F3F3 }\nbody{boder:0px}.HtmlCode{margin:5px 20px;border:1px solid #CCCCCC;padding:5px;background:#FDFDDF;font-size:14px;font-family:Tahoma;font-style : oblique;line-height : normal ;font-weight:bold;}\nbody{boder:0px}</style></head><BODY bgcolor=\"#FFFFFF\" >";
	bodyTag+=document.getElementById('scode'+ReplyID).CodeText.value
	bodyTag+="</body></html>"
	preWin=window.open('Preview','','left=0,top=0,width=550,height=400,resizable=1,scrollbars=1, status=1, toolbar=1, menubar=0');
	preWin.document.open();
	preWin.document.write(bodyTag);
	preWin.document.close();
	preWin.document.title="查看贴子内容";
	preWin.document.charset="UTF-8";
}
//发表贴子上传文件设定
function UploadFrame(Num){
	var obj = parent.document.getElementById("UpFile");
//	if (parseInt(obj.height) + Num >= 25) {
//		obj.height = parseInt(obj.height) + Num;
		document.getElementById("SetupLoad").style.display="block";
		document.getElementById("AllUpLoad").style.display="none";
//	}
}
//发表贴子上传文件个数设定
function SetID(Count){
	var str = '';
	if(!window.theForm.UpCount.value)
	window.theForm.UpCount.value = 1;
	if(window.theForm.UpCount.value > Count){
		alert("您最多只能同时上传"+Count+"个文件！");
		window.theForm.UpCount.value = Count;
		SetID();
	}else{
		for(i=1;i<=window.theForm.UpCount.value;i++)
		str += "文件"+i+":<input type='file' name='File"+i+"' size='22' class='input_2'><br>";
		window.UpID.innerHTML=str;
		var Num=(i-1)*25
		var obj=parent.document.getElementById("UpFile");
		if (parseInt(obj.height) + Num >= 25) {
			obj.height = Num;	
		}
	}
}
function KeyBoardif(){
	if(event.keyCode==13 && event.ctrlKey)theForm.submit();
}
//
function DoTitle(addTitle){  
	var revisedTitle;  
	var currentTitle = document.theForm.ToUser.value; 
	if(currentTitle=="") revisedTitle = addTitle; 
	else{ 
		var arr = currentTitle.split(","); 
		for (var i=0; i < arr.length; i++) { 
			if( addTitle.indexOf(arr[i]) >=0 && arr[i].length==addTitle.length ) return; 
		} 
		revisedTitle = currentTitle+","+addTitle; 
	} 
	document.theForm.ToUser.value=revisedTitle;  
	document.theForm.ToUser.focus(); 
	return; 
} 

//变色单元格
function navbarOver(src,clrOver,clrOverBorder) {
	if (!src.contains(event.fromElement)){
		src.style.cursor = 'hand';
		src.bgColor = clrOver; src.borderColor = clrOverBorder;
	}
}
function navbarOut(src,clrIn,clrInBorder) {
	if (!src.contains(event.toElement)) {
		src.style.cursor = 'default';
		src.bgColor = clrIn;
		src.borderColor = clrInBorder;
	}
}

//电子邮箱
function ContactEmail(IsBoard,IsText){
	var Email = "mailto:";
	Email += "info";
	Email += "@";
	Email += "seitsu.net";
	if(IsBoard == "Email"){
		document.write("<a style='font-size:12px;text-decoration:none;color:#008080' href='"+Email+"'>"+Email.replace("mailto:","")+"</a>");
	}else if(IsBoard == "None"){
		document.write("<a style='font-size:12px;text-decoration:none;color:#666666' href='"+Email+"'>联系方法</a>");
	}else if(IsBoard == "Other"){
		document.write("<a style='font-size:12px;text-decoration:none;color:#666666' href='"+Email+"'>"+IsText+"</a>");
	}else{
		return "<a style='font-size:12px;color:#666666' href='"+Email+"'>联系方法</a>";
	}
}


//***********默认设置定义.*********************
tPopWait=50;//停留tWait豪秒后显示提示。
tPopShow=5000;//显示tShow豪秒后关闭提示
showPopStep=20;
popOpacity=99;

//***************内部变量定义*****************
sPop=null;
curShow=null;
tFadeOut=null;
tFadeIn=null;
tFadeWaiting=null;

document.write("<style type='text/css' id='defaultPopStyle'>");
document.write(".cPopText {background-color: #F8F8F5; color:#000000; border: 1px #000000 solid; font-color: font-size: 12px; padding-right: 4px; padding-left: 4px; height: 18px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");
document.write("</style>");
document.write("<div id='dypopLayer' style='position:absolute; z-index:1000;' class='cPopText'></div>");

function showPopupText(){
	var o=event.srcElement;
	MouseX=event.x;
	MouseY=event.y;
	if(o.alt!=null && o.alt!=""){
		o.dypop=o.alt;
		o.alt="";
	}
	if(o.title!=null && o.title!=""){
		o.dypop=o.title;
		o.title="";
	}
	if(o.dypop!=sPop) {
		sPop=o.dypop;
		clearTimeout(curShow);
		clearTimeout(tFadeOut);
		clearTimeout(tFadeIn);
		clearTimeout(tFadeWaiting);	
		if(sPop==null || sPop=="") {
			dypopLayer.innerHTML="";
			dypopLayer.style.filter="Alpha()";
			dypopLayer.filters.Alpha.opacity=0;	
			}
		else {
			if(o.dyclass!=null) popStyle=o.dyclass 
				else popStyle="cPopText";
			curShow=setTimeout("showIt()",tPopWait);
		}
	}
}

function showIt(){
	dypopLayer.className=popStyle;
	dypopLayer.innerHTML=sPop;
	popWidth=dypopLayer.clientWidth;
	popHeight=dypopLayer.clientHeight;
	if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
		else popLeftAdjust=0;
	if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
		else popTopAdjust=0;
	dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
	dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
	dypopLayer.style.filter="Alpha(Opacity=0)";
	fadeOut();
}

function fadeOut(){
	if(dypopLayer.filters.Alpha.opacity<popOpacity) {
		dypopLayer.filters.Alpha.opacity+=showPopStep;
		tFadeOut=setTimeout("fadeOut()",1);
	}
	else {
		dypopLayer.filters.Alpha.opacity=popOpacity;
		tFadeWaiting=setTimeout("fadeIn()",tPopShow);
	}
}

function fadeIn(){
	if(dypopLayer.filters.Alpha.opacity>0) {
		dypopLayer.filters.Alpha.opacity-=1;
		tFadeIn=setTimeout("fadeIn()",1);
	}
}
document.onmouseover=showPopupText;