<!--
//
    var flag = false;
    var Cookie = new Object();
    
    Cookie.getCookie = function(name){
    	var cookieArray = document.cookie.split("; ");
    	var cookie = new Object();
    	for(var i=0;i<cookieArray.length;i++){
    		var arr = cookieArray[i].split("=");
    		if(arr[0]==name)return unescape(arr[1]);
    	}
    	return "";
    }
    
    Cookie.setCookie = function(name,value,option){
    	var str = name+"="+escape(value);
    	if(option){
    		if(option.expireDays){
    			var date = new Date();
    			var ms = option.expireDays*24*3600*1000;
    			date.setTime(date.getTime()+ms);
    			str+="; expires="+date.toGMTString();
    		}
    		if(option.path)str+="; path="+path;
    		if(option.doman)str+="; doman"+domain;
    		if(option.secure)str+="; true";
    	}
    	document.cookie=str;
    }
    
    Cookie.deleteCookie = function(name){
    	this.setCookie(name,"",{expireDays:-1});
    }
    
    Cookie.delCookie = function() {
    	var cookieArray = document.cookie.split("; ");
    	var cookie = new Object();
    	var date = new Date();
    	date.setTime(date.getTime()-10000);
    	for(var i=0;i<cookieArray.length;i++){
    		var arr = cookieArray[i].split("=");
	    	//this.setCookie(arr[0],"",{expireDays:-1});
	    	document.cookie=arr[0]+"; "+"expire="+date.toGMTString();
    	}
    }
    
    
    var userName="";
    userName = Cookie.getCookie("userName");
    var cdb_auth = Cookie.getCookie("cdb_auth");
    if (userName!="" && cdb_auth!="") flag = true;
    else flag = false;
    
//    if(!flag)
//    {
//        window.location.href="top-1.html";
//    }

  function reloads(){
	  window.location.reload();
  }

	function logoutUser(){
    document.write('<iframe src="http://www.du8.com/delcookie.jsp" width="0" height="0" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" ></iframe>');
		
		//document.write("<object type='text/x-scriptlet' width='0'  height='0' data='http://www.du8.com/delcookie.jsp'></object>");
		//setTimeout("eval(parent).reloads()",500);
		
	}

    

  function showUserName()
  {
      document.write(userName);
  }
  
  function sethomepages(){
  	this.homepage.style.behavior="url(#default#homepage)";
  	this.homepage.sethomepage("http://www.du8.com/");
  	
//			this.style.behavior="url(#default#homepage)";
//			this.setHomePage("http://www.du8.com/");
//			return(false);
  }
//收藏，已改成投诉与建议
//  function setshoucang(){
//window.external.AddFavorite("http://www.du8.com/", "“书生读吧-电子书门户”/www.du8.com");
//  	}
  	
  	
//function QueryString(surl)
//{
//	if(surl==1){
//		surl = "http://user.du8.com/people/user/logout.jsp?fromURL=";
//	}else if(surl==2){
//		surl = "http://user.du8.com/people/user/login.jsp?fromURL=";
//	}
//	var sSource = String(window.document.location);
//	var sReturn = "";
//	var sQUS = "/";
//	var dot=".";
//	var iPos;
//	var iDot;
//	iPos = sSource.indexOf(sQUS)+2;
//	iDot = sSource.indexOf(dot);
//	var strQuery = sSource.substr(iPos, iDot - iPos);
//	sReturn = strQuery;
//	if (strQuery == -1){
//		return surl+"www";
//	}
//	return surl+sReturn;
//}
function QueryString(surl)
{
	if(surl==1){
		surl = "http://user.du8.com/people/user/logout.jsp?forward=";
	}else if(surl==2){
		surl = "http://user.du8.com/people/user/login.jsp?forward=";
	}else if(surl==3){
		surl = "http://user.du8.com/people/user/regist.jsp?forward=";
	}
	var sSource = String(window.document.location);
	
   var sSource = escape(utf16to8(sSource));
   for(var i=0;i<sSource.split('/').length+2;i++){
    sSource = sSource.replace("/","%2F");
   }
	
	return surl+encodeURI(sSource);
}

//////////////////////////////////////////////////////////
function utf16to8(str) {

    var out, i, len, c;

    out = "";

    len = str.length;

    for(i = 0; i < len; i++) {

 c = str.charCodeAt(i);

 if ((c >= 0x0001) && (c <= 0x007F)) {

     out += str.charAt(i);

 } else if (c > 0x07FF) {

     out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));

     out += String.fromCharCode(0x80 | ((c >>  6) & 0x3F));

     out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));

 } else {

     out += String.fromCharCode(0xC0 | ((c >>  6) & 0x1F));

     out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));

 }

    }

    return out;

}

