var speed = 5;
var currentpos=1;
var timer;

//滚动公告
function Gundong(){
	document.write('');	
}

function ShowCopyRight(){
document.write('重要声明：本站所有的文章、图片、评论等，均由网友发表或上传并维护或收集自网络，属个人行为，与本站立场无关。<br />如果您是某作品的版权所有者但不愿意我们转载您的作品，请通知我们解决。任何非本站因素导致的法律后果，本站均不负任何责任。<br />Copyright &copy; 2006-2009 歪歪书吧  All rights reserved. 技术支持：<a href="http://www.wanersoft.com" target="_blank"><font color=red>奇文软件</font></a><br /><a href="http://www.miibeian.gov.cn/">晋ICP备07000683号</a><br />');
}

//TopMenu
function TopMenuList(){
    document.write('<a href="http://www.50017.com" target="_blank"><font color=yellow>17小游戏</font></a> <a href="/User/BS'+bookid+'.aspx" target="_blank">加入书架</a> <a href="/User/BR'+bookid+'.aspx" target="_blank">推荐本书</a>');
}
function TopMenu(){
    document.write('<a href="http://www.50017.com" target="_blank"><font color=yellow>17小游戏</font></a> <a href="/User/BS'+bookid+'.aspx" target="_blank">加入书架</a> <a href="/User/B'+bookid+'C'+chapterid+'.aspx" target="_blank">加入书签</a> <a href="/User/BR'+bookid+'.aspx" target="_blank">推荐本书</a>');
}

function ShowTg(){
   document.write('<input id="curl1" name="curl1" type="button" value="没看完？设置本页为首页" onclick="javascript:SetHome(this,document.URL);">&nbsp;&nbsp;&nbsp;&nbsp;<input id="curl2" name="curl2" type="button" value="复制本书地址，传给QQ/MSN上的好友！" onclick="javascript:CopyToClipBoard();"><br />');	
}

function NetMark(){
	document.write('<br /><a href="/User/Messages.aspx?to=客户服务&title='+booktitle+' '+volume+' '+chaptertitle+'&text=章节有错误"><font color=red><b>报告章节错误</b></font></a>&nbsp;&nbsp;&nbsp;&nbsp;网络收藏夹：');
	document.write("<a href=\"javascript:window.open(\'http:\/\/shuqian.qq.com\/post?from=3&title=\'+encodeURIComponent(document.title)+\'&uri=\'+encodeURIComponent(document.location.href)+\'&jumpback=2&noui=1\',\'favit\',\'width=930,height=470,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes\');void(0)\" ><img alt=添加到QQ书签收藏 src=\"/images/sq/qqshuqian.gif\" border=0><\/a>");
	document.write(" <a href=\"#\" onclick=\"window.open(\'http:\/\/myweb.cn.yahoo.com\/popadd.html?url=\'+encodeURIComponent(document.location.href)+\'&title=\'+encodeURIComponent(document.title), \'Yahoo\',\'scrollbars=yes,width=780,height=550,left=80,top=80,status=yes,resizable=yes\');\"><img alt=添加到雅虎收藏 src=\"/images\/sq\/yhhh.gif\" border=\"0\"><\/a>");
        document.write(" <a href=\"javascript:u=location.href;t=document.title;c = %22%22 + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text);var url=%22http:\/\/cang.baidu.com\/do\/add?it=%22+encodeURIComponent(t)+%22&iu=%22+encodeURIComponent(u)+%22&dc=%22+encodeURIComponent(c)+%22&fr=ien#nw=1%22;window.open(url,%22_blank%22,%22scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes%22); void 0\" title=\"百度收藏\"><img alt=添加到百度收藏 src=\"/images/sq/bbd.gif\" border=0><\/a>" );
	document.write(" <a target=\"_blank\" href=\"javascript:location.href=\'http:\/\/www.google.com\/bookmarks\/mark?op=add&amp;bkmk=\'+encodeURIComponent(location.href)+\'&amp;title=\'+encodeURIComponent(document.title)\"><img alt=添加到Google书签 src=\"/images/sq/gog.gif\" border=0><\/a> ");
	document.write(" <a href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(yesky=window.open(\'http:\/\/hot.yesky.com\/dp.aspx?t=\'+escape(d.title)+\'&amp;u=\'+escape(d.location.href)+\'&amp;c=\'+escape(t)+\'&amp;st=2\',\'yesky\',\'scrollbars=no,width=400,height=480,left=75,top=20,status=no,resizable=yes\'));yesky.focus();\"><img alt=添加到天极网摘 src=\"/images/sq/yesky.gif\" border=0><\/a> ");
	document.write(" <a href=\"javascript:d=document;t=d.selection?(d.selection.type!=\'None\'?d.selection.createRange().text:\'\'):(d.getSelection?d.getSelection():\'\');void(vivi=window.open(\'http:\/\/vivi.sina.com.cn\/collect\/icollect.php?pid=28&amp;title=\'+escape(d.title)+\'&amp;url=\'+escape(d.location.href)+\'&amp;desc=\'+escape(t),\'vivi\',\'scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes\'));vivi.focus();\"><img alt=添加到新浪ViVi src=\"/images/sq/vivi.gif\" border=0><\/a> ");
}

