<?php
theme_header();
echo<<<ONEZ
<style type="text/css">
.showbox,#showbox{/*内容显示区域*/
	margin:3px 10px;
  background:#ffffff;
  height:260px;
  
	scrollbar-face-color: #F6F6f6;
	scrollbar-highlight-color: #FFFFFF;
	scrollbar-shadow-color: #F0F2DB;
	scrollbar-3dlight-color: #cccccc;
	scrollbar-arrow-color:  #666666;
	scrollbar-track-color: #FCFDF9;
	scrollbar-darkshadow-color: #cccccc; 
	overflow:hidden;
	overflow-y:auto;
}
#showbox a{
  color:#0000cc;
  text-decoration:none;
  line-height:20px;
  border-bottom:1px solid #0000cc;
}
#showbox a:hover{
  color:#0000cc;
  text-decoration:none;
  border-bottom:0;
}
.showbox div,#showbox div{
  margin:3px;
}
.im_to{/*“我”的名字和时间*/
  color:#008040;
  height:18px;
  line-height:18px;
}
.im_from{/*对方的名字和时间*/
  color:#0000ff;
  height:18px;
  line-height:18px;
}
.im_content{/*消息内容*/
  color:#000000;
  padding-left:10px;
}
.im_list{
  height:24px;
  padding-left:10px;
  overflow:hidden;
}
.im_fail{
  color:#999999;
}
.im_list a{
  line-height:22px;
  color:#0000cc;
  text-decoration:none;
}
.im_list a:hover{
  color:#0000cc;
  border-bottom:1px solid #0000cc;
}
.im_info{/*系统提示*/
  color:#7982c1;
  line-height:18px;
  padding-left:2px;
}
.block{
  border:1px solid #808080;
  background:#eeeeee;
  padding:10px;
  display:block;
}
.formbutton{
  display:none;
}
</style>
ONEZ;
$ot->borderA('#content2','box2');
$T=DB()->one('history','*',"hid='$hid'");
$uid=$T['uid'];
$ot->addhead('QQ机器人');
$html='<div id="showbox"></div>';
$ot->addhtml($html);
$ot->setview(false);
$ot->borderB(1);
$ot->flush();
echo<<<ONEZ
<script type="text/javascript">
function PrintChat(str,cname,newid){
  if($('#showbox')[0].scrollHeight>3000)$('#showbox').html('');
  var o=$('<div />').html(str);
  if(cname!='')o.addClass(cname);
  if(newid!='')o.attr('id',newid);
  o.appendTo($('#showbox'));
  ScrollControl();
}
function ScrollControl(){
  $('#showbox').scrollTop($('#showbox')[0].scrollHeight);
}
function login(){
  $('#showbox').html('');
  PrintChat('开始登录...','info');
  $.post('?a=$a&b=onez_qq',{
    action:'login',
    'other':0
  },function(s){
    PrintChat(s,'info');
  });
}
function login2(){
  PrintChat('开始登录...','info');
  $.post('?a=$a&b=onez_qq',{
    action:'login2',
    KEY:$('#KEY').val(),
    'other':0
  },function(s){
    if(s.indexOf('登录成功')!=-1){
      $('#showbox').html('');
      init();
    }else{
      PrintChat(s,'info');
      init();
    }
  });
}
function loginStatus(s){
  if(s.indexOf('登录成功')!=-1){
    $('#btn_login').hide();
    $('#btn_logout').show();
    $('#codeBox').remove();
  }
}
function reloadPic(key){
  $('#codepic')[0].src='?a=$a&b=onez_qq&action=codepic&key='+key+'&t='+Math.random();
}
function init(){
  $.post('?a=$a&b=onez_qq',{
    action:'init',
    'other':0
  },function(s){
    PrintChat(s,'info');
  });
}
init();
</script>
ONEZ;
theme_footer();
?>