function Ajax() {
  var obj;
  try { obj = new XMLHttpRequest(); }
  catch(e) {
    var AjList = ["MSXML2.XMLHTTP","MSXML.XMLHTTP","Microsoft.XMLHTTP"];
    for(var i=0;i < AjList.length;i++) {
      try {
        obj = new ActiveXObject(AjList[i]);
        break;
      } catch(e) { }
    }
  }
  return obj;
}

//登陆
function openme(){
document.getElementById('loginbg').style.display='block';
document.getElementById('loginshow').style.display='block';
}
function closeme(){
document.getElementById('loginbg').style.display='none';
document.getElementById('loginshow').style.display='none';
}

function logo_in(){
var username=document.getElementById('myname').value;
var userpass=document.getElementById('mypass').value;

  var xmlhttp = Ajax();
  var AjaxURL = '/mylogin/dologin.asp?username='+escape(username)+'&userpass='+escape(userpass);
  xmlhttp.onreadystatechange = function() {
    if(xmlhttp.readyState == 4) { 
      var getText = parseInt(xmlhttp.responseText);
      if(getText == 1) 
	  {
		  dologin();
		  closeme();
		  document.getElementById('myname').value="";
		  document.getElementById('mypass').value="";
	  }
	  else if(getText == 2)
	  {
		  alert("用户名或密码错误!");
	  }
	  else if(getText == 3)
	  {
		  alert("你的帐号已经被冻结！");
	  }
	  else if(getText == 0)
	  {
		  alert("用户名密码不能够为空！")
	  }
	  else
	  {
		  alert("用户名或密码错误！")
	  }
    }
  }
  xmlhttp.open("GET",AjaxURL,true);
  xmlhttp.setRequestHeader("Content-type", "text/html;charset=gb2312");
  xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  xmlhttp.send(null);
}



//选肤cookie
function getCookie(name) 
{
	var my_cookie = document.cookie;
	var start = my_cookie.indexOf(name + "=");
	if (start == -1) return '';
	
	start += name.length + 1; //1 stands of '='
	
	var end = my_cookie.indexOf(";" ,start);
	if (end == -1) end = my_cookie.length;
	return my_cookie.substr(start, end - start);
}





<!-- 层ID号处理函数 Start -->
function $(id) {
  if(document.getElementById) { return document.getElementById(id); }
  else if(document.all) { return document.all[id]; }
  else if(document.layers) { return document.layers[id]; }
  else { return false; }
}
<!-- 层ID号处理函数 end -->


<!-- 登录显示 start -->
function dologin() {
  var xmlhttp = Ajax();
  var AjaxURL = '/mylogin/login.asp';
  xmlhttp.onreadystatechange = function() {
    if(xmlhttp.readyState == 4) { 
      var getText = xmlhttp.responseText;
      xmlhttp = '';
      $('mylogin').innerHTML = getText;
    }
  }
  xmlhttp.open("GET",AjaxURL,true);
  xmlhttp.setRequestHeader("Content-type", "text/html;charset=gb2312");
  xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  xmlhttp.send(null);
}
<!-- 登录显示 end -->

<!-- 退出显示 start -->
function loginout() {
  var xmlhttp = Ajax();
  var AjaxURL = '/mylogin/loginout.asp';
  xmlhttp.onreadystatechange = function() {
    if(xmlhttp.readyState == 4) { 
		dologin();
    }
  }
  xmlhttp.open("GET",AjaxURL,true);
  xmlhttp.setRequestHeader("Content-type", "text/html;charset=gb2312");
  xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  xmlhttp.send(null);
}
<!-- 登录显示 end -->

<!-- 其它函数 -->
function soByCls(){
	var f = document.sform;
	var cf = document.cform;
	f.query.value = document.sform1.query.value;
	f.style.value = cf.style.value;
	f.ending.value = cf.ending.value;
	f.period.value = cf.period.value;
	f.plot.value = cf.plot.value;
	f.hero.value = cf.hero.value;
	f.heroine.value = cf.heroine.value;
	f.submit();
}

 function bookmarkit()
{
   if (document.all)
   {
      window.external.addFavorite('http://www.hongxiu.com','红袖添香');
   }
   else if (window.sidebar)
   {
      window.sidebar.addPanel('红袖添香', 'http://www.hongxiu.com',  "");
   }
}

function setHomepage(pageURL)   
{   
 if (document.all)   
    {   
        document.body.style.behavior='url(#default#homepage)';   
  document.body.setHomePage(pageURL);   
    
    }   
    else if (window.sidebar)   
    {   
    if(window.netscape)   
    {   
         try  
   {     
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");     
         }     
         catch (e)     
         {     
    alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );     
         }   
    }    
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);   
    prefs.setCharPref('browser.startup.homepage',pageURL);   
 }   
}  


