﻿var canSub = true;
function o(o){
 var o=document.getElementById(o)?document.getElementById(o):o;
 return o;
}

function loadakuncomment(id,page){
	var URL = "/plus/akun_comment.php?"+Math.random();
	var pars = 'aid=' + id + '&page='+page;
	new Ajax.Updater(
		{success: 'comm_content'},
		URL, {method: "get",parameters:pars}
	);	
}

function postakuncomment(){
	var notuser = o('notuser').checked ? 1 : 0;
	var opt = {
		method: 'post',
		asynchronous: true, //是否异步
		encoding:   'UTF-8',
		postBody: 'action=send&aid='+o('aid').value
			+'&notuser='+ notuser +'&isconfirm=1&msg='+ o('msg').value
			+'&username=' + o('username').value + '&validate='+o('validate').value
			+'&pwd=' + o('pwd').value,
		onSuccess: function(t) {
			$('ajaxBackMsg').update(t.responseText);
			loadakuncomment($('aid').value,1);
			canSub = true;
			o('msg').value = '';
			o('username').value = '';
			o('validate').value = '';
			o('code_pic').src = '/include/vdimgck.php?'+Math.random();
		},
		on404: function(t) {o('ajaxBackMsg').update('服务器错误，请稍后再试！')},
		onFailure: function(t) {o('ajaxBackMsg').update('提交失败，请稍后再试！')}
	};
	new Ajax.Request("/plus/akun_commentsave.php", opt);
}
