var jieqiUserId = 0;
var jieqiUserName = '';
var jieqiUserPassword = '';
var jieqiUserGroup = 0;
var jieqiNewMessage = 0;
var jieqiUserVip = 0;
var jieqiUserHonor = '';
var jieqiUserGroupName = '';
var jieqiUserVipName = '';


if(document.cookie.indexOf('jieqiUserInfo') >= 0){
	
	var jieqiUserInfo = get_cookie_value('jieqiUserInfo');
	
	start = 0;
	offset = jieqiUserInfo.indexOf(',', start); 
	while(offset > 0){
		tmpval = jieqiUserInfo.substring(start, offset);
		tmpidx = tmpval.indexOf('=');
		if(tmpidx > 0){
           tmpname = tmpval.substring(0, tmpidx);
		   tmpval = tmpval.substring(tmpidx+1, tmpval.length);
		   if(tmpname == 'jieqiUserId') jieqiUserId = tmpval;
		   else if(tmpname == 'jieqiUserName_un') jieqiUserName = tmpval;
		   else if(tmpname == 'jieqiUserPassword') jieqiUserPassword = tmpval;
		   else if(tmpname == 'jieqiUserGroup') jieqiUserGroup = tmpval;
		   else if(tmpname == 'jieqiNewMessage') jieqiNewMessage = tmpval;
		   else if(tmpname == 'jieqiUserVip') jieqiUserVip = tmpval;
		   else if(tmpname == 'jieqiUserHonor_un') jieqiUserHonor = tmpval;
		   else if(tmpname == 'jieqiUserGroupName_un') jieqiUserGroupName = tmpval;
		}
		start = offset+1;
		if(offset < jieqiUserInfo.length){
		  offset = jieqiUserInfo.indexOf(',', start); 
		  if(offset == -1) offset =  jieqiUserInfo.length;
		}else{
          offset = -1;
		}
	}
}

if(jieqiUserId != 0 && jieqiUserName != '' && (document.cookie.indexOf('PHPSESSID') != -1 || jieqiUserPassword != '')){
  if(jieqiUserVip == 1) jieqiUserVipName='<font color="#FFFFFF">至尊VIP-</font>';
  document.write('<table width="680" border="0" cellpadding="1" cellspacing="1" style="color:#FFFFFF;margin-top:5px;">');
  document.write('<tr>');
  document.write('<td width="20">&nbsp;</td><td>欢迎您『'+jieqiUserName+'』&nbsp;&nbsp;&nbsp;<a href="http://www.qingxinwang.com/userdetail.php" target="_top"><font color="#FFFFFF">我的资料</font></a> | <a href="http://www.qingxinwang.com/modules/article/bookcase.php" target="_top"><font color="#FFFFFF">我的书架</font></a>');
  if(jieqiNewMessage > 0){
	  document.write(' | <a href="http://www.qingxinwang.com/message.php?box=inbox" target="_top" class="mue1"><font color="#FFFFFF"><b>您有短信</b></font></a>');
  }else{
	  document.write(' | <a href="http://www.qingxinwang.com/message.php?box=inbox" target="_top"><font color="#FFFFFF">查看短信</font></a>');
  }
  document.write(' | <a href="http://www.qingxinwang.com/logout.php" target="_self"><font color="#FFFFFF">退出登录</font></a>&nbsp;</td>');
  document.write('</tr>');
  document.write('</table>');
}else{
  var jumpurl="";
  if(location.href.indexOf("jumpurl") == -1){
    jumpurl=location.href;
  }
  document.write('<table width="670" border="0" cellpadding="1" cellspacing="1" style="color:#FFFFFF;margin-top:1px;">');
  document.write('<form name="framelogin" method="post" action="http://www.qingxinwang.com/login.php">');
  document.write('<tr><td width="158">&nbsp;欢迎您 『 亲爱的游客 』</td>');
  document.write('<td>用户名：</td>');
  document.write('<td><input type="text" class="text1" size="12" maxlength="30" name="username" onkeypress="javascript: if (event.keyCode==32) return false;" value=""></td>');
  document.write('<td>密码：</td><td><input type="password" class="text1" size="12" maxlength="30" name="password"></td>');
  document.write('<td><input type="hidden" name="action" value="login" />');
  document.write('<input type="hidden" name="jumpurl" value="'+jumpurl+'" />');
  document.write('记录登录<input type="checkbox" class="checkbox" name="usecookie" value="1" /></td>');
  document.write('<td><input type="submit" class="buttonlog" value="" name="submit"></td>');
  document.write('<td><a href="http://www.qingxinwang.com/register.php" target="_top"><img src="http://www.qingxinwang.com/themes/qxzw/images/but-02.jpg" width="43" height="18" border="0"></a></td>');
  document.write('<td><a href="http://www.qingxinwang.com/getpass.php" target="_top"><font color="#FFFFFF">找回密码</font></a></td>');
  document.write('</tr>');
  document.write('</form>');
  document.write('</table>');
}

function get_cookie_value(Name) { 
  var search = Name + "=";
　var returnvalue = ""; 
　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; 
　　  returnvalue=unescape(document.cookie.substring(offset, end));
　　} 
　} 
　return returnvalue; 
}
