//显示、隐藏评级内容显示
function switchShow(B,A,post,imageUrl)
{	
	if (jQuery(A).css("display") == "none") {
		
		jQuery(A).slideDown("slow", 
        function() {
			jQuery(B).addClass("close");
        });
		$(post).val("1");
		jQuery(B).html("隐藏评级");
	}
	else {
		jQuery(A).slideUp("slow", 
        function() {
			jQuery(B).removeClass("close");
        });
		$(post).val("0");
		clearRating(imageUrl);//清除用户选择的评级
		jQuery(B).html("显示评级");
		
	}
}

function clearRating(imageUrl)
{
	if(document.getElementById('review_option_nums'))
	{	
		$('#post-reply .review_option_value').val("");
		num = $('#post-reply #review_option_nums').val();
		for(i = 0; i < num ;i++)
		{
			$('#option'+i+'Text').html("");
			for(j = 1;j <= 5 ; j++)
			{
				$('#review_option_value'+i+'_'+j).attr('src',imageUrl);
			}
		}
		$('#reviewoptionsMsg .errorMsg').html("");
	}
	else
	{
		$('#post-reply #overall_rating').val("");
		$('#optionText').html("");
		for(j = 1; j <= 5 ;j++)
		{
			$('#overall_rating_'+j).attr('src',imageUrl);
		}
		$('#overallratingMsg').html("");	
		
	}
}


//用户删除自已发布的话题
var user = null || {
	delete_topic:function(topic_id){
		if(topic_id>0){
			$.ajax({
				type: 'POST',
				url: 'mana/del_topic.php',
				data: "topic_id="+topic_id+"&user=1",
				dataType:'text',
				success: function(msg){
					if(msg==1){
						document.location.reload();
					}else{
						alert('删除失败，请重试.');
					}
				}
			});
			return false;
		}
	}
}
//版主删除话题，及评论
var moderator = new Object();
//删除评论
moderator.del_reply = function(reply_id){
	if(reply_id>0){
		$.ajax({
			type: 'POST',
			url: 'mana/del_topic.php',
			data: "reply_id="+reply_id+"&m=1",
			dataType:'json',
			success: function(msg){
				if(msg>0){
					document.location.reload();
				}else{
					alert('删除失败，请重试.');
				}
			}
		});
		return false;
	}
}
//删除评论的回复
moderator.del_reply_comment = function(reply_id){
	if(reply_id>0){
		$.ajax({
			type: 'POST',
			url: 'mana/del_topic.php',
			data: "reply_id="+reply_id+"&m=2",
			dataType:'json',
			success: function(msg){
				if(msg>0){
					$('#commentbox_'+msg).remove();			
				}else{		
					alert('删除失败，请重试.');
				}
			}
		});
		return false;
	}
}