function printSearch()
{
document.write("<table cellpadding='0'><tr>");
document.write("<form action='http://s.hongxiu.com/cgi-bin/l' method='get' name='sform1' target='_blank'>");
document.write("<td align='center' valign='middle'><img src='http://pic.hongxiu.com/index/images_2008/ico_search.gif' /></td>");
document.write("<td  valign='top' ><input name='query'  value='' type='text' onfocus='this.select()'  maxlength='20' class='ssrk'/></td>");
document.write("<td align='right' valign='top'>");
document.write("<SELECT size=1 name='ls' onChange='javascript:sform1.action='http://s.hongxiu.com/cgi-bin/'+this.value;'> ");
document.write("<OPTION selected value='l'>长篇</OPTION> ");
document.write("<OPTION value='s'>短篇</OPTION> ");
document.write("</SELECT>&nbsp;<select name='iftitle' size='1'>");
document.write("<option value=''>全文</option>");
document.write("<option value='1' selected='selected'>标题</option>");
document.write("<option value='2'>作者</option>");
document.write("</select></td>");
document.write("<td align='center' valign='top'>&nbsp;<input src='http://pic.hongxiu.com/index/images_2008/b_s.gif' type='image' name='Submit' width='52' height='21' id='Image12' alt='红袖搜索' /></td>");
document.write("</form>");
document.write("");
document.write("<form name='cform' id='cform' >");
document.write("<td align='right' valign='top'>&nbsp;<select name='style' >");
document.write("<option value=''>风格</option>");
document.write("<option value='A'>悲情</option>");
document.write("<option value='B'>正剧</option>");
document.write("<option value='C'>搞笑</option>");
document.write("<option value='D'>甜美</option>");
document.write("<option value='E'>轻松</option>");
document.write("</select>&nbsp;<select name='ending' >");
document.write("<option value=''>结局</option>");
document.write("<option value='A'>喜</option>");
document.write("<option value='B'>悲</option>");
document.write("<option value='C'>开放式</option>");
document.write("</select>&nbsp;<select name='period' >");
document.write("<option value=''>时代</option>");
document.write("<option value='A'>现代生活</option>");
document.write("<option value='B'>民国</option>");
document.write("<option value='C'>清朝</option>");
document.write("<option value='D'>唐宋元明</option>");
document.write("<option value='E'>秦汉魏晋</option>");
document.write("<option value='F'>架空</option>");
document.write("<option value='G'>未来</option>");
document.write("<option value='H'>西方</option>");
document.write("<option value='I'>回到过去</option>");
document.write("</select>&nbsp;<select name='plot' >");
document.write("<option value=''>情节</option>");
document.write("<option value='A'>未婚怀孕</option>");
document.write("<option value='B'>别后重逢</option>");
document.write("<option value='C'>青梅竹马</option>");
document.write("<option value='D'>婚后相处</option>");
document.write("<option value='E'>办公室恋情</option>");
document.write("<option value='F'>青春校园</option>");
document.write("<option value='G'>姐弟恋</option>");
document.write("<option value='H'>暗恋成真</option>");
document.write("<option value='I'>日久生情</option>");
document.write("<option value='J'>斗智斗勇</option>");
document.write("</select>&nbsp;<select name='hero' >");
document.write("<option value=''>男主</option>");
document.write("<option value='A'>沉默是金</option>");
document.write("<option value='B'>聪明睿智</option>");
document.write("<option value='C'>深不可测</option>");
document.write("<option value='D'>强取豪夺</option>");
document.write("<option value='E'>俊逸若仙</option>");
document.write("<option value='F'>阳光健康</option>");
document.write("<option value='G'>轻松逗趣</option>");
document.write("<option value='H'>冷峻坚毅</option>");
document.write("<option value='I'>为妻是从</option>");
document.write("<option value='J'>放荡不羁</option>");
document.write("</select>&nbsp;<select name='heroine'>");
document.write("<option value=''>女主</option>");
document.write("<option value='A'>可爱</option>");
document.write("<option value='B'>淑女</option>");
document.write("<option value='C'>媚惑</option>");
document.write("<option value='D'>野蛮</option>");
document.write("<option value='E'>才女</option>");
document.write("<option value='F'>事业</option>");
document.write("<option value='G'>成熟</option>");
document.write("<option value='H'>幼稚</option>");
document.write("<option value='I'>善良</option>");
document.write("</select></td>");
document.write("<td align='center' valign='top'>&nbsp;<input src='http://pic.hongxiu.com/index/images_2008/b_s.gif' type='image' name='Image' width='52' height='21' id='Image' onclick='soByCls(); return false;' alt='按属性搜索'/></td>");
document.write("</form></tr></table>");
document.write("<form name='sform' method='get' action='http://s.hongxiu.com/cgi-bin/l' target='_blank'>");
document.write("<input type='hidden' name='query' value=''>");
document.write("<input type='hidden' name='cid' value='0'>");
document.write("<input type='hidden' name='indays' value=''>");
document.write("<input type='hidden' name='sort' value='LastModified DESC'>");
document.write("<input type='hidden' name='iftitle' value=''>");
document.write("<input type='hidden' name='style' value=''>");
document.write("<input type='hidden' name='ending' value=''>");
document.write("<input type='hidden' name='period' value=''>");
document.write("<input type='hidden' name='plot' value=''>");
document.write("<input type='hidden' name='hero' value=''>");
document.write("<input type='hidden' name='heroine' value=''>");
document.write("<input type='hidden' name='finish' value='0'>");
document.write("</form>");
}