function myAddPanel() 
{ 
	if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
	//Gecko 
	{ 
		window.sidebar.addPanel('【小说阅读】'+booktitle+'_歪歪书吧小说更新最快!','http://www.yys8.net'+bookurl,''); 
	} 
	else
	//IE 
	{ 
		window.external.AddFavorite('http://www.yys8.net'+bookurl,'【小说阅读】'+booktitle+'_歪歪书吧小说更新最快!'); 
	} 
}

//复制内容到剪贴板
function CopyToClipBoard()
{
	var s = "歪歪书吧 每日更新大量免费小说在线阅读、下载、手机访问！\n";
	s += "网址:http://www.yys8.net\n";
	s += "小说《" + booktitle+ "》阅读地址:http://www.yys8.net"+bookurl;
	window.clipboardData.setData("Text",s); 
	alert('已复制本页链接,您可以使用Ctrl+V粘贴后,发送给好友!');
}

//写cookie
function writeCookie(name, value, hours)
{
	var expire = "";
	if(hours != null)
	{
		expire = new Date((new Date()).getTime() + hours *3600000);
		expire = "; expires=" + expire.toGMTString();
	}
	document.cookie = name + "=" + escape(value) + expire;
}

//读cookie
function readCookie(name)
{
	var cookieValue = "";
	var search = name + "=";
	if(document.cookie.length > 0)
	{
		offset = document.cookie.indexOf(search);
		if(offset != -1)
		{
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if(end == -1)
				end = document.cookie.length;
			cookieValue = unescape(document.cookie.substring(offset, end))
		}
	}
	return cookieValue;
}

function GetSetCss(){
    if(readCookie("ReadMain")!=""){document.getElementById("main").className=readCookie("ReadMain");}
    if(readCookie("ReadContent")!=""){document.getElementById("content").className=readCookie("ReadContent");}	
}

//设置阅读页面背景颜色
function ChangeMode(v)
{
	var Mainclass=document.getElementById("main").className;
	var ArrBodyclass=Mainclass.split(" ");
	document.getElementById("main").className=v+" "+ArrBodyclass[1];
	writeCookie("ReadMain", document.getElementById("main").className, 1);
}
//设置阅读页面字体
function ChangeFont(v)
{
	document.getElementById("content").className=v;
	writeCookie("ReadContent", v, 1);
}

String.prototype.replaceAll = function(s1,s2){
	return this.replace(new RegExp(s1,"gm"),s2);
}

function SelectColors()
{
	for(var i=1; i<=8; i++)
	{
		document.write("<a href='javascript:void(0);' onclick=javascript:ChangeMode('colors"+i+"'); class='color_"+i+"'>color"+i+"</a>");
	}
}

//双击滚动屏幕
function stopScroll()
{
    clearInterval(timer);
}
function beginScroll()
{
	timer=setInterval("scrolling()",300/5);
}

function scrolling()
{
	currentpos=document.documentElement.scrollTop;
    window.scroll(0,++currentpos);
    if(currentpos!=document.documentElement.scrollTop) clearInterval(timer);
}

document.onmousedown=stopScroll;
document.ondblclick=beginScroll;
//双击滚动屏幕结束

function SetHome(obj,vrl)
{
	try
	{
		obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
	}
	catch(e){
		if(window.netscape) {
			try {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}
			catch (e) {
				alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]设置为'true'");
			}
				var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
				prefs.setCharPref('browser.startup.homepage',vrl);
			}
	}
}