    String.prototype.trim = function(){
		return this.replace(/(^\s*)|(\s*$)/g, "");
	}
	function getarg(){
		var url = document.location.href;
		var sid=url.substring(url.indexOf("?")+1).trim();
		var reg=/^[0-9]{1,}$/;
		if(reg.test(sid)){
			return parseInt(sid);
		}else{
			return DiguoServers[0][2];
		}
	}
	function changeCode(){
	if(hasCode){
		var img = document.getElementById('codeImg');
		var d = new Date(); 
		var param=d.getHours()+""+d.getMinutes()+""+d.getSeconds();
		img.src="http://gc.imop.com/com/randimg/img.php?t="+param;
		}
	}
	function getSerName(id,sers){
		var turl=sers[0][4];
		var tname=sers[0][3];
		for(i=0;i<sers.length;i++){
			if(sers[i][2]==id){
				turl=sers[i][4];
				tname=sers[i][3];
			}
		}
		document.getElementById('sername').value=tname;
		document.title+=tname+" - "+turl;
		//document.getElementById('gurl').value=turl;
		return tname;
	}
	function check_login(){
		var obj_username=document.getElementById('username');
		var username=obj_username.value.trim();
		var obj_password=document.getElementById('password');
		var password=obj_password.value.trim();
		var authCode="";
		var validate=document.getElementById('validate');
		validate=validate.value.trim();
		if(username==''){
			alert(noName);
			obj_username.focus();
			return;
		}
		if(password==''){
			alert(noPass);
			obj_password.focus();
			return;
		}
		if(hasCode){
			var obj_code=document.getElementById('code')
			authCode=obj_code.value.trim();
		if(authCode==''){
			alert(noCode);
			obj_code.focus();
			return;
		}}
		$.ajax({
			type: "post",
			url:"login.do",
			data: {un:username,pwd:password,authCode:authCode,validate:validate},
			dataType:"json",
			success: function(json){
			try{
				if(json.success){
					window.location.href=json.message;
					return;
				}else{
					alert(json.message);
					changeCode();
				}
				}catch(e){
					changeCode();
					
				}
			}
		});

		return;
	}
var hasCode=false;
	function setCode(f){
		if(f=="1"){
			hasCode=true;
			changeCode();
			document.getElementById("TR_code").style.display="";
		}
	}

