//打开修改对话框
function changepassword () {
	$.post(siteurl+'member/index.php', {ac:"myset",op:"changepw",in_ajax:1}, 
		function(result) {
		if (result.match(/<form.+method="post".+>/)) {
			result += '<iframe style="display:none" src="" name="ifchangepassword" id="ifchangepassword"></iframe>';
			myDialog('修改密码',result, 300, 190);
		} else {
			myAlert(result);
		}
	});
}
//提交修改
function post_changepassword() {
	var form = document.changepasswordfrm;
	if(form.old_pw.value.trim() == '') {
		alert('未输入原密码。');
		return false;
	} else if(form.new_pw.value.trim() == '') {
		alert('未输入新密码。');
		return false;
	} else if(form.new_pw.value.trim() != form.new_pw2.value.trim()) {
		alert('2次输入的密码不一致。');
		return false;
	}

	return true;
}
//提交改变头像
function post_changeface() {
	var form = document.changefacefrm;
	var faceid = getRadio(form, 'faceid');
	if(!faceid) {
		alert('未选择头像。');
		return false;
	}
	$.post(siteurl+'member/index.php', {ac:"face",op:"change",in_ajax:1,faceid:faceid}, function(result) {
		if(result.match(/<input.+type="button".*>/)) {
			myAlert(result);
		} else if(result.trim() == '') {
			alert('头像修改失败。');
		} else {
			$("#face").attr("src",result);
		}
	});
	return false;
}
//浏览
function viewFacePage(num) {
    num = num != 1 ? -1 : 1;
    var p = face_page + num;
    if(p > max_face_page) {
        alert('已经没有下一页。');
        return;
    } else if(p < 1) {
        alert('貌似走的不到第0页。');
        return;
    }
    face_page = p;
	$.post(siteurl+'member/index.php', {ac:"face",op:"browse",in_ajax:1,page:face_page}, function(result) {
		if (result.match(/<li>.*<\/li>/)) {
			$("#select_facelist").html( result );
		} else {
			myAlert(result);
		}
	});
}