
function startmarquee(lh,speed,delay) {
	var p=false;
	var t;
	var sh;
	var o=document.getElementById("marqueebox");
	o.innerHTML+=o.innerHTML;
	o.style.marginTop=0;
	o.onmouseover=function(){p=true;}
	o.onmouseout=function(){p=false;}
	function start(){
		sh = o.offsetHeight;
		o.style.height = sh;
		t=setInterval(scrolling,speed);
		if(!p) o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
	}
	function scrolling(){
		if(parseInt(o.style.marginTop)%lh!=0){
			o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
			if(Math.abs(parseInt(o.style.marginTop))>=sh/2) o.style.marginTop=0;
		}else{
			clearInterval(t);
			setTimeout(start,delay);
		}
	}
	setTimeout(start,delay);
}
//startmarquee(20,20,1000);
function flag(id) {
	if ($.cookie("u") == null || $.cookie("u").length < 1)
	{
		alert("未登录到天涯易读网，不能做记号。请先登录再做记号，谢谢！");
		return;
	}
	if(confirm("您确实想订阅并做记号在此吗？")) {
		make_bookmarks(id);
	}
}

function make_bookmarks(id) {
	$.post("./submit.php", {bookmarks: id, page: page, isAuthor: isAuthor, tianya_id: tianya_id, action: "post_bookmarks_ajax"}, function(result) {
		if (result == 1)	{
			alert("做记号成功，下次可以选择从此处开始阅读！");
		} else if (result == 5)	{
			alert("订阅并做记号成功，下次可以选择从此处开始阅读！");
		} else if (id == -2) {
			alert("做记号失败！\n只有登录用户才能做记号，赶快登录或免费注册吧！");
		} else {
			alert("做记号失败！");
		}
	});
}

var new_cls = "ac";
function high_light() {
	//alert($("li[name='author']").text());
	new_cls = (new_cls == "ac") ? "ac red" : "ac";
	$("li[name='author']").attr("class", new_cls);
	$.cookie("high_light", new_cls, {expires: 365, path: '/'});
}
function high_light_4_cookie() {
	if ($.cookie("high_light") == "ac red") {
		new_cls = "ac red";
		$("li[name='author']").attr("class", new_cls);
	}
}

function unsubscribe(id) {
	if(confirm("退订之后将不会再收到楼主更新的通知邮件了！确实要退订吗？")) {
		location.href="subscribe.php?action=unsubscribe&id=" + id;
	}
}
function toBreakWord(intLen, id){
	if(document.getElementById && !document.all) {
		var obj=document.getElementById(id);
		var strContent=obj.innerHTML;
		var strTemp="";
		while(strContent.length>intLen){
			strTemp+=strContent.substr(0,intLen)+"<br>";
			strContent=strContent.substr(intLen,strContent.length);
		}
		strTemp+= strContent;
		obj.innerHTML=strTemp;
	}
}
var today = new Date();