﻿function f() {
	msg("");
	$.ajax({type: "post",url: "AjaxFavorite.aspx",error: function(){msg('网络看来不大好，获取书架时出错了，请在本页面重新载入书架，或者直接进入书架页面。<br /><input onclick=\"javascript:f();\" type=\"button\" value=\"重新载入书架\" />');},datatype:"html",timeout: 10000, success: function(data){$('#favorite').html(data);c();e('#FavTab td.u');}});
	c();
}

function msg(str) {
	str=(str=="")?"正在载入书架……<br />":str;
	$('#favorite').html("<div align=\"center\">"+str+"<input type=\"button\" value=\"直接进入我的书架\" onclick=\"javascript:location.href='Favorite.aspx';\"/></div>");
}

function c() {
	$('tr.b').bind('mouseenter',function () {
		$(this).css('backgroundColor','#f9f9dd');
	});
	$('tr.b').bind('mouseleave',function () {
		$(this).css('backgroundColor','#FFFFFF');
	});
}

function e(o)
{
	$(o).each(function (i) {
		var bookid=parseInt($(this).text());
		$(this).html('<a href=\"BookDetail.aspx?BookID='+bookid+'\">一级</a> <a href=\"BookDetail.aspx?BookID='+bookid+'&Level=1\">二级</a>');
	});
}

function setautosave(o) {
	var str = 'Favorite.aspx?Action=SetAutoSave&AllowAutoSave=';
	if (o.checked) str += '1'; else str += '0';
	location = str;
}
