
function mhHover(cls)
{
	event.srcElement.className = cls;
}

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=/;domain=.dudushu.com;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 > 10) {
		var FBS = CLASTREADVALUE.indexOf("||") + 2;
		CLASTREADVALUE = CLASTREADVALUE.substr(FBS);
	}

	CLASTREADVALUE = CLASTREADVALUE + NEWCOOK;
	if(CLASTREADVALUE != ""){
		setCookies("LASTREADS", CLASTREADVALUE);
	}
}
