/****	去除空格	***/
String.prototype.trim = function() {  
	return this.replace(/^\s+/, '').replace(/\s+$/, '');   
} 


/***	输出火标记	**/
function outHotTag(threadsId){
	$.ajax({
			type :"post",// 传送数据方式
			dataType :"json",// 返回的数据格式
			url :"/ajax/getHotTag.htm",// 请求的地址
			data :"threadId="+threadsId,// 发送的数据
			success :function(msg){
				if(msg.isShow==1)
					$("#tag1_"+threadsId).html('<img src="/template/default/images/icon/hot.gif" title="热点帖子" alt="热点帖子"/>');
			}
	});
}

/***	新帖	****/
function outNewTag(threadsId){
	$.ajax({
			type :"post",// 传送数据方式
			dataType :"json",// 返回的数据格式
			url :"/ajax/getNewTag.htm",// 请求的地址
			data :"threadId="+threadsId,// 发送的数据
			success :function(msg){
				if(msg.newShow==1)
					$("#tag2_"+threadsId).html('<img src="/template/default/images/icon/new.gif" title="新发表帖子" alt="新发表帖子" />');
			}
	});
}




/****	输出图标	****/
function outPhotoTag(threadsId){
		$.ajax({
			type :"post",// 传送数据方式
			dataType :"json",// 返回的数据格式
			url :"/ajax/getPhotoTag.htm",// 请求的地址
			data :"threadId="+threadsId,// 发送的数据
			success :function(msg){
				if(msg.photoShow==1)
					$("#tag3_"+threadsId).html('<img src="/template/default/images/icon/haveImg.gif" title="带图片的帖子" alt="带图片的帖子" />');
			}
	});
}

/***	获取随机数字	***/
function getRandom(){
	var random='';
	$.ajax({
			type :"post",// 传送数据方式
			async: false, //同步读取
			dataType :"json",// 返回的数据格式
			url :"/ajax/getRandomNum.htm",// 请求的地址
			success :function(msg){
				random=msg.random;			
			}
	});
	return random;
}


/****	复制链接 		***/
function copyUrl(){
	window.clipboardData.setData('text',document.URL); 
}


/****	get Topic content	****/
function getTopicContent(id,did){
		$.ajax({
			type :"post",// 传送数据方式
			dataType :"json",// 返回的数据格式
			url :"/ajax/getTopicContent.htm",// 请求的地址
			data :"id="+id+"&rondnum="+Math.random()*10000+Math.random(),// 发送的数据
			success :function(msg){		
				var content = msg.content;
				var username = msg.username;
				var html = [];
				html.push("<div style='background-color:rgb(241,246,251);line-height:25px;margin:10px 10px 20px 20px;padding:8px;font-size: 14px'>");
				html.push('引用:')
				html.push(username);
				html.push('<div style="margin-left:10px;color:#808080;"> “ '+content+' ” </div>');
				html.push('</div>'); 
				$('#'+did).html(html.join(""));
			}
	});
}