function utf8to16(str) {

    var out, i, len, c;

    var char2, char3;

    out = "";

    len = str.length;

    i = 0;

    while(i < len) {

 c = str.charCodeAt(i++);

 switch(c >> 4)

 {

   case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:

     // 0xxxxxxx

     out += str.charAt(i-1);

     break;

   case 12: case 13:

     // 110x xxxx   10xx xxxx

     char2 = str.charCodeAt(i++);

     out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));

     break;

   case 14:

     // 1110 xxxx  10xx xxxx  10xx xxxx

     char2 = str.charCodeAt(i++);

     char3 = str.charCodeAt(i++);

     out += String.fromCharCode(((c & 0x0F) << 12) |

        ((char2 & 0x3F) << 6) |

        ((char3 & 0x3F) << 0));

     break;

 }

    }

    return out;

}
//////////////////////////////////////////////////////////
   var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  //将Ansi编码的字符串进行Base64编码
   function encode64(input) {
      var output = "";
      var chr1, chr2, chr3 = "";
      var enc1, enc2, enc3, enc4 = "";
      var i = 0;

      do {
                 chr1 = input.charCodeAt(i++);
         chr2 = input.charCodeAt(i++);
         chr3 = input.charCodeAt(i++);

         enc1 = chr1 >> 2;
         enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
         enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
         enc4 = chr3 & 63;

         if (isNaN(chr2)) {
            enc3 = enc4 = 64;
         } else if (isNaN(chr3)) {
            enc4 = 64;
         }

         output = output + 
            keyStr.charAt(enc1) + 
            keyStr.charAt(enc2) + 
            keyStr.charAt(enc3) + 
            keyStr.charAt(enc4);
         chr1 = chr2 = chr3 = "";
         enc1 = enc2 = enc3 = enc4 = "";
      } while (i < input.length);

      return output;
   }

  //将Base64编码字符串转换成Ansi编码的字符串
   function decode64(input) {
      var output = "";
      var chr1, chr2, chr3 = "";
      var enc1, enc2, enc3, enc4 = "";
      var i = 0;
          
          if(input.length%4!=0)
          {
                    return "";
          }
      var base64test = /[^A-Za-z0-9\+\/\=]/g;
          if (base64test.exec(input))
          {
                    return "";
          }

      do {
         enc1 = keyStr.indexOf(input.charAt(i++));
         enc2 = keyStr.indexOf(input.charAt(i++));
         enc3 = keyStr.indexOf(input.charAt(i++));
         enc4 = keyStr.indexOf(input.charAt(i++));

         chr1 = (enc1 << 2) | (enc2 >> 4);
         chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
         chr3 = ((enc3 & 3) << 6) | enc4;
                 
                 output = output + String.fromCharCode(chr1);

         if (enc3 != 64) {
                        output+=String.fromCharCode(chr2);
         }
         if (enc4 != 64) {
                        output+=String.fromCharCode(chr3);
         }

         chr1 = chr2 = chr3 = "";
         enc1 = enc2 = enc3 = enc4 = "";

      } while (i < input.length);

      return output;
   }
  	
function fLoginFormSubmit()
{
  if (document.BookSearchForm.keyword.value == ""||document.BookSearchForm.keyword.value == ' 请输入关键词'){
	document.BookSearchForm.keyword.focus();
	alert (" 请输入关键词");
	return false;
  }
	var searchkeys = new String();
	
	var strTmp = new String();
	strTmp = document.BookSearchForm.keyword.value;
	
	for (var i=0; i<strTmp.length; i++) {
		if (strTmp.charCodeAt(i) > 128)
		searchkeys += strTmp.charAt(i);
			//window.alert("全角字符：" + strTmp.charAt(i));
		else
		searchkeys += escape(strTmp.charAt(i));
			//window.alert("半角字符：" + strTmp.charAt(i));
	}
	
	document.BookSearchForm.action="http://s.du8.com/search/search.do?keyword="+searchkeys;
}

function killErrors() {
return true;
}
window.onerror =killErrors;
//////////////////////////////////////////////////////////

 
 document.write('<link href="http://www.du8.com/images_www/css_generic_800.css" type="text/css" rel="stylesheet" />');
 
 function goLogouted(){
document.write('<!-- 登录-->');
document.write('<div id="login_area_800">');
document.write('  <div id="top_login">');
document.write('    <div class="leftdiv"><a href="javascript:window.location.href=QueryString(3)" target="_top">用户注册</a>　|　<a href="javascript:window.location.href=QueryString(2)" target="_top">用户登录</a>　|　<a href="http://share.du8.com/publish/loginPublish.vm" target="_blank">出版社登录</a>　|　<a href="http://www.du8.com/html/daili/index.htm" target="_blank">加盟代理商</a></div>');
document.write('    <div class="rightdiv">&nbsp;<a onclick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'www.du8.com\');" href="#">设为首页</a>　|　<a href="#" onclick="window.external.AddFavorite(location.href,document.title);return false;">收藏当前页</a>　|　<a href="http://www.du8.com/download/index.html">书生阅读器下载</a></div>');
document.write('  </div>');
document.write('</div>');
document.write('<!--登录结束-->');
}


