function setFontSize(uid, n)
{	
	var element = document.getElementById(uid);
	var defaultSize = 14;
	var defaultLineheight = 20;
	var currentSize = "",cSize = 0;currentLineheight = "";cLineheight = 0;
	if(null != element)
	{
		currentSize = element.style.fontSize;
		defaultLineheight = element.style.lineHeight;
		cSize = parseInt(currentSize.replace("px",""));
		cLineheight = parseInt(defaultLineheight.replace("px",""));
		if(0 == n)
		{
			cSize = cSize - 2;
			cLineheight = cLineheight - 2;
		}
		else if(1 == n)
		{
			cSize = cSize + 2;
			cLineheight = cLineheight + 2;		
		}
		if(cSize > 6 && cSize<50){
			try
			{
				element.style.fontSize = cSize + "px";
				element.style.lineHeight = cLineheight + "px";	
			}
			catch(e)
			{
				element.style.fontSize = defaultSize + "px";
				element.style.lineHeight = defaultLineheight + "px";	
			}
		}
	}
	else
	{
		return;
	}	
}

///URL操作页面（含参数),Target:操作结果显示区域.
function AddItem(URL,Target)
{	
	var dvajax = new DvAjax();
	try
	{
		var resultobj  = dvajax.Request('get',URL,'',null,true);
		var resultdata = resultobj.responseText;
		//alert(resultdata + "\n\n" + MsgMatch(resultdata)); $("s").innerHTML=resultdata;
		if(resultdata.indexOf('Success1')!=-1)
		{
			DisResult('您的收藏项目数量已经达到系统允许最大数!',Target);
			setTimeout("UnDis('"+Target+"')",2000);
		}
		else if(resultdata.indexOf('Success2')!=-1)
		{
			DisResult("您已经收藏该项了",Target);
			setTimeout("UnDis('"+Target+"')",2000);
		}
		else if(resultdata.indexOf('Success3')!=-1)
		{
			DisResult('成功收藏该项到您的收藏夹',Target);
            setTimeout("UnDis('"+Target+"')",2000);
		}
		else
		{
			DisResult('收藏失败，请检查您是否登录？',Target);
			setTimeout("UnDis('"+Target+"')",2000);
		}
	}
	finally
	{
		if(dvajax!=null)
		{
			dvajax.Dispose();
			dvajax = null;
		}
	}
}
///区域显示
function DisResult(message,Target)
{
  $(Target).style.display='';
  $(Target).innerHTML=message;
}
///隐藏显示
function UnDis(Target)
{
  $(Target).innerHTML='';
  $(Target).style.display='none';
}
//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 = '';
		}
	}
}
/* disabled by Xu
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,boardid, url)
{//alert();
	var i = o.options.selectedIndex;
	if (i > 0)
	{
		if (o.options[i].value=='delete')
		{
			location.href = url + 'topic_delete.aspx?topicid=' + topicid;
		}
		else if (o.options[i].value == 'top')
		{
			location.href = url + 'topic_SetTopTime.aspx?action=top&topicid=' + topicid;
		}
		else if (o.options[i].value =='topall')
		{
			location.href = url + 'topic_SetTopTime.aspx?action=topall&topicid=' + topicid;
		}
		else if (o.options[i].value=='move')
		{
			location.href = url + 'topic_move.aspx?topicid=' + topicid;
		}
		else
		{
			if (confirm('确定要' + o.options[i].text + '吗？'))
			{
				location.href= url + 'topic_action.aspx?topicid=' + topicid + '&action=' + o.options[i].value;
			}
			else
			{
				o.options[0].selected = true;
			}
		}
	}
}
