var version = 6.8;
var versionstr = "6.8";
var v = 0;
/******************************************************************************/
/* 123 Flash Chat Server Software --- Flash Client Source code                */
/* Software Version:           V6.7                                           */
/* Author:                     Daniel Jiang (support@123flashchat.com)        */
/* Copyright 2001-2007 by:     http://www.topcmm.com (TopCMM Software Corp.)  */
/* Support, News, Updates at:  http://www.123flashchat.com                    */
/* Last update:                June.27th,2007                                 */
/******************************************************************************/
/**************************for proxy start*************************************/
//You should set the variable my_domain to the shared domain suffix of the domain name of the 
//URL that can access the web page containing the 123flashchat.swf and the domain
// name of httpServer host value in client.xml.
var my_domain="";
//Please don't editing following code!!!
if(my_domain==undefined||my_domain==""){try{hostStr=window.location.host;var COLON=":";my_domain=hostStr.indexOf(COLON)==-1?hostStr:hostStr.substring(0,hostStr.indexOf(COLON));}catch(e){my_domain="";}}var L=true;document.domain=my_domain;if(urlLink==undefined){var urlLink;try{urlLink=window.location.href;}catch(e){try{urlLink=document.URL;}catch(e){urlLink="";}}}function F(){var K=urlLink.indexOf(my_domain)==-1?"0":"1";window.document.topcmm_123flashchat.SetVariable("checkCometObj.cometDomain",my_domain);window.document.topcmm_123flashchat.SetVariable("checkCometObj.K",K);};function d(A){if(A.contentDocument){return(A.contentDocument);}else if(A.contentWindow){return(A.contentWindow.document);}else if(A.document){return(A.document);}else{return(undefined);}};function c(z){var v=null;var o=z;var j=z+'_div';var w='border-width:0;height:0;width:0;visibility:hidden;';var k='position:absolute;top:0;left:0;width:0;height:0;overflow:hidden;';if(document.getElementById(o)){return(document.getElementById(o));}try{var C=document.createElement("iframe");C.setAttribute("id",o);C.setAttribute("name",o);C.setAttribute("style",w);var B=document.createElement("div");B.setAttribute("id",j);B.setAttribute("style",k);B.appendChild(C);document.body.appendChild(B);if(typeof document.frames!="undefined"){v=document.frames[o];}if(!v||typeof v.nodeType=="undefined"){v=document.getElementById(o);}}catch(e){var n='<iframe id="'+o+'" name="'+o+'" style="'+w+'"><\/iframe>';if(!document.getElementById(j)){B=document.createElement("div");B.setAttribute('id',j);B.setAttribute('style',k);B.innerHTML=n;document.getElementsByTagName('DIV')[0].appendChild(B);}else{document.getElementById(j).innerHTML=n;}v=document.getElementById(o);}return v;};function J(url,f,r){try{var m=(navigator.userAgent.toLowerCase().indexOf("msie")!=-1);var g=url+"?"+f;var v=c(r);var contentDocument=d(v);}catch(l){}try{if(!contentDocument.location){contentDocument.location=g;}else{contentDocument.location.replace(g);}}catch(l){v.src=g;}};function I(i){window.document.topcmm_123flashchat.SetVariable("cometObject.xmlStr",i);};function D(){var t=navigator.userAgent.toLowerCase();window.document.topcmm_123flashchat.SetVariable("cometObject.type",t);};function G(){var t=navigator.userAgent.toLowerCase();window.document.topcmm_123flashchat.SetVariable("cometObject.wb",t);};function H(){var t=urlLink;window.document.topcmm_123flashchat.SetVariable("cometObject.url",t);}
/**************************for proxy end**************************************/
/********************for clear swf object when close the ie window start*********/
window.onunload=function(){try{var m=navigator.userAgent.toLowerCase().indexOf("msie")!=-1;if(m){var fc=document.getElementById('topcmm_123flashchat');flashchat.removeChild(fc);}}catch(e){}}
/********************for clear swf object when close the ie window end*********/
/**************************for open swf method start**************************/
var init_user;
var init_password;
var init_nickname;
var init_root;
var init_room;
var init_room_pwd;
var init_lang;
var init_skin;
var admin_mode;
var init_ad;
var loading_bkground;
var init_private;
var init_private_message;
var init_listroom;
var init_invisible;
var init_group;
var init_host;
var init_port;
var init_host_s;
var init_port_s;
var init_host_h;
var init_port_h;

