jQuery(document).ready(function($){

$(".menuheader").click(function() {$(this).next().slideToggle(300);return false;});

$('#tab-title span').mouseover(function(){
	$(this).addClass("current").siblings().removeClass();
	$("."+$(this).attr("id")).show().siblings().hide();
});

$('#shang').click(function(){$('html,body').animate({scrollTop: '0px'}, 800);});
$('#xia').click(function(){$('html,body').animate({scrollTop:$('#footer').offset().top}, 800);});
$('#comt').click(function(){$('html,body').animate({scrollTop:$('#comments').offset().top}, 800);});

$("#content a").mouseover(function(e){
	this.myTitle = this.title;
	this.myHref = this.href;
	this.myHref = (this.myHref.length > 30 ? this.myHref.toString().substring(0,30)+"..." : this.myHref);
	this.title = "";
	var tooltip = "<div id='tooltip'><p>"+this.myTitle+"<em>"+this.myHref+"</em>"+"</p></div>";
	$('body').append(tooltip);
	$('#tooltip').css({"opacity":"0","top":(e.pageY+20)+"px","left":(e.pageX+10)+"px"}).animate({opacity:"0.8"}, 500);
}).mouseout(function(){this.title = this.myTitle;$('#tooltip').remove();
}).mousemove(function(e){$('#tooltip').css({"top":(e.pageY+20)+"px","left":(e.pageX+10)+"px"});
});

$(".post-content a[href^=http://www.rayfile.com]").addClass("rayfile");
$(".post-content a[href$=.zip],.post-content a[href$=.7z],.post-content a[href$=.rar]").addClass("zip");
$(".post-content a[href$=.doc]").addClass("doc");
$(".post-content a[href$=.pdf]").addClass("pdf");
$(".post-content a[href$=.png]").addClass("png");

$('.vcard a').attr({ target: "_blank"});
$('a,input[type="submit"],object').bind('focus',function(){if(this.blur){ this.blur();}});

$('#close-sidebar a').toggle(function(){
	$(this).text("显示侧边栏")
	$('#sidebar').hide();
	$('#postlist,.post-home,#left-content-single').animate({width: "960px"}, 1000);
	},function(){
	$(this).text("关闭侧边栏")
	$('#sidebar').show();
	$('#postlist,.post-home,#left-content-single').animate({width: "705px"}, 800);
});

$(".nav li:not(#close-sidebar)").hover(function () {
	$(this).stop().animate({marginTop:"9px"}, 0);}
	,function () {
    $(this).stop().animate({marginTop:"0px"}, 150);
});

if($('input#author[value]').length>0){
$("#author_info").css('display','none');
var change='<span id="show_author_info" style="cursor: pointer; color:#2970A6;">[更改信息]</span>'; 
var close='<span id="hide_author_info" style="cursor: pointer;color: #2970A6;">[收起信息]</span>'; 
$('#welcome').append(change);
$('#welcome').append(close);
$('#hide_author_info').css('display','none');
$('#show_author_info').click(function() {
$('#author_info').slideDown('slow')
$('#show_author_info').css('display','none');
$('#hide_author_info').css('display','inline'); 
$('#hide_author_info').click(function() {
$('#author_info').slideUp('slow')
$('#hide_author_info').css('display','none');
$('#show_author_info').css('display','inline'); })})
};

}); 