//JQ 重构, 学习于 log.7thpark.com
$(document).ready(function(){

//comments
$("body.multi h6.article-info span.cmtnum").each(function(){
	$(this).text()=="0"?$(this).html("暂时没有评论"):parseInt($(this).text())<10?$(this).html("才有"+$(this).text()+"条"):parseInt($(this).text())<30?$(this).html("已有"+$(this).text()+"条"):$(this).html("已多达"+$(this).text()+"条");
	$(this).parent("span.cmtcontainer").hover(function(){$(this).children(".cmtadd").html(" <a href=\""+$(this).parent(".article-info").parent(".article-right").children(".article-title").children("a").attr("href")+"#comment\">添加新评论<\/a>").css("display","none").fadeIn("fast")},function(){$(this).children(".cmtadd").fadeOut("fast",function(){$(this).html("");});});
	$(this).parent("span.cmtcontainer").css("cursor","pointer");
});
$("body.single h6.article-info span.cmtnum").each(function(){
	$(this).text()=="0"?$(this).html("暂时没有评论"):parseInt($(this).text())<10?$(this).html("才有"+$(this).text()+"条"):parseInt($(this).text())<30?$(this).html("已有"+$(this).text()+"条"):$(this).html("已多达"+$(this).text()+"条");
	$(this).parent("span.cmtcontainer").hover(function(){$(this).children(".cmtadd").html(" <a href=\"#comment\">添加新评论<\/a>").css("display","none").fadeIn("fast")},function(){$(this).children(".cmtadd").fadeOut("fast",function(){$(this).html("");});});
	$(this).parent("span.cmtcontainer").css("cursor","pointer");
});

//Ajax Content
$("body.multi div.openContent").each(function(){
	$(this).css("display","block");
});

//catalog feed-icon
$("#divCatalog li").each(function(){$(this).text().indexOf(blogTitle)!==-1?$(this).addClass("CurrCate"):null;});

/*
//archives 7thpark.com 原始版本修订 - 隐藏多于两年的
var almax=4; //一直显示的行数, 4 表示 两年, 6 表示三年, 类推.
var alsize=$("#divArchives p").size();
if(alsize>almax){
	for(i=almax;i<alsize;i++){
		$("#divArchives p").eq(i).slideUp();
	}
	$("#divArchives").hover(function(){for(j=almax;j<alsize;j++){$("#divArchives p").eq(j).slideDown();}},function(){for(k=almax;k<alsize;k++){$("#divArchives p").eq(k).slideUp();}});
}
*/
/*
//archives Alt 第二个效果版本 - 隐藏全部月份, 点击任一年全开.
var archsize=$("#divArchives p").size();
for(i=0;i<(parseInt(archsize/2));i++){
	$("#divArchives p").eq(2*i).css("cursor","pointer").addClass("arch-year");
	$("#divArchives p").eq(2*i+1).addClass("arch-month").toggle("normal");
}
$("#divArchives p.arch-year").click(function(){
	$("#divArchives p.arch-month").toggle("normal");
});
*/

//archives Alt  第三个效果版本 - 隐藏除最近一年以外的月份, 点击年打开当年月份.
for(i=0;i<(parseInt($("#divArchives p").size()/2));i++){
	$("#divArchives p").eq(2*i).css("cursor","pointer").addClass("arch-year").attr("id","arch-item"+i);
	$("#divArchives p").eq(2*i+1).addClass("arch-month").attr("id","altarch-item"+i);
	if (i>0){$("#divArchives p").eq(2*i+1).toggle("normal");}
}
$("#divArchives p.arch-year").each(function(){
	$(this).click(function(){
		$(this).parent("div").children("p#alt"+$(this).attr("id")).toggle("normal");
	});
});


// Image And External Link
$("div.article-body img").each(function(){ResizeImageDeep(this,520);});
$("div.article-body a").each(function(){$(this).attr("href").toLowerCase().indexOf(str00) == -1?$(this).addClass("external"):null;});

//.text
$(".text").focus(function(){$(this).addClass("text-focus");}).blur(function(){$(this).removeClass("text-focus");});

//:hover fix for IE6
$("ul.msg").hover(function(){$(this).addClass("box-hover");},function(){$(this).removeClass("box-hover");});
$("ul.ext").hover(function(){$(this).addClass("box-hover");},function(){$(this).removeClass("box-hover");});
$("div.pstwrap").hover(function(){$(this).addClass("box-hover");},function(){$(this).removeClass("box-hover");});
$("div.article-nav").hover(function(){$(this).addClass("box-hover");},function(){$(this).removeClass("box-hover");});

//Tab Roll
if (intTabInterval=="<#TEMPLATE_INCLUDE_CN_TABINTERVAL#>"){intTabInterval=8864;}
if (parseInt(intTabInterval)<999){intTabInterval=8864;}
setInterval("tabRoll()", intTabInterval);
});