function doSuccess(res){
    if(res==null){
    	alert('出错了，请刷新页面重新尝试！');
		return;
    }
    if(typeof res.not_login!='undefined' && res.not_login){
    	top.location.href	= res.not_login;
    }
    finishEdit();
    clearErrors('div', 'tips');
    var l		= 0;
    if(typeof res.errs!='undefined'){
    	l	= res.errs.length;
    	for(var name in res.errs){
    		//alert(name);
    		setError(name+"_info",res.errs[name]);
    	}
    }
    if(l==0){
    	if(typeof successFun!='undefined'){
    		successFun(res);
    	}
    }
}

function clearErrors(tagName,etype){
	var arr		= document.getElementsByTagName(tagName);
	for(var i=0,l = arr.length;i<l;i++){
		var	e	= arr[i];
		if(typeof e.etype!=undefined && e.etype==etype){
			$(e).addClass('none');
		}
	}
}

function setError(name,msg){
	if($('#'+name).is('div')){
		if($('#'+name).html()==''){
			$('#'+name).html(msg);
		}
		$('#'+name).removeClass('none');
	}
}

function doError(res){
	finishEdit();
	alert(res.responseText);
}

function doingEdit(){
	if($('#tipsBox').is('div')){
		$('#tipsBox').removeClass('none');
	}
	$('#btnSave').attr('disabled',true);
}

function finishEdit(){
	if($('#tipsBox').is('div')){
		$('#tipsBox').addClass('none');
	}
	$('#btnSave').attr('disabled',false);
}