function CheckSearch(search)
{
	if(search.k.value == "")
	{
		alert("搜索关键字不能为空！");
		search.k.focus();
		return false;
	}
	search.Submit.disabled = true;
}
function mhHover(cls)
{
	event.srcElement.className = cls;
}

function CopyURL() { try { 
	window.clipboardData.setData("text",location.href); 
	alert("复制成功，请粘贴到你的论坛/QQ/MSN上推荐给你的好友，谢谢。"); 
	} catch(e) {}
}


function setCookies(cookieName,cookieValue, expirehours)
{
  var today = new Date();
  var expire = new Date();
  expire.setTime(today.getTime() + 3600000 * 356 * 24);
  document.cookie = cookieName+'='+escape(cookieValue)+ ';path=/;expires='+expire.toGMTString();
}

function ReadCookies(cookieName)
{
	var theCookie=''+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=='') return ''; 
	var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length;
	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

function LAST_READ_SET(bid, tid, booktitle, texttitle)
{
	if(texttitle=="") {
		texttitle = '首页';
	}
	var LRRead = bid+"#"+tid+"#"+booktitle+"#"+texttitle;
	setCookies("BLR", LRRead);
}

function LAST_LOOK_SET(bid,title)
{
	var CLASTREADVALUE = ReadCookies("LASTREADS");
	var NEWCOOK = bid + '#' + title + '||';
	
	while( CLASTREADVALUE.indexOf(NEWCOOK)>=0 ) {
		CLASTREADVALUE = CLASTREADVALUE.replace(NEWCOOK, "");
	}
	var CLARRS = CLASTREADVALUE.split("||");
	if(CLARRS.length > 30) {
		var FBS = CLASTREADVALUE.indexOf("||") + 2;
		CLASTREADVALUE = CLASTREADVALUE.substr(FBS);
	}

	CLASTREADVALUE = CLASTREADVALUE + NEWCOOK;
	if(CLASTREADVALUE != ""){
		setCookies("LASTREADS", CLASTREADVALUE);
	}
}