function getParameter(arg){arg=(arg=="")?(arg+"?"):(arg+"&");return arg;}
function openSWF(urlValue,widthValue,heightValue)
{
	var indexOfSWF=urlValue.indexOf('.swf');
	var indexOfInterrogation=urlValue.indexOf('?');
	var ieURL="";
	var otherBrowserURL="";
	var swfURL="";
	var parameter="";
	if(indexOfInterrogation!=-1)
	{
		swfURL=urlValue.substring(0,indexOfInterrogation);
		parameter=urlValue.substring(indexOfInterrogation);
	}
	else
	{
		swfURL=urlValue;
	}
	if(init_user!=undefined&&parameter.indexOf("init_user")==-1)
	{
			parameter=getParameter(parameter);
			parameter+="init_user="+init_user;
	}
	if(init_password!=undefined&&parameter.indexOf("init_password")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_password="+init_password;
	}
	if(init_nickname!=undefined&&parameter.indexOf("init_nickname")==-1)
	{
		parameter=getParameter(parameter);				
		parameter+="init_nickname="+init_nickname;
	}
	if(init_root!=undefined&&parameter.indexOf("init_root")==-1)
	{
		parameter=getParameter(parameter);	
		parameter+="init_root="+init_root;
	}
	if(init_room!=undefined&&parameter.indexOf("init_room")==-1)
	{
		parameter=getParameter(parameter);	
		parameter+="init_room="+init_room;
	}			
	if(init_room_pwd!=undefined&&parameter.indexOf("init_room_pwd")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_room_pwd="+init_room_pwd;
	}
	if(init_lang!=undefined&&parameter.indexOf("init_lang")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_lang="+init_lang;
	}
	if(init_skin!=undefined&&parameter.indexOf("init_skin")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_skin="+init_skin;
	}
	if(admin_mode!=undefined&&parameter.indexOf("admin_mode")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="admin_mode="+admin_mode;
	}
	if(init_ad!=undefined&&parameter.indexOf("init_ad")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_ad="+init_ad;
	}
	if(loading_bkground!=undefined&&parameter.indexOf("loading_bkground")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="loading_bkground="+loading_bkground;
	}
	if(init_private!=undefined&&parameter.indexOf("init_private")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_private="+init_private;
	}
	if(init_private_message!=undefined&&parameter.indexOf("init_private_message")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_private_message="+init_private_message;
	}
	if(init_listroom!=undefined&&parameter.indexOf("init_listroom")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_listroom="+init_listroom;
	}
	if(init_invisible!=undefined&&parameter.indexOf("init_invisible")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_invisible="+init_invisible;
	}
	if(init_group!=undefined&&parameter.indexOf("init_group")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_group="+init_group;
	}		
	if(init_host!=undefined&&parameter.indexOf("init_host")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_host="+init_host;
	}		
	if(init_port!=undefined&&parameter.indexOf("init_port")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_port="+init_port;
	}		
	if(init_host_s!=undefined&&parameter.indexOf("init_host_s")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_host_s="+init_host_s;
	}		
	if(init_port_s!=undefined&&parameter.indexOf("init_port_s")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_port_s="+init_port_s;
	}		
	if(init_host_h!=undefined&&parameter.indexOf("init_host_h")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_host_h="+init_host_h;
	}		
	if(init_port_h!=undefined&&parameter.indexOf("init_port_h")==-1)
	{
		parameter=getParameter(parameter);
		parameter+="init_port_h="+init_port_h;
	}																													
	if(indexOfSWF!=-1)
	{
		ieURL=swfURL.substring(0,indexOfSWF);
		otherBrowserURL=swfURL;
	}
	else
	{
		ieURL=swfURL;
		otherBrowserURL=swfURL+'.swf';
	}
	ieURL=ieURL+parameter;
	otherBrowserURL=otherBrowserURL+parameter;
	var m=navigator.userAgent.toLowerCase().indexOf("msie")!=-1
	if(m)//for ie, resolve the active swf problem
	{
		document.write('<DIV id="flashchat">');
		AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,19,0','width',widthValue,'height',heightValue,'src',ieURL,'id','topcmm_123flashchat','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie',ieURL,'name','topcmm_123flashchat','swfLiveConnect','true'); 
		document.write('</DIV>');
	}
	else
	{
		try
		{
			//if firefox use document.write('<OBJECT...'>) to embed swf object, the browser will throw SetVariable is not a method exception
			document.write('<DIV id="flashchat">');
			document.getElementById("flashchat").innerHTML='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,19,0" WIDTH="'+widthValue+'" HEIGHT="'+heightValue+'" id="topcmm_123flashchat"><PARAM NAME=movie VALUE="'+otherBrowserURL+'"><PARAM NAME=quality VALUE="high"><PARAM NAME="menu" value="false"><EMBED src="'+otherBrowserURL+'" quality=high menu=false WIDTH="'+widthValue+'" HEIGHT="'+heightValue+'" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" scale="noscale" name="topcmm_123flashchat" swLiveConnect="true"></EMBED></OBJECT>';
			document.write('</DIV>');
		}
		catch(e)
		{
			//can not use proxy
			document.write('<DIV id="flashchat"><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,19,0" WIDTH="'+widthValue+'" HEIGHT="'+heightValue+'" id="topcmm_123flashchat"><PARAM NAME=movie VALUE="'+otherBrowserURL+'"><PARAM NAME=quality VALUE="high"><PARAM NAME="menu" value="false"><EMBED src="'+otherBrowserURL+'" quality=high menu=false WIDTH="'+widthValue+'" HEIGHT="'+heightValue+'" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" scale="noscale" name="topcmm_123flashchat" swLiveConnect="true"></EMBED></OBJECT></DIV>');
		}
	}
}
/**************************for open swf method end******************************/
/*******************************Adobe method start******************************/
//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';
  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
