function setFontSize(n)
{
	var elements = document.getElementsByTagName('blockquote');
	for (var i=0; i<elements.length; i++)
	{
		var element = elements[i];
		if (element.getAttribute('name') != 'content') continue;
		element.style.fontSize   = n + 'px';
		element.style.lineHeight = (8 + n) + 'px';
	}
}

//collapse or expand tablebody
function collapseTables(img)
{
	var tables = document.getElementsByTagName("table");
	if (img.src.indexOf('open') != -1)
	{
		img.src = img.src.replace('open', 'close');
		for (var i=0; i<tables.length; i++)
		{
			if (tables[i].name != 'loopedreplies') continue;
			tables[i].style.display = 'none';
		}
	}
	else
	{
		img.src = img.src.replace('close', 'open');
		for (var i=0; i<tables.length; i++)
		{
			if (tables[i].name != 'loopedreplies') continue;
			tables[i].style.display = '';
		}
	}
}

function chkVote(topicid)
{
	var f = document.forms['vote'];
	var isvalid = false;
	for (i=0; i<f.voteitems.length; i++)
	{
		if (f.voteitems[i].checked)
		{
			isvalid = true;
			break;
		}
	}
	if (!isvalid)
	{
		alert('请至少选择一个投票项');
		return false;
	}
	f.action = location.href = 'topic_action.aspx?topicid=' + topicid + '&action=savevote';
	return true;
}

function operate(o, topicid)
{
	var i = o.options.selectedIndex;
	if (i > 0)
	{
		if (o.options[i].value=='delete')
		{
			location.href = 'topic_delete.aspx?topicid=' + topicid;
		}
		else if (o.options[i].value=='move')
		{
			location.href = 'topic_move.aspx?topicid=' + topicid;
		}
		else
		{
			if (confirm('确定要' + o.options[i].text + '吗？'))
			{
				location.href='topic_action.aspx?topicid=' + topicid + '&action=' + o.options[i].value;
			}
			else
			{
				o.options[0].selected = true;
			}
		}
	}
}
