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

(function(){function SetCookie(c_name,value,expiredays){var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+((expiredays==null)?"":";expires="+exdate.toGMTString())+";path=/";}window['RootCookies'] = {};window['RootCookies']['SetCookie'] = SetCookie;})();
$('.close-sidebar a').click(function(){RootCookies.SetCookie('show_sidebar', 'no', 7);$('.close-sidebar').hide();$('.show-sidebar').show();$('#sidebar').hide();$('#container').animate({width: "705px"}, 1000);});
$('.show-sidebar a').click(function(){RootCookies.SetCookie('show_sidebar', 'no', -1);$('.show-sidebar').hide();$('.close-sidebar').show();$('#container').animate({width: "960px"}, 800);$('#sidebar').delay(800).show(0);});

$('#to_author_info a').click(function(){$('#author_avatar').hide();$('#author_info').fadeIn();});

$('.post-title').click(function(){if($(this).next().is(':visible')){$(this).children().children().text('页面载入中……');window.location = $(this).children().children().attr('href');}else{	$(".post-content").slideUp(300);$(this).next().slideDown(300);}return false;});
$(".post-content:first").show(0);

$("#tab-content ul li a,.post-title h2 a,.more-link").hover(function () {$(this).stop().animate({marginLeft:"+=8"}, 250);},function () {$(this).stop().animate({marginLeft:"0"}, 150);});
$(".more-link").hover(function () {$(this).stop().animate({right:"12"}, 250);},function () {$(this).stop().animate({right:"20"}, 150);});
$('#tab-title span').click(function(){$(this).addClass("selected").siblings().removeClass();$("#tab-content > ul").slideUp('1500').eq($('#tab-title span').index(this)).slideDown('1500');});
$("#menu .nav li:not(#close-sidebar)").hover(function(){$(this).stop().animate({paddingTop:"+=6"}, 240);},function(){$(this).stop().animate({paddingTop:"0"}, 120);});

$body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body');
$body.dblclick(function(){$('#container').fadeTo("0", 0.4, function(){$body.animate({scrollTop: 0},400, function(){$('#container').fadeTo("100", 1);});});});
$('#container').dblclick(function(e){e.stopPropagation();});
$('#shang').click(function(){$body.animate({scrollTop: '0px'}, 400);});
$('#xia').click(function(){$body.animate({scrollTop:$('#footer').offset().top}, 400);});
$('#comt').click(function(){$body.animate({scrollTop:$('#comments').offset().top}, 400);});

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

$("#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();}});

});