/*******************************Adobe method end******************************/
/*********************some methods used for demo page start*******************/ 
function openFullScreenChat(url)
{
	if (document.all)
	{
		var w = screen.width - window.screenLeft - 10;
		var h = screen.height - window.screenTop;
		var win = window.open(url, "_123FullscreenDemo", "resizable=1, width="+w+",height="+h+",status=1");
		win.moveTo(0,0);
	}
	else
	{
		window.open(url, "_123FullscreenDemo", "resizable=1, fullscreen=1");
	}
}

function openPrivateWin(winId,w,h)
{
	window.open ("privatewin.html?"+winId, "privateMsg_"+winId, "height="+h+", width="+w+", top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, status=no");
}

function openCustomLiteClient(win_width,win_height)
{
	var win_width = window.screen.width - 5;
	var win_height = window.screen.Height - 10;
	
	if(document.customForm.customsize[0].checked==true)
	{
			win_width=document.customForm.win_width.value;
			win_height=document.customForm.win_height.value;
	}
	
	if (win_width < 270)
	{
		alert("width can't be less than 270");
		return;
	}
	
	if (win_height < 200)
	{
		alert("height can't be less than 200");
		return;	
	}
	
	var init_user=document.customForm.init_user.value;
	var init_password=document.customForm.init_password.value;
	var init_room=document.customForm.init_room[document.customForm.init_room.selectedIndex].value;
	var url="lite_client.html?init_user="+init_user+"&init_password="+init_password+"&init_room="+init_room;
	if(document.customForm.customsize[0].checked==true)
	{
	  var win = window.open(url, "_123flashchat_lite", "resizable=1, width=" + win_width + ",height=" + win_height + ",status=1,top=0,left=0");
  }
	else
	{
				var win = window.open(url, "_123flashchat_fullscreen_lite", "resizable=1, fullscreen=1");
	}
}

