


var URLHost = "http://www.hi-eweb-livechat.com/truemax/";

document.write("<iframe src='"+URLHost+"indexweb.aspx?url="	+document.URL+"' scrolling='no' width='185' height='50' frameborder='0' marginheight='0' marginwidth='0'></iframe>");


var str = "";
	str = "<div id='ad' style='position:absolute;left:50px;top:60px;display:none;'><table width='302' height='202' border='0' cellpadding='0' cellspacing='0'>";
	str += "<tr><td colspan='3'><img src='"+URLHost+"image/invite/invite_01.gif' width='302' height='39' border='0' usemap='#Map'></td></tr>";
	str += "<tr><td colspan='3'><img src='"+URLHost+"image/invite/invite_02.gif' width='302' height='15' alt=''></td></tr>";
	str += "<tr><td width='10' height='99' background='"+URLHost+"image/invite/invite_03.gif'></td><td valign='top' bgcolor='#ecf0f5'>";
	str += "<textarea rows='6' id='newmsg' readonly='true' style='width:98%; height:98%; BORDER-RIGHT: silver 1px solid; BORDER-TOP: silver 1px solid; BORDER-LEFT: silver 1px solid; BORDER-BOTTOM: silver 1px solid;'></textarea>";
	str += "</td><td width='10' height='99' background='"+URLHost+"image/invite/invite_05.gif'></td></tr><tr><td><img src='"+URLHost+"image/invite/invite_06.gif' width='10' height='39' alt=''></td><td width='282' bgcolor='#ecf0f5'>";
	str += "<TEXTAREA id='content' onkeydown='if (event.ctrlKey &amp;&amp; event.keyCode==13) {javascript:sendContent();return false;}' style='BORDER-RIGHT: silver thin solid; BORDER-TOP: silver thin solid; ";
	str += "BORDER-LEFT: silver thin solid; WIDTH: 200px; BORDER-BOTTOM: silver thin solid; HEIGHT: 30px'name='content' rows='3' wrap='VIRTUAL' cols='50' type='text'></TEXTAREA>";
	str += "<img style='CURSOR: pointer' onclick='javascript:sendContent()' src='"+URLHost+"image/invite/invite_11.gif' border='0' width='59' height='30'></td>"
	str += "<td><img src='"+URLHost+"image/invite/invite_08.gif' width='10' height='39' alt=''></td></tr>";
	str += "<tr><td colspan='3'><img src='"+URLHost+"image/invite/invite_09.gif' width='302' height='10' alt=''></td></tr></table></div>";
	str += "<map name='Map'><area shape='rect' coords='279,1,304,24' alt='Close' id='closeshow'></map>";

document.write(str);

	
	var x = 50;
	var xin = true;
	var step = 1;
	var delay = 40;
	var obj=document.getElementById("ad"); 	
	obj.style.top =  (document.body.scrollTop + 50) + "px";	
	
	
	function floatAD() { 
		var L=0 ;
		var R= document.body.clientWidth-obj.offsetWidth ;

		obj.style.left = (document.body.scrollLeft + x) + "px";		
		obj.style.top = (document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop) + 50 + 'px';
		x = x + step*(xin?1:-1) ;
	
		if (x < L) { xin = true; x = L;} 
		if (x > R){ xin = false; x = R;} 
	} 
	var itl= setInterval("floatAD()", delay) ;
	obj.onmouseover=function(){clearInterval(itl);} 
	obj.onmouseout=function(){itl=setInterval("floatAD()", delay);} 
		
	
		
	var sendmessage;
	var cnickname;	
	var closeshow=document.getElementById("closeshow");
	closeshow.onclick=function()
	{
		sendmessage="";
		TransmitContent('c','setDivContent',sendmessage);	
		var newmsg=document.getElementById("newmsg");
			newmsg.value="";
		var content=document.getElementById("content");
			content.value="";
		var ad=document.getElementById("ad");		
		ad.style.display="none";
	}
		
	var ad=document.getElementById("ad");
	function PositionInit()
	{
	 	x=50;		
		ad.style.display="block";
		window.focus();
	}
	
	function loadContent()
	{		
		sendmessage="";
		if(ad.style.display=="none")			
			TransmitContent('r','setDivContent',sendmessage);
	} 
	
	
	function sendContent()
	{
		var sendurl = URLHost+"livechat/SendMsg.aspx?cnickname="+cnickname+'&username=manager';	
		sendmessage = document.getElementById("content").value;
		if(sendmessage!="")
		{	
			TransmitContent('w','setDivContent',sendmessage);
			document.getElementById("content").value = "";			
			var win=window.open(sendurl,'windows','menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,width=640,height=520');
			win.focus();
			
			setInterval("", 2000);
			if(win)
				ad.style.display="none";			
		}
	}
		
	function TransmitContent(action,f,sendmessage)
	{	
		var s=document.createElement('SCRIPT');	
			s.src=URLHost+"livechat/Cross_Site.aspx?action="+action+"&f="+f+"&cnickname="+cnickname
				+"&sendmessage="+sendmessage+"&s"+Math.random();	
			document.body.appendChild(s);			
	}	
		
	function setDivContent(v)
	{		
		if(v!="")
		{	
			var newmsg=document.getElementById("newmsg");
			newmsg.value = DealBrackets(v); 				
			PositionInit();		
		}
	}
	
	function getcnickname(v)
	{	
		cnickname = v;	
	}
		
	function DealBrackets(str)
	{	
		str = str.replace(new RegExp("&lt;", "g"), "<");
		str = str.replace(new RegExp("&gt;", "g"), ">");
		str = str.replace(new RegExp("''", "g"), "'");
		str = str.replace(new RegExp("&nbsp;", "g"), " ");
		str = str.replace(new RegExp("<br/>", "g"), "\n");
		str = str.replace(new RegExp("<br/>", "g"), "\r\n");
		
								
		return str;
	}
	
	window.onload=function()	
	{	
		sendmessage = "";
				
		var s=document.createElement('SCRIPT');	
			s.src=URLHost+"indexweb.aspx?action=s&f=getcnickname&s"+Math.random();	
			document.body.appendChild(s);			
			
		setInterval("loadContent()", 3000);
	}
	
	window.onunload=function()
	{	
		sendmessage = "";
		TransmitContent('c','setDivContent',sendmessage);	
	}