function goLogined(){
document.write('<!-- 登录-->');
document.write('<div id="login_area_800">');
document.write('  <div id="top_login">');
document.write('    <div class="leftdiv"><font color="#FF0000"><span id="spanName" title="">' + userName + '</span></font>  您好　[ <a href="http://user.du8.com" target="_parent">进入用户中心</a> ] 　[ <a href="http://k.du8.com">查看我的收藏</a> ]　 [ <a href="http://bbs.du8.com/pm.php" target="_blank">短消息</a> ] 　[ <a href="javascript:window.location.href=QueryString(1)" target="_top">退出</a> ]</div>');
document.write('    <div class="rightdiv">&nbsp;<a onclick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'www.du8.com\');" href="#">设为首页</a>　|　<a href="#" onclick="window.external.AddFavorite(location.href,document.title);return false;">收藏当前页</a>　|　<a href="http://www.du8.com/download/index.html">书生阅读器下载</a></div>');
document.write('  </div>');
document.write('</div>');
document.write('<!--登录结束-->');
}


if(flag)
    {
        goLogined();
    }
    else {
    	goLogouted();
    }


document.write('<div id="headerarea800">');
document.write('  <div id="header">');
document.write('    <div id="headerlogo"><a href="http://www.du8.com"><img src="http://www.du8.com/images_www/site_logo.gif" border="0" /></a></div>');
document.write('    <div id="headnavarea">');
document.write('      <table border="0" align="center" cellpadding="0" cellspacing="0">');
document.write('        <tr>');
document.write('          <td><img src="http://www.du8.com/images_www/nav_bgleft.gif" /></td>');
document.write('          <td class="navbg"><a href="http://vip.du8.com" target="_blank" title="读吧VIP用户专区首页"><font color="#F0FF00">VIP专区</font></a> | <a href="http://www.du8.com/sort/xswx.html" target="_blank" title="读吧藏书_小说文学类">小说文学</a> | <a href="http://www.du8.com/sort/shss.html" target="_blank" title="读吧藏书_生活时尚类">生活时尚</a> | <a href="http://www.du8.com/sort/cjqg.html" target="_blank" title="读吧藏书_财经企管类">财经企管</a> | <a href="http://www.du8.com/sort/kxjs.html" target="_blank" title="读吧藏书_科学技术类">科学技术</a> | <a href="http://www.du8.com/sort/rwls.html" target="_blank" title="读吧藏书_人文历史类">人文历史</a> | <a href="http://www.du8.com/sort/zjjf.html" target="_blank" title="读吧藏书_政教军法类">政教军法</a> | <a href="http://s.du8.com" target="_blank" title="最棒的图书搜索引擎，能快捷、方便地找到互联网上95%的电子图书">读吧搜书</a> | <a href="http://k.du8.com" target="_blank" title="免费阅读最火、最新的小说章节，更新最快，内容最全，页面清爽，高速带宽"><font color="#F0FF00">读吧快眼</font></a></td>');
document.write('          <td><img src="http://www.du8.com/images_www/nav_bgright.gif" /></td>');
document.write('        </tr>');
document.write('      </table>');
document.write('      <div id="topsearcharea">');
document.write('        <table border="0" cellpadding="0" cellspacing="2" class="topsearch">');
document.write('          <form action="" method="post" name="BookSearchForm" target="_blank" id="BookSearchForm" onsubmit="return fLoginFormSubmit();">');
document.write('            <tr>');
document.write('              <td>&nbsp;</td>');
document.write('              <td><input  name="keyword" type="text" class="top_input_19" onfocus="if(this.value==\'书名 作者 类别 \')this.value=\'\';"   onblur="if(this.value==\'\')this.value=\'书名 作者 类别 \';"  value="书名 作者 类别 "/></td>');
document.write('              <td><input name="提交" type="submit" class="btn_search" value=" 搜书！" /></td>');
document.write('            </tr>');
document.write('          </form>');
document.write('        </table>');
document.write('      </div>');
document.write('      <div id="sclassnav"><a href="http://www.du8.com/channel/1_10010001_1.html" target="_blank" title="近年流行的经典图书，纯文本格式阅读，速度飞快">快意经典</a> <a href="http://www.du8.com/channel/2_10010001_1.html" target="_blank" title="读吧专有图书，原汁原味保有纸质图书版式，可以在线或者使用书生阅读器下载离线阅读">原味书屋</a> <a href="http://www.du8.com/channel/3_10010001_1.html" target="_blank" title="最近正式出版的图书，尝鲜试阅">新书尝鲜</a> <a href="http://www.du8.com/sort/wllx.html" target="_blank" title="最全、最流行的网络原创图书">网络流行</a> <a href="http://www.du8.com/sort/xh.html" target="_blank">玄幻</a> <a href="http://www.du8.com/sort/wx.html" target="_blank">武侠</a> <a href="http://www.du8.com/sort/yq.html" target="_blank">言情</a> <a href="http://www.du8.com/sort/qc.html" target="_blank">青春</a> <a href="http://www.du8.com/sort/xuanyi.html" target="_blank">悬疑</a></div>');
document.write('    </div>');
document.write('  </div>');
document.write('    <script  language="javascript" src="http://bbs.du8.com/shusheng/pms_getbar.php"></script>');
document.write('</div>');