function openCustomStandardClient()
{
	var win_width = window.screen.width - 5;
	var win_height = window.screen.Height - 10;
	if(document.customForm.customsize[0].checked==true)
	{
			win_width=document.customForm.win_width.value;
			win_height=document.customForm.win_height.value;
	}
	
	if (win_width < 634)
	{
		alert("width can't be less than 634");
		return;
	}
	
	if (win_height < 250)
	{
		alert("height can't be less than 250");
		return;	
	}
	
	var urlStr="standard.html";
	var init_user;
	var init_password="";
	var init_room;
	var init_skin=document.customForm.init_skin[document.customForm.init_skin.selectedIndex].value;
	var init_lang=document.customForm.init_lang[document.customForm.init_lang.selectedIndex].value;
	if(document.customForm.autologin[1].checked==true)
	{
			init_user=document.customForm.init_user.value;
	}
	
	if(document.customForm.roomlist[document.customForm.roomlist.selectedIndex].value=="true")
	{
			init_room="1";
	}
	
	var init_ad=document.customForm.adbanner[document.customForm.adbanner.selectedIndex].value;

	if(init_user!=undefined)
	{
		urlStr=(urlStr.indexOf("?")==-1)?urlStr+"?init_user="+init_user:urlStr+"&init_user="+init_user;	
		urlStr+="&init_password="+init_password;
	}

	if(init_room!=undefined)
	{
		urlStr=(urlStr.indexOf("?")==-1)?urlStr+"?init_room="+init_room:urlStr+"&init_room="+init_room;
		if(init_user==undefined)
		{
			init_user="guest";
		}
		urlStr+="&init_user="+init_user;
		urlStr+="&init_password="+init_password;
	}
	
	if(init_lang!="*")
	{
		urlStr=(urlStr.indexOf("?")==-1)?urlStr+"?init_lang="+init_lang:urlStr+"&init_lang="+init_lang;
	}
	urlStr=(urlStr.indexOf("?")==-1)?urlStr+"?init_skin="+init_skin:urlStr+"&init_skin="+init_skin;
	urlStr+="&init_ad="+init_ad;
	if(document.customForm.customsize[0].checked==true)
	{
		var win = window.open(urlStr, "_123flashchat_demo", "resizable=1, width=" + win_width + ",height=" + win_height + ",status=1,top=0,left=0");
  }
	else
	{
		var win = window.open(urlStr, "_123flashchat_fullscreen_demo", "resizable=1, fullscreen=1");
	}
}
var htmlCodeTemplate='<script language="javascript" src="123flashchat.js"></script>\r\n<script language="javascript">\r\nopenSWF("#swfurl#","#width#","#height#");\r\n</script>\r\n<noscript>\r\n<DIV id="flashchat">\r\n<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,19,0" WIDTH="#width#" HEIGHT="#height#" id="topcmm_123flashchat">\r\n<PARAM NAME=movie VALUE="#swfurl#">\r\n<PARAM NAME=quality VALUE="high">\r\n<PARAM NAME="menu" value="false">\r\n<EMBED src="#swfurl#" quality=high menu=false WIDTH="#width#" HEIGHT="#height#" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" scale="noscale" name="topcmm_123flashchat" swLiveConnect="true">\r\n</EMBED>\r\n</OBJECT>\r\n</DIV>\r\n</noscript>';	
var standardEmbedChatCode=generateEmbedChatCode("123flashchat.swf","*",51127,"634","476");

function generateEmbedChatCodeFromForm()
{
	var urlStr="123flashchat.swf";
	var init_host=document.customForm.init_host.value;
	if(init_host=="")
	{
		init_host="*";
	}
	var init_port=document.customForm.init_port.value;
	if(init_port=="")
	{
		init_port=51127;
	}
	var win_width = "100%";
	var win_height = "100%";
	if(document.customForm.customsize[0].checked==true)
	{
			win_width=document.customForm.win_width.value;
			win_height=document.customForm.win_height.value;
	}
	var embedChatCode=generateEmbedChatCode(urlStr,init_host,init_port,win_width,win_height);
	document.customForm.embedChatCode.value=embedChatCode;
}

function generateEmbedChatCode(urlStr,init_host,init_port,win_width,win_height)
{
	if(!(init_port>0&&init_port<=65535))
	{
			alert("Invilid chat server port value, port value must great than 0 and less than 65536");
			return standardEmbedChatCode;	
	}
	if (win_width < 634)
	{
			alert("width can't be less than 634");
			return standardEmbedChatCode;
	}
	if (win_height < 250)
	{
			alert("height can't be less than 250");
			return standardEmbedChatCode;	
	}
	if(init_host!="*")
	{
		urlStr=(urlStr.indexOf("?")==-1)?urlStr+"?init_host="+init_host:urlStr+"&init_host="+init_host;
	}
	if(init_port!=51127)
	{
		urlStr=(urlStr.indexOf("?")==-1)?urlStr+"?init_port="+init_port:urlStr+"&init_port="+init_port;
	}
	var embedChatCode=htmlCodeTemplate;
	while(embedChatCode.indexOf("#swfurl#")!=-1)
	{
		embedChatCode=embedChatCode.replace("#swfurl#",urlStr);
	}
	while(embedChatCode.indexOf("#width#")!=-1)
	{
		embedChatCode=embedChatCode.replace("#width#",win_width);
	}
	while(embedChatCode.indexOf("#height#")!=-1)
	{
		embedChatCode=embedChatCode.replace("#height#",win_height);
	}
	return embedChatCode;
}
/****************************some methods used for demo page end*************************************/
