//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");
});

//External Link
$("div.article-body a").each(function(){$(this).attr("href").toLowerCase().indexOf(str00) == -1?$(this).addClass("external"):null;});

//catalog feed-icon
$("#divCatalog li").each(function(){$(this).text().indexOf(blogTitle)!==-1?$(this).addClass("CurrCate"):null;});

//archives
var almax=4;
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();}});
}

// Image
$("div.article-body img").each(function(){ResizeImageDeep(this,520);});

//.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);
});
