function modaction(action, pid, extra, mod) {
	if(!action) {
		return;
	}
	var mod = mod ? mod : 'admin_batch.asp?mod=topicadmin';
	var extra = !extra ? '' : '&' + extra;
	if(!pid && in_array(action, ['delpost', 'banpost'])) {
		var checked = 0;
		var pid = '';
		for(var i = 0; i < document.getElementById('modactions').elements.length; i++) {
			if(document.getElementById('modactions').elements[i].name.match('topiclist')) {
				checked = 1;
				break;
			}
		}
	} else {
		var checked = 1;
	}
	if(!checked) {
		alert('请选择需要操作的帖子');
	} else {
		document.getElementById('modactions').action = mod + '&action='+ action +'&fid=' + fid + '&tid=' + tid + '&handlekey=mods&infloat=yes&nopost=yes' + (!pid ? '' : '&topiclist[]=' + pid) + extra + '&r' + Math.random();
		showWindow('mods', 'modactions', 'post');
		if(BROWSER.ie) {
			doane(event);
		}
		hideMenu();
	}
}

function modthreads(optgroup, operation) {
	var operation = !operation ? '' : operation;
	document.getElementById('modactions').action = 'admin_batch.asp?mod=topicadmin&action=moderate&fid=' + fid + '&moderate[]=' + tid + '&handlekey=mods&infloat=yes&nopost=yes' + (optgroup != 3 && optgroup != 2 ? '&from=' + tid : '');
	document.getElementById('modactions').optgroup.value = optgroup;
	document.getElementById('modactions').operation.value = operation;
	hideWindow('mods');
	showWindow('mods', 'modactions', 'post', 0);
	if(BROWSER.ie) {
		doane(event);
	}
}

function pidchecked(obj) {
	if(obj.checked) {
		if(BROWSER.ie && !BROWSER.opera) {
			var inp = document.createElement('<input name="topiclist[]" />');
		} else {
			var inp = document.createElement('input');
			inp.name = 'topiclist[]';
		}
		inp.id = 'topiclist_' + obj.value;
		inp.value = obj.value;
		inp.type = 'hidden';
		document.getElementById('modactions').appendChild(inp);
	} else {
		document.getElementById('modactions').removeChild(document.getElementById('topiclist_' + obj.value));
	}
}

var modclickcount = 0;
function modclick(obj, pid) {
	if(obj.checked) {
		modclickcount++;
	} else {
		modclickcount--;
	}
	document.getElementById('mdct').innerHTML = modclickcount;
	if(modclickcount > 0) {
		var offset = fetchOffset(obj);
		document.getElementById('mdly').style.top = offset['top'] - 65 + 'px';
		document.getElementById('mdly').style.left = offset['left'] - 215 + 'px';
		document.getElementById('mdly').style.display = '';
	} else {
		document.getElementById('mdly').style.display = 'none';
	}
}

function resetmodcount() {
	modclickcount = 0;
	document.getElementById('mdly').style.display = 'none';
}

function tmodclick(obj) {
	if(obj.checked) {
		modclickcount++;
	} else {
		modclickcount--;
	}
	document.getElementById('mdct').innerHTML = modclickcount;
	if(modclickcount > 0) {
		var top_offset = obj.offsetTop;
		while((obj = obj.offsetParent).id != 'threadlist') {
			top_offset += obj.offsetTop;
		}
		document.getElementById('mdly').style.top = top_offset - 7 + 'px';
		document.getElementById('mdly').style.display = '';
	} else {
		document.getElementById('mdly').style.display = 'none';
	}
}

function tmodthreads(optgroup, operation) {
	var checked = 0;
	var operation = !operation ? '' : operation;
	for(var i = 0; i < document.getElementById('moderate').elements.length; i++) {
		if(document.getElementById('moderate').elements[i].name.match('moderate') && document.getElementById('moderate').elements[i].checked) {
			checked = 1;
			break;
		}
	}
	if(!checked) {
		alert('请选择需要操作的帖子');
	} else {
		document.getElementById('moderate').optgroup.value = optgroup;
		document.getElementById('moderate').operation.value = operation;
		showWindow('mods', 'moderate', 'post');
	}
}

function hstbbspost(operation) {
	var operation = !operation ? '' : operation;	
	document.getElementById('moderate').operation.value = operation;
	showWindow('mods', 'moderate', 'post');
}

function hstbbspostlist(operation,announceid) {
	var operation = !operation ? '' : operation;	
	document.getElementById('bbslist').operation.value = operation;
	document.getElementById('bbslist').announceid.value = announceid;
	if(operation=='plus'){document.getElementById('bbslist').action='plus_Tools_InfoSetting.asp?action=0';}
	if(operation=='report'){document.getElementById('bbslist').action='TopicOther.asp?t=6&amp;BoardID=68&amp;id=10255&amp;ReplyID=32727';}
	showWindow('mods', 'bbslist', 'post');
}



loadcss('forum_moderator');