function StatusManager(h,k,l,m,n){this.staffId=h;this.gpId=k;this.showQueueDiv=true;this.queueId=l;this.queueNO=m;this.queueLength=0;this.ClientType=null;this.version=n;this.ud="";var o=null,i=null,a=this;this.spanQueueLengthId1="spanLength1";this.spanQueueLengthId2="spanLength2";this.divQueueInfo_Offline="divOffline";this.divQueueInfo1="divBeforeQueue";this.divQueueInfo2="divEnterQueue";this.WaitInfo="WaitNumber";this.start=function(){window.attachEvent("onload",this.onloadHandler)};String.prototype.Trim=
function(){return this.replace(/(^s*)|(s*$)/g,"")};this.onloadHandler=function(){var b=a.getRefreshInterval();a.CheckSupporterStatus();o=window.setInterval(a.CheckSupporterStatus,b*1E3);if(a.queueId!=null&&a.queueId!=""){i=window.setInterval(a.checkQueueStatus,2E3);if($("linkJoinQueue")!=null)$("linkJoinQueue").style.display="none"}else if($("linkJoinQueue")!=null)$("linkJoinQueue").style.display="inline"};this.beforeUnloadHandler=function(){if(a.queueId!=null&&a.queueId!="")return GlobalString.RefreshStatus_CloseWindow};
this.unloadHandler=function(){a.queueId!=null&&a.queueId!=""&&Service_Index.ExitQueue(a.queueId)};this.getRefreshInterval=function(){var b=10,c=document.getElementById("aspnetForm");if(c.attributes.RefreshInterval){c=c.attributes.RefreshInterval;if(!isNaN(c.value))if(c.value!=0)b=parseInt(c.value)}return b};this.checkQueueStatus=function(){Service_Index.GetQueueInfo(a.queueId,a.checkQueueStatus_callback)};this.checkQueueStatus_callback=function(b){if(!(b.error!=null||b.value==null)){b=b.value;if(b.State!=
1){var c=a.queueId;a.queueId="";window.clearInterval(i);if(b.State==2)AjaxMethods.QueuedUserStartService(c,a.requestService_callback);else if(b.State==4){if($("linkJoinQueue")!=null)$("linkJoinQueue").style.display="inline";AjaxMethods.GetSpCurrentStatus(a.staffId,a.gpId,a.queueNO,a.send_callback);alert(GlobalString.RefreshStatus_NotSupporterAccept)}}}};this.GetUserInfo=function(){Service_Index.ShowEuInfo(euid,a.GetUserInfo_callback)};this.GetUserInfo_callback=function(b){if(b.error!=null){if($("divError")!=
null)$("divError").style.display="block"}else{if($("divError")!=null)$("divError").style.display="none";b.value!=null&&alert(b.value.name)}};this.LocalSendMail=function(b){if($("txtBody").value.Trim()==""){$("lblSending").style.display="none";alert(GlobalString.RefreshStatus_NotText)}else AjaxMethods.SendMailEx(b,$("txtBody").value,$("txtContact").value,$("txtTelephone").value,$("txtEMail").value,$("txtCompany").value,a.SendMail_callback)};this.SendMail_callback=function(b){$("lblSending").style.display=
"none";if(b.error!=null)alert(b.error);else if(b.value==""){alert(GlobalString.RefreshStatus_SendSuccess);$("divInfoLayer").style.display="none"}else alert(b.value)};this.SendMessage=function(){Service_Index.SendMessage($("UserName").value+"|"+$("CompanyName").value+"|"+$("MailAddress").value+"|"+$("ContactPerson").value+"|"+$("ContactPhone").value+"|"+$("CompanyPage").value+"|"+$("MessageText").value,a.SendMessage_callback)};this.SendMessage_callback=function(b){if(b.error!=null)$("divError").style.display=
"block";else{$("divError").style.display="none";if(b.value==""){alert(GlobalString.RefreshStatus_SendSuccess);$("divInfoLayer").style.display="none"}else alert(b.value)}};this.CheckSupporterStatus=function(){a.showQueueDiv=true;AjaxMethods.GetSpCurrentStatus(a.staffId,a.gpId,a.queueNO,a.send_callback)};this.send_callback=function(b){if(b.error!=null)$("divError").style.display="block";else{$("divError").style.display="none";var c=b.value;if(c!=null)if(c.Supporters!=null){var d=c.ServiceMode;if(d==
2)window.location="CustomerLogin.aspx?GpId=&ClientType="+a.ClientType+"&Version="+a.version+"&id="+h;else if(d==3)window.location="AutoLogin.aspx?StaffId="+h;else{d=$A(c.Supporters);a.queueLength=c.QueueLength;d.each(function(e){var g=$("T"+e.Id);g!=null&&a.SetSpInfo(e.WebStatus,g,e.Id,c,e.AssignNum,e.ServiceNumber,e.SpServiceNumber,e.Version)});if($("divError")!=null)$("divQueue").style.display=a.showQueueDiv?"block":"none";d=a.queueId!=null&&a.queueId!="";if($(a.spanQueueLengthId2)!=null)$(a.spanQueueLengthId2).innerHTML=
b.value.NoofBeforeMe;if($(a.spanQueueLengthId1)!=null)$(a.spanQueueLengthId1).innerHTML=b.value.QueueLength;if($(a.divQueueInfo2)!=null)$(a.divQueueInfo2).style.display=d?"block":"none";if($(a.divQueueInfo_Offline)!=null)$(a.divQueueInfo_Offline).style.display=!d&&b.value.AllOffline?"block":"none";if($(a.WaitInfo)!=null){var f=a.ClientType;if(a.ClientType.toLowerCase()!="installableclient"){a.ClientType="";f="iscompact"}f="'AutoQueuing.aspx?Action=JoinQueue&StaffId="+a.staffId+"&GpID="+a.gpId+"&ClientType="+
f+"&EuId=&Version="+a.version+"'";f=a.ClientType.toLowerCase()=="installableclient"?"window.location= "+f+";return false;":"window.open("+f+",'','width=593,height=423,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');return false";tdJoinQueue.innerHTML="<A href='Javascript:void(0);' onclick=\""+f+"\" onMouseOver=\"MM_swapImage('queue','','"+GlobalString.Index_supportcenterqueueicon1+'\',1)" onMouseOut="MM_swapImgRestore()"><img src=\''+GlobalString.Index_supportcenterqueueicon1+
"' name='queue' height='18' border='0' id='queue'></A>"}if($(a.divQueueInfo1)!=null)$(a.divQueueInfo1).style.display=!d&&!b.value.AllOffline&&!b.value.ReadySupporterCount?"block":"none";if(b.value.ReadySupporterCount==0&&b.value.AllOffline){$(a.divQueueInfo1).style.display="none";$(a.divQueueInfo_Offline).style.display="block"}if($("divOuter")!=null&&$("divOuter").offsetTop>0)$("divOuter").style.marginTop=$("divOuter").offsetTop*-1}}}};this.SetSpInfo=function(b,c,d,f,e,g,j,p){c=c.cells[2];if(b!="A")supportStatus.title=
"";switch(b){case "B":c.innerHTML="<img src='"+GlobalString.Index_supportcenterblogin+"' width='68' height='19' border='0'>";break;case "E":c.innerHTML="<img src='"+GlobalString.Index_supportcenterbbusy+"' width='68' height='19' border='0'>";if(j!=0&&g>=j||p==0)break;case "C":if(e>0)c.innerHTML="<img src='"+GlobalString.Index_supportcenterbqueue+"' width='68' height='19' border='0'>";else{navigator.appVersion.split(";")[1].replace(/[ ]/g,"");b=(new Date).getTime()*10+Math.round(Math.random()*9)+1;
e="'PrepareWebChat.aspx?StaffId="+a.staffId+"&GroupID="+a.gpId+"&QueueId="+a.queueId+"&QueueNo="+a.queueNO+"&ClientType="+a.ClientType+"&spanQueueLengthId1="+a.spanQueueLengthId1+"&spanQueueLengthId2="+a.spanQueueLengthId2+"&divQueueInfo_Offline="+a.divQueueInfo_Offline+"&divQueueInfo1="+a.divQueueInfo1+"&divQueueInfo2="+a.divQueueInfo2+"&Version="+a.version+"&EuId=&SpId="+d+"'";e=a.ClientType.toLowerCase()=="installableclient"?"window.location= "+e+";return false;":"window.open("+e+",'"+b+"','width=593,height=423,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');";
c.innerHTML="<A href='Javascript:void(0);' onclick=\"if(this.disabled != true){"+e+';}else{return false;};this.disabled = true;" onMouseOver="MM_swapImage(\'St_'+d+"','','"+GlobalString.Index_supportcenterbrequest2+'\',1)" onMouseOut="MM_swapImgRestore()"><img src=\''+GlobalString.Index_supportcenterbrequest1+"' width='68' height='19' border='0' id=\"St_"+d+'"></A>'}a.showQueueDiv=a.queueLength>0;break;case "D":break;case "F":c.innerHTML="<img src='"+GlobalString.Index_supportcenterblogout+"' width='68' height='19' border='0'>";
break;case "G":c.innerHTML="<img src='"+GlobalString.Index_supportcenterbreboot+"' width='68' height='19' border='0'>";break;case "L":c.innerHTML="<img src='"+GlobalString.Index_supportcenteraway+"' width='68' height='19' border='0'>";break;case "A":default:c.innerHTML="<img src='"+GlobalString.Index_supportcenterboffline1+"' width='68' height='19' border='0'>";break}};this.requestService=function(b){AjaxMethods.RequestService(b,"","",a.version,a.queueId,a.requestService_callback)};this.requestService_callback=
function(b){if(b.error!=null||b.value==null)alert(GlobalString.Index_Send_Raise_Error);else{b=b.value;if(b.ResponseType==1)window.location=b.LoginUrl+"&GpId="+a.gpId+"&ClientType="+a.ClientType;else if(b.ResponseType==2)window.location="WebChat.aspx?SpId="+b.SpId+"&ECharacterId="+b.ECharacterId+"&Version="+a.version+"&ClientType="+a.ClientType;else if(b.ResponseType==3)window.location="FlyForceDown.aspx?SpId="+b.SpId+"&EuId=0&ECharacterId="+b.ECharacterId+"&Version="+a.version+"&ClientType="+a.ClientType;
else b.ResponseType==4?alert(GlobalString.Index_NO_Authorise):alert(GlobalString.Index_Send_Fail)}};this.ShowLayer=function(b,c,d,f,e,g){b=document.getElementById(b);if(b!=null)if(c){if(d==""||f=="")if(ie){d=document.body.offsetWidth-e*2;f=document.body.offsetHeight-g*2}else{d=window.innerWidth-e*2;f=window.innerHeigth-g*2}b.width=d;b.height=f;b.style.display="block";b.style.zIndex=100;c=0;d=(document.body.offsetWidth-d)/2;c=(document.body.offsetHeight-f)/2;b.style.top=c;b.style.left=d}else b.style.display=
"none"}};