function $(){return document.getElementById?document.getElementById(arguments[0]):eval(arguments[0]);}
//var XH_Name="轩魂Online";
//var XH_Uid=1;
var XH_Name=parent.XH_Name;
var XH_Uid=parent.XH_Uid;
//var XH_UserIP=parent.XH_UserIP;
var LoadStr=0;
function LoadMsg() {
LoadStr=0;
$('loadbg').style.display='';
$('loadtext').style.display='';
var HisUid=location.search.substring(1);
var XmlUrl="UserManage.asp?U="+HisUid;
var XmlDoc=new ActiveXObject("Microsoft.XmlDOM");
XmlDoc.async = false;
XmlDoc.load(XmlUrl);
Nodes=XmlDoc.documentElement.childNodes;
H_Uid=Nodes.item(0).childNodes(0).text;
H_Uname=Nodes.item(0).childNodes(1).text;
H_Uhead=Nodes.item(0).childNodes(2).text;
H_Uphoto=Nodes.item(0).childNodes(3).text;
H_Uonline=Nodes.item(0).childNodes(4).text;
H_Usex=Nodes.item(0).childNodes(5).text;
H_Usign=Nodes.item(0).childNodes(6).text;
$("TalkTop").innerHTML="<li>"+XH_Name+"：您正与 <font color=red>"+HisUid+"</font> 交谈中 对方状态："+H_Uonline;
$("XH_HisContent").innerHTML=H_Usign;
XH_WinLeft_2.innerHTML="<img src='"+H_Uphoto+"' width=108 height=108 style='margin-top:10px;margin-bottom:10px'><br><font color=red>"+HisUid+"</font><br>性别:"+H_Usex+" 状态:"+H_Uonline;
window.setTimeout("AjaxMsg()",3000);
AjaxMsg();
}

function LeftWin(Obj) {
if ($(Obj).style.display=='') {
	if (Obj=='XH_WinLeft') {XH_WinLeftImg.src='images/talk/openbut.gif';$('XH_Content').style.width='450px'}
	$(Obj).style.display='none';
	}else{
	if (Obj=='XH_WinLeft') {XH_WinLeftImg.src='images/talk/closebut.gif';$('XH_Content').style.width='329px'}
	$(Obj).style.display=''
	}
}

function createXMLHttps()
{
    var ret = null;
    try {
        ret = new ActiveXObject('Msxml2.XMLHTTP');
    }
    catch (e) {
        try {
            ret = new ActiveXObject('Microsoft.XMLHTTP');
        }
        catch (ee) {
            ret = null;
        }
    }
    if (!ret && typeof XMLHttpRequest != 'undefined')
        ret = new XMLHttpRequest();
    return ret;
}

function AjaxMsg() {
if (LoadStr==0) {
LoadStr=1;
$('loadbg').style.display='none';
$('loadtext').style.display='none';
}
URL="Talk_List.asp?H="+H_Uid+"&U="+XH_Uid+"&N="+XH_Name;
var xmlhttp = createXMLHttps();
xmlhttp.open("GET",URL,true);
xmlhttp.onreadystatechange = function() {
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
	var AjaxHtml=xmlhttp.responseText;
	$("XH_MsgList").innerHTML=AjaxHtml;
	if (ScrollMsg.checked==true) {
		$("XH_Content").scrollTop=$("XH_MsgList").scrollHeight-200;
		}
		window.setTimeout("AjaxMsg()",3000);
	}
}
xmlhttp.send(null);
}

function SendTalk() {
var SendMess="Mess="+encodeURIComponent($('EditContent').innerHTML)+"&N="+encodeURIComponent(XH_Name)+"&U="+XH_Uid+"&Color="+TalkColor.value+"&H="+H_Uid;
$('EditContent').innerHTML='';
var URL="Talk_List.asp";
var xmlhttp = createXMLHttps();
xmlhttp.open("POST",URL,true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
	//var AjaxHtml=xmlhttp.responseText;
	//$("XH_MsgList").innerHTML=AjaxHtml;
	AjaxMsg();
		}
	}
	xmlhttp.send(SendMess);
}

document.onkeydown = function(){
//alert(event.keyCode);
//var KeyCodes=window.event.keyCode;
if(event.ctrlKey&&event.keyCode==13) {SendTalk();return false}
//if ((window.event.keyCode==13)&&(window.event.keyCode==17)) {alert('Enter')}
}