function findObj(n,d){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=findObj(n,d.layers[i].document);if(!x && d.getElementById) x=d.getElementById(n); return x;}
function validateForm(){var i,p,q,nm,test,num,min,max,errors='',args=validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=findObj(args[i]);
if(val) { nm=args[i+1]; if ((val=val.value)!="") {
if(test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if(p<1 || p==(val.length-1)) errors+='- '+nm+' 必须使用正确的邮件地址.\n';
}else if(test!='R'){num = parseFloat(val);
if(isNaN(val))errors+='- '+nm+' 必须是一个数字.\n';
}}else if (test.charAt(0) == 'R') errors += '- '+nm+' 是必填项.\n'; }
}if(errors){alert('请检查以下错误信息:\n'+errors);
return false;}}
function chknm(nmv){if(nmv.length<5)alert("用户名至少5位字符")}

function chkpw(){if(document.forms[0].password.value.length<6){alert("密码至少为6位字符");}
if(document.forms[0].password.value!=document.forms[0].cpassword.value){alert("两次输入的密码不一致");}}
function showitem(id){
	ido=findObj(id);
	if(ido.className=="hide"){
		ido.className="show";
	}else{
		ido.className="hide";
	}
}
function showcode() {
	var imgcode = findObj('xspace-imgseccode');
	if(imgcode) {
		newseccode(imgcode);
	}
}
function newseccode(obj) {
	obj.src=siteUrl+'/batch.seccode.php?'+Math.random(1);
}
var popUpWin=0;

function popUpWindow(URLStr, left, top, width, height)
{if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function focusto(id,blur){
	obj=findObj(id);
	try{obj.focus();
	}catch(e){}
	if(blur){
	try{
	obj.blur();
	}catch(e){}
	}	
}