﻿var version=3.2;var v=0;if(urlLink==undefined){var urlLink;try{urlLink=window.location.href;}catch(e){try{urlLink=document.URL;}catch(e){urlLink="";}}}
window.onunload=function(){try{var m=navigator.userAgent.toLowerCase().indexOf("msie")!=-1;if(m){var lh=document.getElementById('topcmm_123livehelp');livehelp.removeChild(lh);}}catch(e){}}
var init_room;var init_url;var init_nickname;var init_preColor;var init_staff;var init_dc;var init_color;var init_dc_skin;var SELECT_NO_DC_NO_POPUP="You do not need to embed any code!";var NOT_DISPLAY_ONLINE_STATUS="3";var DISPLAY_ONLINE_STATUS_TEXT="4";var CLIENT_ASSIGN_DEPT="1";var CLIENT_ASSIGN_STAFF="2";function getParameter(arg){arg=(arg=="")?(arg+"?"):(arg+"&");return arg;}
function openSWF(urlValue,widthValue,heightValue,divId,flashId)
{init_room="";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_room!=undefined&&parameter.indexOf("init_room")==-1)
{if(init_room!=0)
{parameter=getParameter(parameter);parameter+="init_room="+init_room;}}
if(init_url!=undefined&&parameter.indexOf("init_url")==-1)
{parameter=getParameter(parameter);parameter+="init_url="+init_url;}
if(init_nickname!=undefined&&parameter.indexOf("init_nickname")==-1)
{parameter=getParameter(parameter);parameter+="init_nickname="+init_nickname;}
if(init_preColor!=undefined&&parameter.indexOf("init_preColor")==-1)
{parameter=getParameter(parameter);parameter+="init_preColor="+init_preColor;}
if(init_staff!=undefined&&parameter.indexOf("init_staff")==-1)
{parameter=getParameter(parameter);parameter+="init_staff="+init_staff;}
if(init_dc!=undefined&&parameter.indexOf("init_dc")==-1)
{parameter=getParameter(parameter);parameter+="init_dc="+init_dc;}
if(indexOfSWF!=-1)
{ieURL=swfURL.substring(0,indexOfSWF);otherBrowserURL=swfURL;}
else
{ieURL=swfURL;otherBrowserURL=swfURL+'.swf';}
if(init_color!=undefined&&parameter.indexOf("init_color")==-1)
{parameter=getParameter(parameter);parameter+="init_color="+init_color;}
if(urlValue.indexOf("dc.swf")!=-1)
{parameter+="&footprint="+urlLink;if(typeof(define_url)!='undefined')
{parameter+="&init_root="+define_url;}}
ieURL=ieURL+parameter;otherBrowserURL=otherBrowserURL+parameter;var m=navigator.userAgent.toLowerCase().indexOf("msie")!=-1
if(m)
{document.write('<DIV id="'+divId+'">');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',flashId,'quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie',ieURL,'name','topcmm_123livehelp','swfLiveConnect','true','AllowScriptAccess','always');document.write('</DIV>');}
else
{try
{document.write('<DIV id="'+divId+'">');document.getElementById(divId).innerHTML='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" wmode="opaque" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,19,0" WIDTH="'+widthValue+'" HEIGHT="'+heightValue+'" id="'+flashId+'"><PARAM NAME=movie VALUE="'+otherBrowserURL+'"><PARAM NAME=AllowScriptAccess VALUE="always"><PARAM NAME=quality VALUE="high"><param name="wmode" value="opaque" /><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="'+flashId+'" swLiveConnect="true" AllowScriptAccess="always"></EMBED></OBJECT>';document.write('</DIV>');}
catch(e)
{document.write('<DIV id="'+divId+'"><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" wmode="opaque" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,19,0" WIDTH="'+widthValue+'" HEIGHT="'+heightValue+'" id="'+flashId+'"><PARAM NAME=movie VALUE="'+otherBrowserURL+'"><PARAM NAME=AllowScriptAccess VALUE="always"><PARAM NAME=quality VALUE="high"><param name="wmode" value="opaque" /><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="'+flashId+'" swLiveConnect="true" AllowScriptAccess="always"></EMBED></OBJECT></DIV>');}}}
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;}
function getOnlineStatus(assignType,assignId)
{if(assignType==1)
{for(var i in onlineDept)
{if(onlineDept[i][1]==assignId)return true;}}
else if(assignType==2)
{for(var i in onlineStaff)
{if(onlineStaff[i][0]==assignId)return true;}}
else
{if(onlineDept.length!=0)
{return true;}
else
{return false;}}
return false;}
function displayStatusImg(assignType,assignId,onlineImg,offlineImg,clientHtmlUrl,win_width,win_height,init_url,init_room,init_nickname,init_preColor)
{var htmlcode="";if(getOnlineStatus(assignType,assignId))
{htmlcode=onlineImg;}
else
{htmlcode=offlineImg;}
var functionStr="openClientInNewWindow('"+clientHtmlUrl+"','"+win_width+"','"+win_height+"','"+init_url+"','"+init_room+"','"+init_nickname+"','"+init_preColor+"');return false;";htmlcode='<a href="'+clientHtmlUrl+'" target="123livehelp_client" onclick="'+functionStr+'"><img src="'+htmlcode+'"border="0"></a>';
if(document.getElementById('livehelp_container') != null)
{
document.getElementById('livehelp_container').innerHTML=htmlcode;
}
}
function displayStatusText(assignType,assignId,onlineText,offlineText,clientHtmlUrl,win_width,win_height,init_url,init_room,init_nickname,init_preColor)
{var htmlcode="";if(getOnlineStatus(assignType,assignId))
{htmlcode=onlineText;}
else
{htmlcode=offlineText;}
var functionStr="openClientInNewWindow('"+clientHtmlUrl+"','"+win_width+"','"+win_height+"','"+init_url+"','"+init_room+"','"+init_nickname+"','"+init_preColor+"');return false;";htmlcode='<a href="'+clientHtmlUrl+'" target="123livehelp_client" onclick="'+functionStr+'">'+htmlcode+'</a>';document.write(htmlcode);}
function selectDC()
{var button_type="0";var buttonTypeLength=document.customForm.button_type.length;for(i=0;i<buttonTypeLength;i++)
{if(document.customForm.button_type[i].checked)
{button_type=document.customForm.button_type[i].value;break;}}
if(button_type==NOT_DISPLAY_ONLINE_STATUS)
{document.customForm.win_width.disabled=true;document.customForm.win_height.disabled=true;var windowStytleLength=document.customForm.button_window_style.length;for(i=0;i<windowStytleLength;i++)
{document.customForm.button_window_style[i].disabled=true;document.customForm.button_window_style[i].checked=false;}
document.customForm.button2.disabled=true;document.customForm.select_assign.disabled=true;}
else
{document.customForm.win_width.disabled=false;document.customForm.win_height.disabled=false;var windowStytleLength=document.customForm.button_window_style.length;for(i=0;i<windowStytleLength;i++)
{document.customForm.button_window_style[i].disabled=false;}
document.customForm.button_window_style[0].checked=true;document.customForm.button2.disabled=false;document.customForm.select_assign.disabled=false;}}
function selectNoDC()
{var dcSkinType="0";var dcSkinTypeLength=document.customForm.dc_style.length;var dcDeptLength=document.customForm.dc_dept.length;for(i=0;i<dcSkinTypeLength;i++)
{if(document.customForm.dc_style[i].checked)
{dcSkinType=document.customForm.dc_style[i].value;break;}}
if(dcSkinType=="0")
{if(typeof(DeptLength)=='undefined')
{document.customForm.dc_dept.disabled=true;document.customForm.dc_dept.checked=false;document.customForm.select_DC_popup.disabled=true;}
for(i=0;i<dcDeptLength;i++)
{document.customForm.dc_dept[i].disabled=true;document.customForm.dc_dept[i].checked=false;document.customForm.select_DC_popup.disabled=true;}}
else
{for(i=0;i<dcDeptLength;i++)
{document.customForm.dc_dept[i].disabled=false;}
if(typeof(dcDeptLength)=='undefined')
{document.customForm.dc_dept.checked=true;document.customForm.dc_dept.disabled=false;}
else
{document.customForm.dc_dept[0].checked=true;}
document.customForm.select_DC_popup.disabled=false;}}
function getRootURL()
{document.customForm.url.value=urlLink.substring(0,urlLink.lastIndexOf('/'));}
function showAllDept()
{if(deptList.length==0)
{document.getElementById("assign_dc_dept").innerHTML='<font color="#FF0000">There is no Department for staff! <br>In order to use the function of invite window,please add at least one department.</font>';}
for(i=0;i<deptList.length;i++)
{if(i==0)
{document.getElementById("assign_dc_dept").innerHTML+='<input type="radio" name="dc_dept" value="'+deptList[i][1]+'" checked>'+deptList[i][0];}
else
{document.getElementById("assign_dc_dept").innerHTML+='<input type="radio" name="dc_dept" value="'+deptList[i][1]+'" >'+deptList[i][0];}
if(i>0&&i%7==0)
{document.getElementById("assign_dc_dept").innerHTML+='<br>';}}}
function openClientInNewWindow(clientHtmlUrl,win_width,win_height,init_url,init_room,init_nickname,init_preColor)
{if(win_width=="undefined"||win_width=="")
{win_width=495;}
if(win_height=="undefined"||win_height=="")
{win_height=440;}
var parameter="";if(init_url=="undefined"||init_url=="")
{init_url=urlLink;}
parameter="?";while(clientHtmlUrl.indexOf("?init_color")!=-1)
{parameter="&";break;}
parameter+="init_url="+init_url;if(init_room!="undefined"&&init_room!="")
{parameter=getParameter(parameter);parameter+="init_room="+init_room;}
if(init_nickname!="undefined"&&init_nickname!="")
{parameter=getParameter(parameter);parameter+="init_nickname="+init_nickname;}
var urlStr=clientHtmlUrl+parameter;var win=window.open(urlStr,"123livehelp_client"+Math.round(Math.random()*1000),"resizable=1, width="+win_width+",height="+win_height+",status=1");}
var CLIENT_HTML="client.html";var LIVE_STATUS_JS="live_status.js";var STYLE_CSS="style.css";var MAIN_JS="123livehelp.js";var ONLINE_JPG="img/online_new.jpg";var OFFLINE_JPG="img/offline_new.jpg";var ONLINE_1_JPG="img/online1.jpg";var OFFLINE_1_JPG="img/offline1.jpg";var ONLINE_2_JPG="img/online2.jpg";var OFFLINE_2_JPG="img/offline2.jpg";var DC_SWF="dc.swf";var BUTTON_TYPE_IMAGE="0";var BUTTON_TYPE_TEXT="1";var BUTTON_TYPE_NULL="-1";var BUTTON_ASSIGN_NULL="0";var BUTTON_ASSIGN_DEPT="1";var BUTTON_ASSIGN_STAFF="2";var INVIATION_STYLE_SLIDEDOWN=1;var INVIATION_STYLE_POPUP=0;var INVIATION_STYLE_BROWN=1;var INVIATION_STYLE_GREEN=2;var INVIATION_STYLE_RED=3;var INVIATION_STYLE_ORANAGE=4;var INVIATION_STYLE_BLUE=5;var INVIATION_STYLE_BLACK=6;var INVIATION_STYLE_VIOLET=7;var INVIATION_STYLE_CYAN=8;var INVIATION_STYLE_NULL=0;var CLIENT_HTML_CODE_TEMPLATE='<!-- 123livehelp script begin -->\r\n<link href="#styleCSS#" rel="stylesheet" type="text/css" />\r\n<script language="javascript" src="#livestatusjs#"></script>\r\n<script language="javascript" src="#mainjs#"></script>\r\n<script language="javascript">\r\nvar button_type=#displayStatusStyle#;\r\nvar online_display="#online#";\r\nvar offline_display="#offline#";\r\nvar button_assign_type=#assigntype#;\r\n#pre_id#var chat_window_skin="#chatWindowSkin#";\r\nvar chat_window_width=#width#;\r\nvar chat_window_height=#height#;\r\nvar enable_invitation=#enableDC#;\r\n#pre_dc#var define_url = "#define_url#";\r\nlivehelp();\r\n</script>\r\n<!-- 123livehelp script end -->';var CLIENT_STANDARD_EMBED_CODE=""
if(typeof(deptList)!='undefined'&&deptList.length!=0)
{CLIENT_STANDARD_EMBED_CODE=generateCode("0","495","440","violet","0","0","1",deptList[0][1],"1","");}
else
{CLIENT_STANDARD_EMBED_CODE=generateCode("0","495","440","violet","0","0","0","0","1","");}
function generateCode(button_type,win_width,win_height,button_window_style,select_assign_type,assign_id,dc_skin,dc_dept,dc_app_type,url,onLineText,offLineText)
{var rootUrl=urlLink.substring(0,urlLink.lastIndexOf('/'));var livestatusjs=LIVE_STATUS_JS;var styleCSS=STYLE_CSS;var mainjs=MAIN_JS;var online=ONLINE_JPG;var offline=OFFLINE_JPG;var dc=DC_SWF;var clientHtml=CLIENT_HTML+"?init_color="+button_window_style;var enableDC="true";if(select_assign_type==CLIENT_ASSIGN_DEPT)
{clientHtml+='&init_room='+assign_id;}
else if(select_assign_type==CLIENT_ASSIGN_STAFF)
{clientHtml+='&init_staff='+assign_id;}
if(url!="")
{rootUrl=url;}
switch(button_type)
{case'0':online=ONLINE_JPG;offline=OFFLINE_JPG;break;case'1':online=ONLINE_1_JPG;offline=OFFLINE_1_JPG;break;case'2':online=ONLINE_2_JPG;offline=OFFLINE_2_JPG;break;case'3':online="";offline="";break;case'4':online=onLineText;offline=offLineText;break;default:online=ONLINE_JPG;offline=OFFLINE_JPG;}
if(win_width<495)
{alert("width can't be less than 495");return CLIENT_STANDARD_EMBED_CODE;}
if(win_height<440)
{alert("height can't be less than 440");return CLIENT_STANDARD_EMBED_CODE;}
var embedCode=CLIENT_HTML_CODE_TEMPLATE;var displayOnlineType="";while(embedCode.indexOf("#displayStatusStyle#")!=-1)
{if(typeof(onLineText)=='undefined'&&typeof(offLineText)=='undefined')
{displayOnlineType="BUTTON_TYPE_IMAGE";}
else
{displayOnlineType="BUTTON_TYPE_TEXT";if(typeof(onLineText)=='undefined')
{online="";}
else
{online=onLineText;}
if(typeof(offLineText)=='undefined')
{offline=""}
else
{offline=offLineText;}}
if(online==""&&offline=="")
{displayOnlineType="BUTTON_TYPE_NULL";}
embedCode=embedCode.replace("#displayStatusStyle#",displayOnlineType);}
while(embedCode.indexOf("#chatWindowSkin#")!=-1)
{embedCode=embedCode.replace("#chatWindowSkin#",button_window_style);}
while(embedCode.indexOf("#livestatusjs#")!=-1)
{livestatusjs=rootUrl+'/'+livestatusjs;embedCode=embedCode.replace("#livestatusjs#",livestatusjs);}
while(embedCode.indexOf("#styleCSS#")!=-1)
{styleCSS=rootUrl+'/css/'+styleCSS;embedCode=embedCode.replace("#styleCSS#",styleCSS);}
while(embedCode.indexOf("#mainjs#")!=-1)
{mainjs=rootUrl+'/'+mainjs;embedCode=embedCode.replace("#mainjs#",mainjs);}
if(displayOnlineType=="BUTTON_TYPE_IMAGE")
{online=rootUrl+'/'+online;offline=rootUrl+'/'+offline;}
while(embedCode.indexOf("#online#")!=-1)
{embedCode=embedCode.replace("#online#",online);}
while(embedCode.indexOf("#offline#")!=-1)
{embedCode=embedCode.replace("#offline#",offline);}
clientHtml=rootUrl+'/'+clientHtml;while(embedCode.indexOf("#clienthtmlurl#")!=-1)
{embedCode=embedCode.replace("#clienthtmlurl#",clientHtml);}
while(embedCode.indexOf("#width#")!=-1)
{embedCode=embedCode.replace("#width#",win_width);}
while(embedCode.indexOf("#height#")!=-1)
{embedCode=embedCode.replace("#height#",win_height);}
while(embedCode.indexOf("#define_url#")!=-1)
{embedCode=embedCode.replace("#define_url#",rootUrl);}
if(dc_skin==0)
{enableDC="false";}
var dc_str="";if(enableDC=="true")
{if(dc_app_type==INVIATION_STYLE_SLIDEDOWN)
{dc_str+="var invitation_popup_type=INVIATION_STYLE_SLIDEDOWN;\r\n";}
else
{dc_str+="var invitation_popup_type=INVIATION_STYLE_POPUP;\r\n";}
var INVIATION_STYLE_BLUE=1;var dcSkinStr="";switch(dc_skin)
{case"1":dcSkinStr="INVIATION_STYLE_BROWN";break;case"2":dcSkinStr="INVIATION_STYLE_GREEN";break;case"3":dcSkinStr="INVIATION_STYLE_RED";break;case"4":dcSkinStr="INVIATION_STYLE_ORANAGE";break;case"5":dcSkinStr="INVIATION_STYLE_BLUE";break;case"6":dcSkinStr="INVIATION_STYLE_BLACK";break;case"7":dcSkinStr="INVIATION_STYLE_VIOLET";break;case"8":dcSkinStr="INVIATION_STYLE_CYAN";break;case"0":dcSkinStr="INVIATION_STYLE_NULL";break;}
dc_str+="var invitation_skin="+dcSkinStr+";\r\n"
dc_str+="var invitation_dept_id="+dc_dept+";\r\n"}
while(embedCode.indexOf("#pre_dc#")!=-1)
{embedCode=embedCode.replace("#pre_dc#",dc_str);}
init_dc_skin=dc_skin;if(typeof(deptList)!="undefined"&&deptList.length==0)
{enableDC="false";}
while(embedCode.indexOf("#enableDC#")!=-1)
{embedCode=embedCode.replace("#enableDC#",enableDC);}
var tempAssignType="";while(embedCode.indexOf("#assigntype#")!=-1)
{if(select_assign_type=="1")
{tempAssignType="BUTTON_ASSIGN_DEPT"}
else if(select_assign_type=="2")
{tempAssignType="BUTTON_ASSIGN_STAFF";}
else
{tempAssignType="BUTTON_ASSIGN_NULL";}
embedCode=embedCode.replace("#assigntype#",tempAssignType);}
while(embedCode.indexOf("#pre_id#")!=-1)
{var tempAssignStr="";if(tempAssignType=="BUTTON_ASSIGN_STAFF")
{tempAssignStr="var pre_staff_id=\""+assign_id+"\";\r\n";}
else if(tempAssignType=="BUTTON_ASSIGN_DEPT")
{tempAssignStr="var pre_dept_id=\""+assign_id+"\";\r\n";}
else
{tempAssignStr="";}
embedCode=embedCode.replace("#pre_id#",tempAssignStr);}
while(embedCode.indexOf("#assignid#")!=-1)
{embedCode=embedCode.replace("#assignid#",assign_id);}
while(embedCode.indexOf("#dcappstyle#")!=-1)
{}
if(button_type==NOT_DISPLAY_ONLINE_STATUS&&(dc_skin=="0"||deptList.length==0))
{embedCode=SELECT_NO_DC_NO_POPUP;}
return embedCode;}
function getContentDocument(e)
{if(e.contentDocument){return(e.contentDocument);}else if(e.contentWindow){return(e.contentWindow.document);}else if(e.document){return(e.document);}else{return(undefined);}}
var documentjs={getScripts:function(){var retsrc=new Array();for(var i=0;i<document.getElementsByTagName('script').length;i++){if(document.getElementsByTagName('script')[i].src!=null&&document.getElementsByTagName('script')[i].src!=''){var s=document.getElementsByTagName('script')[i].src;if(s.indexOf('//')>0){s=s.substr(s.indexOf('//')+2);retsrc[retsrc.length]=s.substr(s.indexOf('/'));}else{retsrc[retsrc.length]=s;}}}
return retsrc;},isLoadedByName:function(jsname){var js=documentjs.getScripts();var f=false;for(var i=0;i<js.length;i++){var s=js[i].split('/');if(s[s.length-1].toLowerCase()==jsname.toLowerCase()){f=true;break;}}
return f;},isLoadedByPath:function(path){var js=documentjs.getScripts();var f=false;for(var i=0;i<js.length;i++){if(js[i].toLowerCase()==path.toLowerCase()){f=true;break;}}
return f;},loadScriptHead:function(path){if(!documentjs.isLoadedByPath(path)){head=document.getElementsByTagName('head').item(0);script=document.createElement('script');script.src=path;script.type='text/javascript';script.defer=true;void(head.appendChild(script));}},loadScriptBody:function(path){if(!documentjs.isLoadedByPath(path)){script=document.createElement('script');script.src=path;script.type='text/javascript';script.defer=true;document.body.appendChild(script);}}}
var InternetExplorer=navigator.appName.indexOf("Microsoft")!=-1;if(navigator.appName&&navigator.appName.indexOf("Microsoft")!=-1&&navigator.userAgent.indexOf("Windows")!=-1&&navigator.userAgent.indexOf("Windows 3.1")==-1)
{document.write('<SCRIPT LANGUAGE=VBScript\> \n');document.write('on error resume next \n');document.write('Sub lhclient_FSCommand(ByVal command, ByVal args)\n');document.write(' call lhclient_DoFSCommand(command, args)\n');document.write('end sub\n');document.write('</SCRIPT\> \n');}
function lhclient_DoFSCommand(command,args)
{if((command=="123livehelp")&&(args=="focus"))
{focus();}}
function generateEmbedCodeFromForm()
{var button_type="0";var buttonTypeLength=document.customForm.button_type.length;for(i=0;i<buttonTypeLength;i++)
{if(document.customForm.button_type[i].checked)
{button_type=document.customForm.button_type[i].value;break;}}
var win_width=document.customForm.win_width.value;var win_height=document.customForm.win_height.value;var window_type="0";var window_typeTypeLength=document.customForm.button_window_style.length;for(i=0;i<window_typeTypeLength;i++)
{if(document.customForm.button_window_style[i].checked)
{window_type=document.customForm.button_window_style[i].value;break;}}
var assign_type="0";var assign_id="0";if(typeof(document.customForm.assign_id)=='undefined')
{assignLength=0;}
else
{assignLength=document.customForm.assign_id.length;}
if(typeof(assignLength)=='undefined')
{assign_id=document.customForm.assign_id.value;}
if(assignLength!=0)
{for(i=0;i<assignLength;i++)
{if(document.customForm.assign_id[i].checked)
{assign_id=document.customForm.assign_id[i].value;break;}}
assign_type=document.customForm.select_assign.value;}
var dc_skin="0";dcSkinLength=document.customForm.dc_style.length;for(i=0;i<dcSkinLength;i++)
{if(document.customForm.dc_style[i].checked)
{dc_skin=document.customForm.dc_style[i].value;break;}}
var dc_dept="1";if(deptList.length!=0)
{dcDeptLength=document.customForm.dc_dept.length;if(typeof(dcDeptLength)=='undefined')
{dc_dept=document.customForm.dc_dept.value;}
else
{for(i=0;i<dcDeptLength;i++)
{if(document.customForm.dc_dept[i].checked)
{dc_dept=document.customForm.dc_dept[i].value;break;}}}}
var dc_app_style=document.customForm.select_DC_popup.value;var url=document.customForm.url.value;if(button_type==DISPLAY_ONLINE_STATUS_TEXT)
{var onlineText=document.customForm.online_text.value;var offlineText=document.customForm.offline_text.value;var embedCode=generateCode(button_type,win_width,win_height,window_type,assign_type,assign_id,dc_skin,dc_dept,dc_app_style,url,onlineText,offlineText);}
else if(button_type==NOT_DISPLAY_ONLINE_STATUS)
{var onlineText="";var offlineText="";var embedCode=generateCode(button_type,win_width,win_height,window_type,assign_type,assign_id,dc_skin,dc_dept,dc_app_style,url,onlineText,offlineText);}
else
{var embedCode=generateCode(button_type,win_width,win_height,window_type,assign_type,assign_id,dc_skin,dc_dept,dc_app_style,url);}
if(embedCode==SELECT_NO_DC_NO_POPUP)
{document.customForm.embedCode.disabled=true;}
else
{document.customForm.embedCode.disabled=false;}
document.customForm.embedCode.value=embedCode;}
function showAssign(assignType)
{var assign_html="";document.getElementById("div_assign").innerHTML="";if(assignType==CLIENT_ASSIGN_DEPT)
{if(deptList.length==0)
{document.getElementById("div_assign").innerHTML+='There is no Departments.Please add one in admin panel.'}
for(i=0;i<deptList.length;i++)
{if(i==0)
{document.getElementById("div_assign").innerHTML+='<input type="radio" name="assign_id" value="'+deptList[i][1]+'" checked >'+deptList[i][0]+'<br/>';}
else
{document.getElementById("div_assign").innerHTML+='<input type="radio" name="assign_id" value="'+deptList[i][1]+'" >'+deptList[i][0]+'<br/>';}}}
if(assignType==CLIENT_ASSIGN_STAFF)
{if(staffList.length==0)
{document.getElementById("div_assign").innerHTML+='There is no staff.Please add one in admin panel.'}
for(i=0;i<staffList.length;i++)
{if(i==0)
{document.getElementById("div_assign").innerHTML+='<input type="radio" name="assign_id" value="'+staffList[i]+'" checked >'+staffList[i]+'<br/>';}
else
{document.getElementById("div_assign").innerHTML+='<input type="radio" name="assign_id" value="'+staffList[i]+'" >'+staffList[i]+'<br/>';}}}}
function openCustomClient1()
{var win_width=document.customForm.win_width.value;var win_height=document.customForm.win_height.value;if(win_width<495)
{alert("width can't be less than 495");return;}
if(win_height<440)
{alert("height can't be less than 440");return;}
var window_type="green";var window_typeTypeLength=document.customForm.button_window_style.length;for(i=0;i<window_typeTypeLength;i++)
{if(document.customForm.button_window_style[i].checked)
{window_type=document.customForm.button_window_style[i].value;break;}}
openClientInNewWindow('client.html?init_color='+window_type,win_width,win_height,"","","","");}
function openCustomClient2()
{var init_nickname=document.customForm.init_nickname.value;var init_room=document.customForm.init_room.value;openClientInNewWindow("client.html","","","",init_room,init_nickname,"");}
function getBrowserType()
{if(navigator.userAgent.indexOf("MSIE")>0){return"MSIE";}
if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){return"Firefox";}
if(isSafari=navigator.userAgent.indexOf("Safari")>0){return"Safari";}
if(isCamino=navigator.userAgent.indexOf("Camino")>0){return"Camino";}
if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){return"Gecko";}}
function Department(deptID)
{if(deptID!=null){for(var i in onlineDept)
{if(onlineDept[i][1]==deptID)return true;}}
else
{if(onlineDept.length!=0)return true;}}
var FC_floatX=200;var FC_floatY=-130;var FC_halign="center";var FC_valign="top";var FC_layerwidth=250;var FC_layerheight=200;var FC_delayspeed=5;var FC_lastX=0;var FC_lastY=0;var FC_NS6=false;var FC_IE4=(document.all!=null);if(!FC_IE4){FC_NS6=(document.getElementById!=null);}
var FC_NS4=(document.layers!=null);function FC_adjust(){if((FC_NS4)||(FC_NS6)){if(FC_lastX==-1||FC_delayspeed==0){FC_lastX=window.pageXOffset+FC_floatX;FC_lastY=window.pageYOffset+FC_floatY;}else{var dx=Math.abs(window.pageXOffset+FC_floatX-FC_lastX);var dy=Math.abs(window.pageYOffset+FC_floatY-FC_lastY);var d=Math.sqrt(dx*dx+dy*dy);var c=Math.round(d/10);if(window.pageXOffset+FC_floatX>FC_lastX){FC_lastX=FC_lastX+FC_delayspeed+c;}
if(window.pageXOffset+FC_floatX<FC_lastX){FC_lastX=FC_lastX-FC_delayspeed-c;}
if(window.pageYOffset+FC_floatY>FC_lastY){FC_lastY=FC_lastY+FC_delayspeed+c;}
if(window.pageYOffset+FC_floatY<FC_lastY){FC_lastY=FC_lastY-FC_delayspeed-c;}}
if(FC_NS4){if(document.getElementById('FC_floatlayer')!=null)
{document.layers['FC_floatlayer'].pageX=FC_lastX+"px";document.layers['FC_floatlayer'].pageY=FC_lastY+"px";}}
if(FC_NS6){if(document.getElementById('FC_floatlayer')!=null)
{document.getElementById('FC_floatlayer').style.left=FC_lastX+"px";document.getElementById('FC_floatlayer').style.top=FC_lastY+"px";}}}else if(FC_IE4){if(FC_lastX==-1||FC_delayspeed==0){FC_lastX=document.documentElement.scrollLeft+FC_floatX;FC_lastY=document.documentElement.scrollTop+FC_floatY;}
else
{var dx=Math.abs(document.getElementById('FC_floatlayer').scrollLeft+FC_floatX-FC_lastX);var dy=Math.abs(document.getElementById('FC_floatlayer').scrollTop+FC_floatY-FC_lastY);var d=Math.sqrt(dx*dx+dy*dy);var c=Math.round(d/10);if(document.documentElement.scrollLeft+FC_floatX>FC_lastX){FC_lastX=FC_lastX+FC_delayspeed+c;}
if(document.documentElement.scrollLeft+FC_floatX<FC_lastX){FC_lastX=FC_lastX-FC_delayspeed-c;}
if(document.documentElement.scrollTop+FC_floatY>FC_lastY){FC_lastY=FC_lastY+FC_delayspeed+c;}
if(document.documentElement.scrollTop+FC_floatY<FC_lastY){FC_lastY=FC_lastY-FC_delayspeed-c;}}
document.getElementById('FC_floatlayer').style.posLeft=FC_lastX;document.getElementById('FC_floatlayer').style.posTop=FC_lastY;}
setTimeout("FC_adjust()",50);}
function FC_define(){if((FC_NS4)||(FC_NS6)){switch(FC_halign){case"left":FC_floatX=iFC_floatX;break;case"right":FC_floatX=window.innerWidth-iFC_floatX-FC_layerwidth-20;break;case"center":FC_floatX=Math.round((window.innerWidth-20)/2)-Math.round(FC_layerwidth/2);break;};switch(FC_valign){case"top":FC_floatY=-FC_layerheight;break;case"bottom":FC_floatY=window.innerHeight-iFC_floatY-FC_layerheight;break;case"center":FC_floatY=Math.round((window.innerHeight-20)/2)-Math.round(FC_layerheight/2);break;};}
if(FC_IE4){switch(FC_halign){case"left":FC_floatX=iFC_floatX;break;case"right":FC_floatX=document.body.offsetWidth-iFC_floatX-FC_layerwidth-20;break;case"center":FC_floatX=Math.round((document.body.offsetWidth-20)/2)-Math.round(FC_layerwidth/2);break};switch(FC_valign){case"top":FC_floatY=-FC_layerheight;break;case"bottom":FC_floatY=document.body.offsetHeight-iFC_floatY-FC_layerheight
break;case"center":FC_floatY=Math.round((window.screen.availHeight-20)/2)-Math.round(FC_layerheight/2)
break;}}}
var popwinWidth="216";var popwinHeight="120";var dcfly;function onGetInvite(imgPath,skin,staff,staffMsg,dept){var FC_swfhtmlcode="<div class='dcjux'>";FC_swfhtmlcode+="<div style='height:22px; background:url("+imgPath+"skin/dc/"+skin+"/header.jpg);'>";FC_swfhtmlcode+="<div class='dczuo'><span style='font-weight:bold;' id='white'>"+staff+"</span></div>";FC_swfhtmlcode+="<div class='dcyou'><a href=\"javascript:varToSwf('DCDeny',null,null,null);\"><img src='"+imgPath+"skin/dc/"+skin+"/close_out.gif' onMouseOver='this.src=\""+imgPath+"skin/dc/"+skin+"/close_on.gif\"' onMouseOut='this.src=\""+imgPath+"skin/dc/"+skin+"/close_out.gif\"'></a></div></div>";FC_swfhtmlcode+="<div style='height:89px; background:url("+imgPath+"skin/dc/"+skin+"/bg.jpg);'>";FC_swfhtmlcode+="<div style='height:6px;'><!-- space end--></div><table border=\"0\" align=\"center\"><tr><td>";FC_swfhtmlcode+="<textarea name=\"aa\" rows=\"6\" class=\"dcbobo\">"+staffMsg+"</textarea></td></tr></table>";FC_swfhtmlcode+="<div style='height:8px;'><!-- space end--></div><div style='width:191px; margin:0 auto;'>";FC_swfhtmlcode+="<table border='0' align='center'><tr>";FC_swfhtmlcode+="<td class='dcbtn' style='background:url("+imgPath+"skin/dc/"+skin+"/btn.gif);'><a href=\"javascript:varToSwf('DCAccept','"+staff+"','"+dept+"','"+imgPath+"');\">Accept</a></td>";FC_swfhtmlcode+="<td width='5'><!-- space end--></td>";FC_swfhtmlcode+="<td class='dcbtn' style='background:url("+imgPath+"skin/dc/"+skin+"/btn.gif);'><a href=\"javascript:varToSwf('DCDeny',null,null,null);\">Deny</a></td></tr></table></div></div>";FC_swfhtmlcode+="<div><img src='"+imgPath+"skin/dc/"+skin+"/foot.jpg'></div></div>";document.getElementById('FC_floatlayer').innerHTML=FC_swfhtmlcode;window.focus();this.focus();FC_halign="center";FC_valign="center";FC_define();}
function onCloseInvite()
{if(dcfly==0){document.getElementById('FC_floatlayer').style.visibility='hidden';}
FC_halign="center";FC_valign="top";FC_define();}
function startDC(fly)
{dcfly=fly;var FC_swfhtmlcode="";var myFC_popwincode="";if(FC_NS4){myFC_popwincode+='<layer NAME="FC_floatlayer" bgcolor="#000000" width="1" height="1" LEFT="'+FC_floatX+'"px TOP="'+FC_floatY+'"px>';}else if((FC_IE4)||(FC_NS6)){if(document.body==null){myFC_popwincode+="<body>";}
myFC_popwincode+="<div id=\"FC_floatlayer\" style=\"width:1px; height:1px; left:"+FC_floatX+"px; top:"+FC_floatY+"px; position:absolute;\">";if(document.body==null){myFC_popwincode+="</body>";}}
if(FC_NS4){myFC_popwincode+='</layer>';}else if((FC_IE4)||(FC_NS6)){myFC_popwincode+="<\/div>";}
document.write(myFC_popwincode);var iFC_floatX=FC_floatX;var iFC_floatY=FC_floatY;var FC_lastX=FC_floatX;var FC_lastY=FC_floatY;window.onresize=FC_define;if(document.body!=null)
{FC_adjust();FC_halign="center";if(dcfly==0){FC_valign="center";}else{FC_valign="top";}
FC_define();}}
function varToSwf(args,staff,dept,imgpath)
{if(args=="DCAccept"){openClientWindow(dept,staff,imgpath);}
onCloseInvite();window.document.topcmm_123livehelp_dc.SetVariable("invite.Status",args);}
function openClientWindow(initroom,initstaff,imgpath)
{var vars="";if(initroom==""){vars="?init_staff="+initstaff+"&init_dc=1";}
else{vars="?init_room="+initroom+"&init_staff="+initstaff+"&init_dc=1";}
var win_width_dc="495";var win_height_dc="440";window.open(imgpath+"client.html"+vars,'',"resizable=yes,width=520,height=450,status=yes");}
function livehelp()
{var client_html_url=define_url+"/client.html?init_color="+chat_window_skin;if(enable_invitation)
{var dc_url=define_url+"/dc.swf?skin="+invitation_skin+"&init_room="+invitation_dept_id;}
var button_assign_id="";if(button_assign_type==BUTTON_ASSIGN_NULL)
{button_assign_id=0;}
else if(button_assign_type==BUTTON_ASSIGN_DEPT)
{button_assign_id=pre_dept_id;client_html_url+="&init_room="+button_assign_id;}
else
{button_assign_id=pre_staff_id;client_html_url+="&init_staff="+button_assign_id;}
if(button_type==BUTTON_TYPE_IMAGE)
{displayStatusImg(button_assign_type,button_assign_id,online_display,offline_display,client_html_url,chat_window_width,chat_window_height);}
else if(button_type==BUTTON_TYPE_TEXT)
{displayStatusText(button_assign_type,button_assign_id,online_display,offline_display,client_html_url,chat_window_width,chat_window_height);}
if(enable_invitation)
{startDC(invitation_popup_type);openSWF(dc_url,"1","1","dc","topcmm_123livehelp_dc");}}