function getCookie(str){
 var tmp,reg=new RegExp("(^| )"+str+"=([^;]*)(;|$)","gi");
 if(tmp=reg.exec(document.cookie)){
   return(unescape(tmp[2]));
 }
 return null;
 }
function ClearCookie(name) { 
var ThreeDays=3*24*60*60*1000; 
var expDate = new Date(); 
expDate.setTime(expDate.getTime()-ThreeDays); 
document.cookie=name+"=;domain=.china.com;path=/;expires="+expDate.toGMTString(); 
}

function createCookie(name,value,days)
{
    if (days)
    {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; domain=.china.com; path=/";
}

function login_check(form)
{
  if (!textCheck(form.username, "用户名")){
      return;
  }
  if (!pwdCheck(form.password, "密码", 1))
      return;
  form.submit();
}
function register() {
     window.parent.location.href="http://passport.china.com/logon.do?processID=register1&domain=http://tuku.club.china.com";
}
function modify() {
    window.parent.location.href="http://passport.china.com/logon.do?processID=password&option=usermodify&domain=http://tuku.club.china.com";
}
function modifyPassword(){
    window.parent.location.href="http://passport.china.com/logon.do?processID=updatePassword";
   
}
function gotovalidate(){
    window.parent.location.href="http://passport.china.com";
}
function exitok(form){
if(confirm("确认退出？")){
  form.submit();
}
}


var userid=getCookie("CP_USER");
var nickname=getCookie("nickname");

function showLogin(){
    document.write('<div class="tukuLogin">');
    document.write('<form method="post" name="logon" action="/user/logon.do" onsubmit="return false;">');
	document.write('登录名：');
    document.write('<input class="input01" type="text" name="username"  title="请输入通行证用户名或昵称" />');
	document.write('密码：');
	document.write('<input class="input01" type="password" name="password" />');
	document.write('<input type="image" src="/images/btn_login.gif" onclick="login_check(logon);" />');
	document.write('<input type="image" src="/images/btn_reg.gif" onclick="register();" />');
    document.write('</form>');
    document.write('</div>');
}

function showLogout(){
    document.write('<div class="welcome">');
	document.write('<form method="post" name="logon" action="/user/logoff.do" onsubmit="return false;">');
	document.write('<span>' + nickname + '</span>用户：欢迎登录中华网纪念堂');
	document.write('<input type="image" src="/images/btn_logout.gif" name="Submit" value="退出登陆" onclick="exitok(logon);" />&nbsp;');
	document.write('<input type="image" src="/images/btn_passport.gif" name="Submit" value="返回通行证" onclick="gotovalidate();"/>&nbsp;');
    document.write('</form>');
	document.write('</div>');
}


document.write('<div id="nav"><div id="nav01"></div><div id="nav02"><div class="form">');
if(userid==null){
    showLogin();
}else{
    showLogout();
}

document.write('</div><ul>');
document.write('<li><a href="http://china.lotour.com/" target="_blank">旅游</a></li>');
document.write('<li><a href="http://game.china.com/" target="_blank">游戏</a></li>');
document.write('<li><a href="http://bbs.soufun.com/" target="_blank">搜房论坛</a></li>');
document.write('<li><a href="http://pl.news.china.com/" target="_blank">评论</a></li>');
document.write('<li><a href="http://index.club.china.com/zh_cn/focus/all/index.html" target="_blank">专题精选</a></li>');
document.write('<li><a href="http://blog.china.com/" target="_blank">博客</a></li>');
document.write('<li><a href="http://club.china.com" target="_blank">论坛</a></li>');
document.write('</ul></div><div id="nav03"></div></div>');
