//表格TR变色
function SetTableHover()
{
	$(".TableHoverTab tr").mouseover(function(){$(this).addClass("Altrow");}).mouseout(function(){$(this).removeClass("Altrow");});
}

//显示隐藏主题
function TopicShow(e,TopicID)
{
	e.className=(e.className=="BttnC")?"BttnE":"BttnC";
	$('#'+TopicID).slideToggle('slow');
	//document.getElementById(TopicID).style.display=(e.className=="BttnC")?"":"none";
}

//字体类型变化
function ChangeFamily(family)
{
	document.getElementById('Content_Body').style.fontFamily=family;
}
//字体大小变化
var wordpt=11;
var linept=16;
function ChangeFont(type)
{
	
	if(type == 0)
	{
		if(wordpt > 8)
		{
			wordpt=wordpt-1;
			linept=linept-1
		}
	}
	else
	{
		if(wordpt < 36)
		{
			wordpt=wordpt+1;
			linept=linept+1;
		}
	}
	var temp = eval(wordpt);
	temp = temp + "px";
	document.getElementById('Content_Body').style.fontSize=temp;
	
	temp=eval(linept)
	temp = temp + "px";
	document.getElementById('Content_Body').style.lineHeight=temp;
	
}

//退出登陆
function LogOut()
{
	if(confirm('你确认要退出登陆吗？'))
	{
		$('#logout_form').submit();
	}
}

//显示日历
function ShowCalendar(year,month)
{
	$('#Side_Calendar').html('<div style="text-align:left;margin-left:15px;"><img src="images/loading.gif"> 数据加载中...</div>');
	$.ajax({
		url: "ajax.php?year="+year+"&month="+month+"&ajax_action=ShowCalendar",
		type:"get",
		dataType:"html",
		success:function(msg){
			//alert(msg);
			$("#Side_Calendar").html(msg);
		},
		error:function(msg){
			$("#Side_Calendar").html("Ajax错误状态码: "+msg.status);
		}
	});
}

//显示网站统计信息
function ShowStatistics()
{
	$('#Side_Statistics').html('<div style="text-align:left;margin-left:15px;"><img src="images/loading.gif"> 数据加载中...</div>');
	$.ajax({
		url: "ajax.php",
		type:"post",
		dataType:"html",
		data: "ajax_action=ShowStatistics",
		success:function(msg){
			$("#Side_Statistics").html(msg);
		},
		error:function(msg){
			$("#Side_Statistics").html("Ajax错误状态码: "+msg.status);
		}
	});
}

//显示相关的内容
function ShowRelatedContent(id,cat_mode)
{
	$("#RelatedContent").html('<img src="images/loading.gif"> 数据加载中...');
	$.ajax({ 
		url: "ajax.php",
		type:"post",
		dataType:"html",
		data: "id="+id+"&cat_mode="+cat_mode+"&ajax_action=ShowRelatedContent",
		success:function(msg){
			$("#RelatedContent").html(msg);
		},
		error:function(msg){
			$("#RelatedContent").html("Ajax错误状态码: "+msg.status);
		}
	});
}

//显示评论内容
function ShowComment(cat_id,content_id)
{
	$('#comment_show').html('<div style="text-align:left;margin-left:15px;"><img src="images/loading.gif"> 数据加载中...</div>');
	$.ajax({
		url: 'ajax.php?cat_id='+cat_id+'&id='+content_id+'&ajax_action=ShowComment',
		type:"get",
		dataType:"html",
		success:function(msg){
			$("#comment_show").html(msg);
		},
		error:function(msg){
			$("#comment_show").html("Ajax错误状态码: "+msg.status);
		}
	});
}

//AJAX分页时的内容调用函数
function LoadPage(url)
{
	$('#comment_show').html('<div style="text-align:left;margin-left:15px;"><img src="images/loading.gif"> 数据加载中...</div>');
	$.ajax({
		url: url,
		type:"get",
		dataType:"html",
		success:function(msg){
			$("#comment_show").html(msg);
		},
		error:function(msg){
			$("#comment_show").html("Ajax错误状态码: "+msg.status);
		}
	});
}


//脚本永不出错，在作品完成的时候使用，调试时暂时不用！！
function killErrors()
{
	return true;
}
//window.onerror = killErrors;

$(document).ready(function(){
	$('#menu').corner();
	$('#sub_menu').corner();
	$('#foot').corner();
});