Вы находитесь на странице: 1из 23

// livechat by http://www.mylivechat.

com/ 20121121
if(typeof(MyLiveChat)=="undefined")
{
MyLiveChat={};
MyLiveChat.PageBeginTime=new Date().getTime();
MyLiveChat.LoadingHandlers=[];
MyLiveChat.CPRFIELDS=["SyncType","SyncStatus","SyncResult","HasReadyAgen
ts","Departments","VisitorUrls","VisitorStatus","VisitorDuration","VisitorEntryU
rl","VisitorReferUrl"];
}
//rating:16.819709944693
MyLiveChat.Version=1008;
MyLiveChat.FirstRequestTimeout=12000;
MyLiveChat.NextRequestTimeout=48000;
MyLiveChat.SyncType=''
MyLiveChat.SyncStatus="LOADING";
MyLiveChat.SyncUserName=null;
MyLiveChat.SyncResult="LOADING";
MyLiveChat.HasReadyAgents=false;
MyLiveChat.Departments=[];
MyLiveChat.Departments.push({
Name:"Support",
Agents:[{
Id:'User:1',
Name:'Ankush Mehrotra',
Online:false
}],
Online:false
});
//the visitor properties will be set after sync
MyLiveChat.VisitorUrls=[];
MyLiveChat.VisitorStatus="";
MyLiveChat.VisitorDuration=0;
MyLiveChat.VisitorEntryUrl="";
MyLiveChat.VisitorReferUrl="";
MyLiveChat.HomePage="http://www.mylivechat.com";
MyLiveChat.HCCID='45791519';
MyLiveChat.ShowButton=true;
MyLiveChat.ShowLink=true;
MyLiveChat.ShowBox=true;
MyLiveChat.ShowInvite=true;
MyLiveChat.ShowSmart=true;
MyLiveChat.ScriptUrl="https://chat1.mylivechat.com/livechat/livechat.aspx?hccid=
45791519\x26apimode=chatwidget\x26_r=4c5d988c-b592-4929-8a67-ad46014c6ee2";
MyLiveChat.SiteUrl="https://chat1.mylivechat.com/";
MyLiveChat.UrlBase="https://chat1.mylivechat.com/livechat/";
MyLiveChat.RandomID='b54aa08b-27f3-4a30-b4f4-b3bf77eb7409';
MyLiveChat.FeedbackBehavior=''||"Show";
MyLiveChat.ButtonOnlineTooltip=null||"";
MyLiveChat.ButtonOfflineTooltip=null||"";
MyLiveChat.ButtonOnlineImage=''||"1";
MyLiveChat.ButtonOfflineImage=''||"1";
if(MyLiveChat.ButtonOnlineImage=="upload")
MyLiveChat.ButtonOnlineImage=MyLiveChat.SiteUrl+"Customization/Customer/
"+MyLiveChat.HCCID+"/ButtonOnlineImage.gif";
else
MyLiveChat.ButtonOnlineImage=MyLiveChat.SiteUrl+"Customization/Template/
ButtonOnlineImage_"+MyLiveChat.ButtonOnlineImage+".gif";
if(MyLiveChat.ButtonOfflineImage=="upload")
MyLiveChat.ButtonOfflineImage=MyLiveChat.SiteUrl+"Customization/Customer
/"+MyLiveChat.HCCID+"/ButtonOfflineImage.gif";
else
MyLiveChat.ButtonOfflineImage=MyLiveChat.SiteUrl+"Customization/Template
/ButtonOfflineImage_"+MyLiveChat.ButtonOfflineImage+".gif";
MyLiveChat.ButtonOnlineImage=MyLiveChat.ButtonOnlineImage+"?"+MyLiveChat.Version
;
MyLiveChat.ButtonOfflineImage=MyLiveChat.ButtonOfflineImage+"?"+MyLiveChat.Versi
on;
MyLiveChat.LinkOnlineTooltip=null||"";
MyLiveChat.LinkOfflineTooltip=null||"";
MyLiveChat.LinkOnlineCode=null||"Click here to chat";
MyLiveChat.LinkOfflineCode=null||"Click here to leave a message";
MyLiveChat.BoxOnlineCode=null||"Online";
MyLiveChat.BoxOfflineCode=null||"Leave a message";
MyLiveChat.BoxOnlineTooltip=null||"";
MyLiveChat.BoxOfflineTooltip=null||"";
MyLiveChat.BoxPrompt="Type your question here and click below...";
MyLiveChat.BoxMessage=null||MyLiveChat.BoxPrompt;
MyLiveChat.BoxOnlinePhoto=''||"1";
MyLiveChat.BoxOfflinePhoto=''||"1";
if(MyLiveChat.BoxOnlinePhoto=="upload")
MyLiveChat.BoxOnlinePhoto=MyLiveChat.SiteUrl+"Customization/Customer/"+M
yLiveChat.HCCID+"/BoxOnlinePhoto.gif";
else
MyLiveChat.BoxOnlinePhoto=MyLiveChat.SiteUrl+"Customization/Template/Box
OnlinePhoto_"+MyLiveChat.BoxOnlinePhoto+".gif";
if(MyLiveChat.BoxOfflinePhoto=="upload")
MyLiveChat.BoxOfflinePhoto=MyLiveChat.SiteUrl+"Customization/Customer/"+
MyLiveChat.HCCID+"/BoxOfflinePhoto.gif";
else
MyLiveChat.BoxOfflinePhoto=MyLiveChat.SiteUrl+"Customization/Template/Bo
xOfflinePhoto_"+MyLiveChat.BoxOfflinePhoto+".gif";
MyLiveChat.BoxOnlinePhoto=MyLiveChat.BoxOnlinePhoto+"?"+MyLiveChat.Version;
MyLiveChat.BoxOfflinePhoto=MyLiveChat.BoxOfflinePhoto+"?"+MyLiveChat.Version;
MyLiveChat.DialogWidth=parseInt('580')||580;
MyLiveChat.DialogHeight=parseInt('420')||420;
MyLiveChat.DialogOption = "status=1,width="+MyLiveChat.DialogWidth+",height="+My
LiveChat.DialogHeight+",resizable=1";
MyLiveChat.DialogOption+=",left="+Math.floor((screen.availWidth-MyLiveChat.Dialo
gWidth)/2)
MyLiveChat.DialogOption+=",top="+Math.floor((screen.availHeight-MyLiveChat.Dialo
gHeight)/2)
MyLiveChat.PopupBlockedMsg="Pop-up blocker detected.";
MyLiveChat.InviteTemplate=''||"1";
MyLiveChat.InvitePosition=''||"middlecenter";
MyLiveChat.InviteStartPos=''||"topcenter";
MyLiveChat.InviteOffsetX=parseInt('')||0;
MyLiveChat.InviteOffsetY=parseInt('')||-100;
MyLiveChat.InvitePhoto='2'||"1";
MyLiveChat.InviteHeadline="Chat Invitation"||"Chat Invitation";
MyLiveChat.InviteMessage="Hello, my name is ANKUSH MEHROTRA. How can I help you
today at freshjob?"||"Hello, my name is (AGENT). How may I help you today?";
if(MyLiveChat.InvitePhoto=="upload")
MyLiveChat.InvitePhoto=MyLiveChat.SiteUrl+"Customization/Customer/"+MyLi
veChat.HCCID+"/InvitePhoto.gif";
else
MyLiveChat.InvitePhoto=MyLiveChat.SiteUrl+"Customization/Template/Invite
Photo_"+MyLiveChat.InvitePhoto+".gif";
MyLiveChat.InvitePhoto=MyLiveChat.InvitePhoto+"?"+MyLiveChat.Version;
MyLiveChat.InviteUseAgentPhoto=false;
MyLiveChat.InviteAcceptText=null||"Chat Now";
MyLiveChat.InviteRejectText=null||"No Thanks";
MyLiveChat.InviteShowTimeout=parseInt('120')||0;
MyLiveChat.SmartTemplate='7'||"1";
MyLiveChat.SmartPosition=''||"bottomright";
MyLiveChat.SmartStartPos=''||"topright";
MyLiveChat.SmartOffsetX=parseInt('')||0;
MyLiveChat.SmartOffsetY=parseInt('')||0;
MyLiveChat.SmartCondition='online'||"always";
MyLiveChat.SmartPhoto='12'||"1";
MyLiveChat.SmartHeadline="Chat Invitation"||"Chat Invitation";
MyLiveChat.SmartMessage="How May I help you Today?"||"May I help you?";
MyLiveChat.SmartShowDepartments=''||"All";
MyLiveChat.SmartClickOfflineItem=''||"PreChat";
MyLiveChat.SmartShowOfflineText=null||"";
if(MyLiveChat.SmartPhoto=="upload")
MyLiveChat.SmartPhoto=MyLiveChat.SiteUrl+"Customization/Customer/"+MyLiv
eChat.HCCID+"/SmartPhoto.gif";
else
MyLiveChat.SmartPhoto=MyLiveChat.SiteUrl+"Customization/Template/SmartPh
oto_"+MyLiveChat.SmartPhoto+".gif";
MyLiveChat.SmartPhoto=MyLiveChat.SmartPhoto+"?"+MyLiveChat.Version;
MyLiveChat.SmartAcceptText=null||"Chat Now";
MyLiveChat.SmartRejectText=null||"No Thanks";
MyLiveChat.SmartPhotoWidth=128;
MyLiveChat.SmartMaxReject=parseInt("2")||2;
MyLiveChat.SmartUseMaxReject=("0"!='1');
MyLiveChat.SmartMaxIgnore=parseInt("2")||2;
MyLiveChat.SmartUseMaxIgnore=("0"!='1');
MyLiveChat.SmartHideTimeout=60 * (parseInt("10")||10);
MyLiveChat.SmartUseHideTimeout=("0"!='1');
if(!MyLiveChat.SmartUseHideTimeout)
{
MyLiveChat.SmartHideTimeout=0;
}
MyLiveChat.SmartShowTimeout=parseInt("120")||60;
MyLiveChat.SmartUseShowTimeout=("0"!='1');
MyLiveChat.SmartHideIfChatting=("0"!='1');
MyLiveChat.SmartPlaySound=("0"!='1');
MyLiveChat.SmartSoundFile=parseInt("1")||1;
MyLiveChat.SmartUsePageCount=("0"!='1');
MyLiveChat.SmartPageCount=parseInt("2")||5;
MyLiveChat.SmartUsePageTime=("0"!='1');
MyLiveChat.SmartPageTime=parseInt("60")||30;
MyLiveChat.SmartUseStayTime=("0"!='1');
MyLiveChat.SmartStayTime=parseInt("120")||120;
MyLiveChat.SmartUseVisitUrlFilter=("0"!='1');
MyLiveChat.SmartVisitUrlFilter=""
MyLiveChat.SmartUseEntryUrlFilter=("0"!='1');
MyLiveChat.SmartEntryUrlFilter=""
MyLiveChat.SmartUseReferUrlFilter=("0"!='1');
MyLiveChat.SmartReferUrlFilter=""
MyLiveChat.SmartUseKeywordsFilter=("0"!='1');
MyLiveChat.SmartKeywordsFilter=""
MyLiveChat.SmartAcceptTooltip="Chat Invitation"
MyLiveChat.SmartRejectTooltip="Close"
MyLiveChat.InviteAcceptTooltip="Chat Invitation"
MyLiveChat.InviteRejectTooltip="Close"
MyLiveChat.InvitePlaySound = ("0"!='1');
MyLiveChat.InviteSoundFile='1'||"1";
MyLiveChat.InPageTemplate=''||"1";
MyLiveChat.InPagePosition=''||"bottomright";
MyLiveChat.InPageStartPos=''||"bottomright";
MyLiveChat.InPageOffsetX=parseInt('')||0;
MyLiveChat.InPageOffsetY=parseInt('')||0;
MyLiveChat.InPageHeadBgColor=''||"";
MyLiveChat.InPageHeadBorderColor=''||"";
MyLiveChat.InPageHeadBorderWidth=''||"1";
MyLiveChat.InPageHeadColor=''||"white";
MyLiveChat.InPageHeadFont=''||"";
MyLiveChat.InPageHeadOffline=null;
MyLiveChat.InPageHeadOnline=null;
MyLiveChat.InPageHeadSize=''||"15px";
MyLiveChat.InPageImageOnline = ''||"1";
MyLiveChat.InPageImageOffline = ''||"1";
MyLiveChat.InPageImageUrlOnline = ''||"";
MyLiveChat.InPageImageUrlOffline = ''||"";
if(MyLiveChat.InPageImageOnline!="custom")
MyLiveChat.InPageImageUrlOnline=MyLiveChat.SiteUrl+"Customization/Templa
te/InPageImageOnline_"+MyLiveChat.InPageImageOnline+".png";
if(MyLiveChat.InPageImageOffline!="custom")
MyLiveChat.InPageImageUrlOffline=MyLiveChat.SiteUrl+"Customization/Templ
ate/InPageImageOffline_"+MyLiveChat.InPageImageOffline+".png";
MyLiveChat.InPageBubbleTopClosed = false;
MyLiveChat.InPageUseBubbleTop = ''=="1";
MyLiveChat.InPageBubbleTop = ''||"1";
MyLiveChat.InPageBubbleTopUrl = ''||"";
if(MyLiveChat.InPageBubbleTopUrl!="custom")
MyLiveChat.InPageBubbleTopUrl=MyLiveChat.SiteUrl+"Customization/Template
/InPageBubbleTop_"+MyLiveChat.InPageBubbleTop+".png";
MyLiveChat.WidgetStartPos=''||"middleleft";
MyLiveChat.WidgetPosition=''||"middleleft";
MyLiveChat.WidgetOffsetX=parseInt('')||0;
MyLiveChat.WidgetOffsetY=parseInt('')||0;
//if(isNaN(MyLiveChat.WidgetOffsetX))MyLiveChat.WidgetOffsetX=-80;
//if(isNaN(MyLiveChat.WidgetOffsetY))MyLiveChat.WidgetOffsetY=-120;
MyLiveChat.WidgetHoverOffsetX=parseInt('')||0;
MyLiveChat.WidgetHoverOffsetY=parseInt('')||MyLiveChat.WidgetOffsetY;
MyLiveChat.WidgetBodyPadding=parseInt('')||0;
MyLiveChat.WidgetOnlineImage=''||'1';
MyLiveChat.WidgetOfflineImage=''||'1';
MyLiveChat.WidgetOnlineImageUrl=''||'';
MyLiveChat.WidgetOfflineImageUrl=''||'';
MyLiveChat.WidgetHoverOnlineImage=''||'1';
MyLiveChat.WidgetHoverOfflineImage=''||'1';
MyLiveChat.WidgetHoverOnlineImageUrl=''||'';
MyLiveChat.WidgetHoverOfflineImageUrl=''||'';
if(MyLiveChat.WidgetOnlineImage!="custom")
MyLiveChat.WidgetOnlineImageUrl=MyLiveChat.SiteUrl+"Customization/Templa
te/WidgetOnlineImage_"+MyLiveChat.WidgetOnlineImage+".png";
if(MyLiveChat.WidgetOfflineImage!="custom")
MyLiveChat.WidgetOfflineImageUrl=MyLiveChat.SiteUrl+"Customization/Templ
ate/WidgetOfflineImage_"+MyLiveChat.WidgetOfflineImage+".png";
if(MyLiveChat.WidgetHoverOnlineImage!="custom")
MyLiveChat.WidgetHoverOnlineImageUrl=MyLiveChat.SiteUrl+"Customization/T
emplate/WidgetHoverOnlineImage_"+MyLiveChat.WidgetHoverOnlineImage+".png";
if(MyLiveChat.WidgetHoverOfflineImage!="custom")
MyLiveChat.WidgetHoverOfflineImageUrl=MyLiveChat.SiteUrl+"Customization/
Template/WidgetHoverOfflineImage_"+MyLiveChat.WidgetHoverOfflineImage+".png";
(function(){
if(MyLiveChat.localStorage||MyLiveChat.userDataBehavior)
return;
MyLiveChat.localStorage = window.localStorage;
if (!window.localStorage && /MSIE/.test(navigator.userAgent))
{
MyLiveChat.userDataBehavior = document.documentElement;
MyLiveChat.userDataBehavior.style.behavior="url('#default#userData')";
}
})();
function MyLiveChat_CheckUserDataBehavior() {
if (!MyLiveChat.userDataBehavior) return false;
if (!("load" in MyLiveChat.userDataBehavior)) return false;
MyLiveChat.userDataBehavior.load("mlc");
return true;
}
function MyLiveChat_GetLocalData(name)
{
if (MyLiveChat.localStorage) {
var val=MyLiveChat.localStorage.getItem("mlcv-" + name);
var exp=MyLiveChat.localStorage.getItem("mlce-" + name);
if(exp&&new Date().getTime()>exp)
return null;
return val;
}
if (MyLiveChat_CheckUserDataBehavior()) {
var val=MyLiveChat.userDataBehavior.getAttribute("mlcv-"+name);
var exp=MyLiveChat.userDataBehavior.getAttribute("mlce-"+name);
if(exp&&new Date().getTime()>parseInt(exp))
return null;
return val;
}
var cookies=document.cookie.split(';');
for(var i=0;i<cookies.length;i++)
{
var parts=cookies[i].split('=');
if(name==parts[0].replace(/\s/g,''))
return unescape(parts[1])
}
}
function MyLiveChat_SetLocalData(name,value,seconds)
{
if (MyLiveChat.localStorage) {
MyLiveChat.localStorage.setItem("mlcv-" + name, value);
MyLiveChat.localStorage.setItem("mlce-" + name, String(new Date().getTim
e()+(seconds||3600)*1000));
return;
}
if (MyLiveChat_CheckUserDataBehavior()) {
MyLiveChat.userDataBehavior.setAttribute("mlcv-"+name, value);
MyLiveChat.userDataBehavior.setAttribute("mlce-" + name, String(new Date
().getTime()+(seconds||3600)*1000));
MyLiveChat.userDataBehavior.save("mlc");
return;
}
var cookie=name+"="+escape(value)+"; path=/;";
if(seconds)
{
var d=new Date();
d.setSeconds(d.getSeconds()+seconds);
cookie+=" expires="+d.toUTCString()+";";
}
document.cookie=cookie;
}
function MyMyLiveChat_SmartTriggers()
{
//for this page
if(MyLiveChat.SmartAccepted)
return false;
if(MyLiveChat.SmartRejected)
return false;
if(MyLiveChat.SmartHideIfChatting)
{
if(MyLiveChat.VisitorStatus!="VISIT")
{
return false;
}
}
if(MyLiveChat_GetLocalData("MLCSmart"))
{
if(new Date().getTime()/1000-(parseFloat(MyLiveChat_GetLocalData
("MLCSmartTime"))||0)/1000 < MyLiveChat.SmartHideTimeout)
{
if(MyLiveChat.SmartUseMaxReject&&MyLiveChat.SmartMaxReje
ct>0)
{
if( (parseInt(MyLiveChat_GetLocalData("MLCSmartR
ejectCount"))||0) >= MyLiveChat.SmartMaxReject)
{
return false;
}
}
if(MyLiveChat.SmartUseMaxIgnore&&MyLiveChat.SmartMaxIgno
re>0)
{
if( (parseInt(MyLiveChat_GetLocalData("MLCSmartI
gnoreCount"))||0) >= MyLiveChat.SmartMaxIgnore)
{
return false;
}
}
}
}
if(MyLiveChat.SmartUsePageCount&&MyLiveChat.VisitorUrls.length>=MyLiveCh
at.SmartPageCount)
{
return true;
}
if(MyLiveChat.SmartUseStayTime&&MyLiveChat.VisitorDuration>MyLiveChat.Sm
artStayTime)
{
return true;
}
if(MyLiveChat.SmartUsePageTime)
{
var pagetime=new Date().getTime()/1000-MyLiveChat.PageBeginTime/
1000;
if(pagetime>MyLiveChat.SmartPageTime)
{
return true;
}
}
if(MyLiveChat.SmartUseVisitUrlFilter&&MyLiveChat.SmartVisitUrlFilter)
{
if(MyLiveChat_SmartIsMatch(window.location.href,MyLiveChat.Smart
VisitUrlFilter))
return true;
}
if(MyLiveChat.SmartUseEntryUrlFilter&&MyLiveChat.SmartEntryUrlFilter)
{
if(MyLiveChat_SmartIsMatch(MyLiveChat.VisitorEntryUrl,MyLiveChat
.SmartEntryUrlFilter))
return true;
}
if(MyLiveChat.SmartUseReferUrlFilter&&MyLiveChat.SmartReferUrlFilter)
{
if(MyLiveChat_SmartIsMatch(MyLiveChat.VisitorReferUrl,MyLiveChat
.SmartReferUrlFilter))
return true;
}
if(MyLiveChat.SmartUseKeywordsFilter&&MyLiveChat.SmartKeywordsFilter)
{
if(MyLiveChat.VisitorReferUrl)
{
var qs=MyLiveChat.VisitorReferUrl.split('#')[0].split('?
')[1];
if(qs)
{
qs=qs.split('&');
for(var i=0;i<qs.length;i++)
{
var value=qs[i].split('=')[1];
if(MyLiveChat_SmartIsMatch(value,MyLiveC
hat.SmartKeywordsFilter))
return true;
//alert([value,MyLiveChat.SmartKeywordsF
ilter])
}
}
}
}
return false;
}
function MyLiveChat_SmartIsMatch(data,filter)
{
if(!data)return false;
if(!filter)return false;
var arr=filter.toLowerCase().split(',');
for(var i=0;i<arr.length;i++)
{
var item=arr[i].replace(/(^\s+)|(\s+$)/g,"");
if(!item)continue;
if(data.toLowerCase().indexOf(item)!=-1)
return true;
}
}
function MyLiveChat_HtmlEncode(text)
{
if(!text)return "";
return text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt
;").replace(/\x22/g,"&quot;")
.replace(/\x27/g,"&#39;").replace(/\n/g,"<br/>").replace(/\r/g,"
");
}
function MyLiveChat_InvokeEvent(name,param)
{
//known events : Loading,ShowInvite,HideInvite,ShowSmart,HideSmart,Smart
PanelLoad,InvitePanelLoad
if(window.HandleLiveChatEvent)
{
window.HandleLiveChatEvent(name,param);
}
if(MyLiveChat.SmartPanel&&MyLiveChat.SmartPanel.HandleLiveChatEvent)
{
MyLiveChat.SmartPanel.HandleLiveChatEvent(name,param);
}
if(MyLiveChat.InvitePanel&&MyLiveChat.InvitePanel.HandleLiveChatEvent)
{
MyLiveChat.InvitePanel.HandleLiveChatEvent(name,param);
}
}
function MyLiveChat_ShowChatBox(disp)
{
if(disp!="none")disp="";
var divid="MyLiveChatScriptBox";
var tagid="MyLiveChatChatBoxScriptTagID";
var tag=document.getElementById(tagid);
if(tag!=null)
{
if(!MyLiveChat.ChatBoxPanel)
{
if(window.jsml&&window.jsml.new_chatboxpanel)
{
window.jsml.new_chatboxpanel()
}
}
return;
}
var url=MyLiveChat.UrlBase+"ChatBox.aspx?HCCID="+MyLiveChat.HCCID+"&Chat
BoxTemplate="+MyLiveChat.ChatBoxTemplate;
if(window.jsml)
{
url=url+"&jsmlcore=0";
if(window.jsml.new_frameskin)
url=url+"&jsmlskin=0";
if(window.jsml.new_chatboxpanel)
url=url+"&jsmlchatbox=0";
}
url=url+"&_ts="+new Date().getTime();
tag=document.createElement("SCRIPT");
tag.id=tagid;
tag.src=url;
document.body.insertBefore(tag,document.body.firstChild);
}
function MyLiveChat_PlaySound(url)
{
if(/MSIE/.test(navigator.userAgent))
{
var bgs=document.createElement("BGSOUND");
bgs.src=url;
document.body.insertBefore(bgs,document.body.firstChild);
return;
}
if(window.Audio)
{
var au=new window.Audio();
au.autoplay=true;
au.src=url;
document.body.insertBefore(au,document.body.firstChild);
return;
}
}
function MyLiveChat_ShowSmart()
{
var tagid="MyLiveChatSmartScriptTagID";
var tag=document.getElementById(tagid);
if(tag!=null)
{
if(!MyLiveChat.SmartPanel)
{
if(window.jsml&&window.jsml.new_smartpanel)
{
window.jsml.new_smartpanel()
}
}
return;
}
var url=MyLiveChat.UrlBase+"Smart.aspx?HCCID="+MyLiveChat.HCCID+"&SmartT
emplate="+MyLiveChat.SmartTemplate;
if(window.jsml)
{
url=url+"&jsmlcore=0";
if(window.jsml.new_frameskin)
url=url+"&jsmlskin=0";
if(window.jsml.new_smartpanel)
url=url+"&jsmlsmart=0";
}
url=url+"&_ts="+new Date().getTime();
tag=document.createElement("SCRIPT");
tag.id=tagid;
tag.src=url;
document.body.insertBefore(tag,document.body.firstChild);
if(MyLiveChat.SmartPlaySound)
MyLiveChat_PlaySound(MyLiveChat.SiteUrl+"Customization/Template/
Smart_"+MyLiveChat.SmartSoundFile+".wav");
}
function MyLiveChat_AcceptSmart()
{
MyLiveChat.SmartAccepted=true;
MyLiveChat_SetLocalData("MLCSmart","Accept",MyLiveChat.SmartHideTimeout)
;
MyLiveChat_SetLocalData("MLCSmartTime",new Date().getTime().toString(),M
yLiveChat.SmartHideTimeout)
MyLiveChat_OpenDialog("Smart");
MyLiveChat_HideSmart();
}
function MyLiveChat_RejectSmart(istimeout)
{
MyLiveChat.SmartRejected=true;
var rkey=istimeout?"MLCSmartIgnoreCount":"MLCSmartRejectCount";
var rcount=parseInt(MyLiveChat_GetLocalData(rkey))||0;
rcount=rcount+1;
MyLiveChat_SetLocalData(rkey,rcount.toString(),MyLiveChat.SmartHideTimeo
ut);
MyLiveChat_SetLocalData("MLCSmart","Reject",MyLiveChat.SmartHideTimeout)
;
MyLiveChat_SetLocalData("MLCSmartTime",new Date().getTime().toString(),M
yLiveChat.SmartHideTimeout)
MyLiveChat_HideSmart();
}
function MyLiveChat_HideSmart()
{
MyLiveChat_InvokeEvent("HideSmart");
if(MyLiveChat.SmartPanel)
{
MyLiveChat.SmartPanel.dispose();
MyLiveChat.SmartPanel=null;
}
}
function MyLiveChat_ShowInvite()
{
var tagid="MyLiveChatInviteScriptTagID";
var tag=document.getElementById(tagid);
if(tag!=null)
return;
var url=MyLiveChat.UrlBase+"Invite.aspx?HCCID="+MyLiveChat.HCCID+"&Invit
eTemplate="+MyLiveChat.InviteTemplate;
if(window.jsml)
{
url=url+"&jsmlcore=0";
if(window.jsml.new_frameskin)
url=url+"&jsmlskin=0";
if(window.jsml.new_invitepanel)
url=url+"&jsmlinvite=0";
}
url=url+"&_ts="+new Date().getTime();
tag=document.createElement("SCRIPT");
tag.id=tagid;
tag.src=url;
document.body.insertBefore(tag,document.body.firstChild);
if(MyLiveChat.InvitePlaySound)
{
MyLiveChat_PlaySound(MyLiveChat.SiteUrl+"Customization/Template/
Invite_"+MyLiveChat.InviteSoundFile+".wav");
}
}
function MyLiveChat_HideInvite()
{
MyLiveChat_InvokeEvent("HideInvite");
if(MyLiveChat.InvitePanel)
{
MyLiveChat.InvitePanel.dispose();
MyLiveChat.InvitePanel=null;
}
}
function MyLiveChat_AcceptInvite()
{
try
{
window.LiveChatPrePopup=window.open("about:blank",'',MyLiveChat.
DialogOption);
}
catch(x)
{
alert(PopupBlockedMsg);
return;
}
clearTimeout(MyLiveChat.RequestTimerId);
MyLiveChat_ChangeUrl("ACCEPT");
MyLiveChat_HideInvite();
}
function MyLiveChat_RejectInvite()
{
clearTimeout(MyLiveChat.RequestTimerId);
MyLiveChat_ChangeUrl("REJECT")
MyLiveChat_HideInvite();
}
function MyLiveChat_SetNextReqTimeout(timer)
{
if(timer)
{
MyLiveChat.NextRequestTime=MyLiveChat.LastInitTime+timer;
}
clearTimeout(MyLiveChat.RequestTimerId);
MyLiveChat.RequestTimerId=setTimeout(MyLiveChat_NextRequest,555);
}
function MyLiveChat_NextRequest()
{
var dt=new Date().getTime();
//document.title=MyLiveChat.NextRequestTime-dt;
if(dt<MyLiveChat.NextRequestTime)
{
MyLiveChat_SetNextReqTimeout();
return;
}
if(!MyLiveChat.LastLoadTime)
{
MyLiveChat_ChangeUrl("VISIT");
return;
}
if(!(MyLiveChat.localStorage||MyLiveChat.userDataBehavior))
{
MyLiveChat_ChangeUrl("VISIT");
return;
}
var cppbt=parseInt(MyLiveChat_GetLocalData("MLCCPPBT"));
if(MyLiveChat.PageBeginTime==cppbt)
{
if(cppbt==parseInt(MyLiveChat_GetLocalData("MLCCPAPT")))
{
MyLiveChat_ChangeUrl("VISIT");
return;
}
if(dt-MyLiveChat.LastSyncTime>MyLiveChat.NextRequestTimeout*1.8)
{
MyLiveChat_ChangeUrl("VISIT");
return;
}
MyLiveChat_SetNextReqTimeout();
return;
}
MyLiveChat_SetLocalData("MLCCPAPT",String(MyLiveChat.PageBeginTime));
var cprdt=parseInt(MyLiveChat_GetLocalData("MLCCPRDT"));
if(!cprdt||dt-cprdt>MyLiveChat.NextRequestTimeout-1800)
{
MyLiveChat_ChangeUrl("VISIT");
return;
}
MyLiveChat_SetNextReqTimeout(MyLiveChat.NextRequestTimeout);
MyLiveChat_SyncFromCPR();
setTimeout(function()
{
if(cprdt!=parseInt(MyLiveChat_GetLocalData("MLCCPRDT")))
{
MyLiveChat_SyncFromCPR();
}
},MyLiveChat.NextRequestTimeout/2);
}
function MyLiveChat_SyncFromCPR()
{
var arr=MyLiveChat.CPRFIELDS;
for(var i=0;i<arr.length;i++)
MyLiveChat[arr[i]]=MyLiveChat_CPRDecode(MyLiveChat_GetLocalData(
"MLC"+arr[i]));
MyLiveChat_Initialize(true);
}
function MyLiveChat_CPRDecode(str)
{
if(!str)
return null;
if(str=="null")return null;
if(str=="true")return true;
if(str=="false")return false;
var prefix=str.substring(0,2);
str=str.substring(2);
if(prefix=="s:")
return str;
if(prefix=="n:")
return parseFloat(str);
if(prefix=="a:")
return str.split('=|=');
//document.title="mlc warning,unknown prefix:"+prefix;
return null;
}
function MyLiveChat_CPREncode(val)
{
if(val==null)
return "null";
var type=typeof(val);
if(type=="boolean")
return val?"true":"false";
if(type=="string")
return "s:"+val;
if(type=="number")
return "n:"+val;
if(val instanceof Array)
return "s:"+val.join('=|=');
//document.title="mlc warning,unknown type:"+type;
return null;
}
function MyLiveChat_GetReferrer()
{
var dr=document.referrer;
if(!dr)return "";
var chost=window.location.href.split("://")[1].split("/")[0];
var rhost=dr.split("://")[1].split("/")[0];
if(chost==rhost)return "";
return dr;
}
function MyLiveChat_AppendToUrl(url)
{
var uadt=parseInt(MyLiveChat_GetLocalData("uadt"))||0;
var uats=Math.floor( (new Date().getTime()-uadt)/1000 );
uats=Math.max(1,Math.min(uats,3600*24*30));
var contextdata="2:"+uats+"|"+(MyLiveChat.SourceContextData||"");
url=url
+"&UserKey="+escape(MyLiveChat.SourceKey||"")
+"&Name="+escape(MyLiveChat.SourceName||"")
+"&Email="+escape(MyLiveChat.SourceEmail||"")
+"&Department="+escape(MyLiveChat.SourceDepartment||"")
+"&Url="+escape(window.location.href)
+"&Referrer="+escape(MyLiveChat_GetReferrer())
+"&Subject="+escape(MyLiveChat.SourceSubject||"")
+"&Question="+escape(MyLiveChat.SourceQuestion||"")
+"&CustomData="+escape(MyLiveChat.SourceCustomData||"")
+"&ProductName="+escape(MyLiveChat.SourceProductName||"")
+"&ProductKey="+escape(MyLiveChat.SourceProductKey||"")
+"&ContextData="+escape(contextdata)
+"&ScreenSize="+(screen.width+","+screen.height)
+"&uats="+uats
+"&_mv="+MyLiveChat.Version
+"&_ts="+new Date().getTime();
while(url.match(/\&[a-z]+\=\&/ig))url=url.replace(/\&[a-z]+\=\&/ig,"&");
return url;
}
function MyLiveChat_ChangeUrl(_synctype)
{
var tagid="MyLiveChatScriptTagID";
var tag=document.getElementById(tagid);
if(tag==null)
{
tag=document.createElement("SCRIPT");
document.body.insertBefore(tag,document.body.firstChild);
}
var qs=MyLiveChat.ScriptUrl.split('#')[0].split('?')[1].split('&');
var qm={};
for(var i=0;i<qs.length;i++)
{
var kv=qs[i].split('=')
qm[kv[0]]=kv[1];
}
var url=MyLiveChat.UrlBase+"livechat.aspx?HCCID="+MyLiveChat.HCCID
+"&CCCustomerId="+MyLiveChat.CCCustomerId
+"&Type="+_synctype;
url=MyLiveChat_AppendToUrl(url);
var newtag = document.createElement('SCRIPT');
newtag.id = tagid;
newtag.src = url;

newtag.onerror=function()
{
clearTimeout(MyLiveChat._checksynctimerid);
MyLiveChat._checksynctimerid=setTimeout(function()
{
MyLiveChat_ChangeUrl(_synctype);
},8000)
}
tag.parentNode.replaceChild(newtag,tag);

MyLiveChat.LastSyncTime=new Date().getTime();
clearTimeout(MyLiveChat._checksynctimerid);
MyLiveChat._checksynctimerid=setTimeout(function()
{
if(MyLiveChat.LastInitTime&&MyLiveChat.LastInitTime>MyLiveChat.L
astSyncTime)
return;
MyLiveChat_ChangeUrl(_synctype);
},8000);
}
function MyLiveChat_GetDialogUrl(mode,chattype)
{
if(MyLiveChat.SourceDepartment&&MyLiveChat.SmartClickOfflineItem=="Offli
ne")
{
for(var i=0;i<MyLiveChat.Departments.length;i++)
{
if(MyLiveChat.Departments[i].Name==MyLiveChat.SourceDepa
rtment&&!MyLiveChat.Departments[i].Online)
{
mode="Offline";
}
}
}
var url= MyLiveChat.UrlBase+"Redirect.aspx?HCCID="+MyLiveChat.HCCID
+"&CCCustomerId="+MyLiveChat.CCCustomerId
+"&Mode="+(mode||"Click")
+"&ChatType="+(chattype||"")
url=MyLiveChat_AppendToUrl(url);
return url;
}
function MyLiveChat_OpenDialog(mode)
{
return window.open(MyLiveChat_GetDialogUrl(mode),'',MyLiveChat.DialogOpt
ion);
}
function MyLiveChat_ShowChatWidget(mode)
{
var tagid="MyLiveChatWidgetScriptTagID";
var tag=document.getElementById(tagid);
if(tag!=null)
return;
var url=MyLiveChat.UrlBase+"widget.aspx?HCCID="+MyLiveChat.HCCID+"&Mode=
"+(mode||"Click");
if(window.mlcwidget)
{
url=url+"&mlcwidget=0";
}
url=url+"&_ts="+new Date().getTime();
tag=document.createElement("SCRIPT");
tag.id=tagid;
tag.src=url;
document.body.insertBefore(tag,document.body.firstChild);
}
function MyLiveChat_ShowInPageChat(mode)
{
var tagid="MyLiveChatInPageScriptTagID";
var tag=document.getElementById(tagid);
if(tag!=null)
return;
var url=MyLiveChat.UrlBase+"inline.aspx?HCCID="+MyLiveChat.HCCID+"&Mode=
"+(mode||"Click");
if(window.jsml)
{
url=url+"&jsmlcore=0";
if(window.jsml.new_frameskin)
url=url+"&jsmlskin=0";
if(window.jsml.new_inpagepanel)
url=url+"&jsmlinpage=0";
}
url=url+"&_ts="+new Date().getTime();
tag=document.createElement("SCRIPT");
tag.id=tagid;
tag.src=url;
document.body.insertBefore(tag,document.body.firstChild);
}
function MyLiveChat_WriteOrSetHTML(html)
{
var c=document.getElementById("MyLiveChatContainer");
if(c)
c.innerHTML=html;
else
document.write(html);
}
function MyLiveChat_Initialize(fromcpr)
{
MyLiveChat.LastInitTime=new Date().getTime();
MyLiveChat.ButtonImageUrl=MyLiveChat.HasReadyAgents?MyLiveChat.ButtonOnl
ineImage:MyLiveChat.ButtonOfflineImage;
MyLiveChat.ButtonTooltip=MyLiveChat.HasReadyAgents?MyLiveChat.ButtonOnli
neTooltip:MyLiveChat.ButtonOfflineTooltip;
MyLiveChat.LinkHtmlCode=MyLiveChat.HasReadyAgents?MyLiveChat.LinkOnlineC
ode:MyLiveChat.LinkOfflineCode;
MyLiveChat.LinkTooltip=MyLiveChat.HasReadyAgents?MyLiveChat.LinkOnlineTo
oltip:MyLiveChat.LinkOfflineTooltip;
MyLiveChat.BoxHtmlCode=MyLiveChat.HasReadyAgents?MyLiveChat.BoxOnlineCod
e:MyLiveChat.BoxOfflineCode;
MyLiveChat.BoxTooltip=MyLiveChat.HasReadyAgents?MyLiveChat.BoxOnlineTool
tip:MyLiveChat.BoxOfflineTooltip;
MyLiveChat.BoxPhotoUrl=MyLiveChat.HasReadyAgents?MyLiveChat.BoxOnlinePho
to:MyLiveChat.BoxOfflinePhoto;
if(MyLiveChat.SmartCondition=="online")
{
if(!MyLiveChat.HasReadyAgents)
{
MyLiveChat.ShowSmart=false;
}
}
MyLiveChat.CCCustomerId=MyLiveChat_GetLocalData("CCCustomerId");
if(!MyLiveChat.CCCustomerId)
{
MyLiveChat.CCCustomerId=MyLiveChat.RandomID;
MyLiveChat_SetLocalData("CCCustomerId",MyLiveChat.CCCustomerId,8
6400);
}
MyLiveChat_InvokeEvent("Initializing");
if( ! MyLiveChat.SyncType )
{
MyLiveChat_SetNextReqTimeout(MyLiveChat.FirstRequestTimeout);
}
else if(MyLiveChat.SyncType=="VISIT")
{
var ntimeout=MyLiveChat.NextRequestTimeout;
if(MyLiveChat.LastSyncTime&&!fromcpr)
{
ntimeout+=(new Date().getTime()-MyLiveChat.LastSyncTime)
*2;
if(ntimeout>23000)ntimeout=23000;
}
MyLiveChat_SetNextReqTimeout(ntimeout);
}
if(MyLiveChat.SyncType=="VISIT")
{
if(MyLiveChat.SyncStatus=="INVITE")
{
var pos=MyLiveChat.SyncResult.indexOf(',');
var agentname=MyLiveChat.SyncResult.substring(0,pos);
var agentmsg=MyLiveChat.SyncResult.substring(pos+1);
if(agentmsg)
MyLiveChat.InviteMessage=agentmsg;
MyLiveChat.InviteMessage=MyLiveChat.InviteMessage.split(
"(AGENT)").join(agentname);
MyLiveChat.HasInvited=true;
if(MyLiveChat.InviteUseAgentPhoto)
{
MyLiveChat.InvitePhoto=MyLiveChat.UrlBase+"FindA
gentPhoto.aspx?hccid="+MyLiveChat.HCCID+"&name="+escape(agentname);
}
if(MyLiveChat.ShowInvite)
{
MyLiveChat_InvokeEvent("ShowInvite");
MyLiveChat_ShowInvite();
MyLiveChat_HideSmart();
}
else
{
MyLiveChat_RejectInvite();
}
}
else
{
MyLiveChat_HideInvite();
}
if(!MyLiveChat.HasInvited)
{
if(MyLiveChat.ShowSmart&&MyMyLiveChat_SmartTriggers())
{
MyLiveChat_InvokeEvent("ShowSmart");
MyLiveChat_ShowSmart();
}
else
{
MyLiveChat_HideSmart();
}
}
}
if(MyLiveChat.SyncType=="ACCEPT")
{
if(MyLiveChat.SyncStatus=="READY")
{
var url=MyLiveChat_GetDialogUrl("Invite")
var win=window.LiveChatPrePopup;
if(win!=null)
{
win.location.href=url;
window.LiveChatPrePopup=null;
}
else
{
try
{
win=window.open(url,'',MyLiveChat.Dialog
Option);
}
catch(x)
{
}
if(win==null)
{
alert(PopupBlockedMsg);
}
}
}
if(window.LiveChatPrePopup)
{
window.LiveChatPrePopup.close();
window.LiveChatPrePopup=null;
}
if(MyLiveChat.SyncStatus=="EXPIRED")
{
}
if(MyLiveChat.SyncStatus=="ERROR")
{
}
}
MyLiveChat_InvokeEvent("Loading");
for(var i=0;i<MyLiveChat.LoadingHandlers.length;i++)
{
var handler=MyLiveChat.LoadingHandlers[i]
handler(handler);
}
}
MyLiveChat.LoadingHandlers.push(function(funcself)
{
var apimode='chatwidget';
var modedisp=MyLiveChat.FeedbackBehavior=="Hide"?(MyLiveChat.HasReadyAge
nts?"":"none"):"";
if( ! MyLiveChat.SyncType )
{
if(funcself.Inited)return;
funcself.Inited=true;
if(MyLiveChat.ShowButton&&apimode=="chatbutton")
{
MyLiveChat_WriteOrSetHTML("<img id='MyLiveChatScriptButt
on' onclick='MyLiveChat_OpenDialog()' src='"+MyLiveChat.ButtonImageUrl
+"' title='"+MyLiveChat_HtmlEncode(MyLiveChat.Bu
ttonTooltip)+"' border='0' style='cursor:pointer;display:"+modedisp+"'>");
MyLiveChat.LastButtonImageUrl=MyLiveChat.ButtonImageUrl;
}
if(MyLiveChat.ShowLink&&apimode=="chatlink")
{
MyLiveChat_WriteOrSetHTML("<a id='MyLiveChatScriptLink'
onclick='MyLiveChat_OpenDialog()' title='"+MyLiveChat_HtmlEncode(MyLiveChat.Link
Tooltip)+"' style='cursor:pointer;display:"+modedisp+"'>"+MyLiveChat.LinkHtmlCod
e+"</a>");
MyLiveChat.LastLinkHtmlCode=MyLiveChat.LinkHtmlCode;
}
if(MyLiveChat.ShowBox&&apimode=="chatbox")
{
MyLiveChat_WriteOrSetHTML("<div id='MyLiveChatScriptBox'
></div>");
MyLiveChat_ShowChatBox(modedisp);
}
if(apimode=="chatinline")
{
MyLiveChat_ShowInPageChat();
}
if(apimode=="chatwidget")
{
MyLiveChat_ShowChatWidget();
}
}
else
{
if(apimode=="chatbutton")
{
var btn=document.getElementById("MyLiveChatScriptButton"
);
if(btn && MyLiveChat.LastButtonImageUrl!=MyLiveChat.Butt
onImageUrl)
{
btn.style.display=modedisp;
btn.setAttribute("title",MyLiveChat.ButtonToolti
p||"");
btn.setAttribute("src",MyLiveChat.ButtonImageUrl
);
MyLiveChat.LastButtonImageUrl=MyLiveChat.ButtonI
mageUrl;
}
}
if(apimode=="chatlink")
{
var btn=document.getElementById("MyLiveChatScriptLink");
if(btn && MyLiveChat.LastLinkHtmlCode!=MyLiveChat.LinkHt
mlCode)
{
btn.style.display=modedisp;
btn.setAttribute("title",MyLiveChat.LinkTooltip|
|"");
btn.innerHTML=MyLiveChat.LinkHtmlCode;
MyLiveChat.LastLinkHtmlCode=MyLiveChat.LinkHtmlC
ode;
}
}
if(apimode=="chatbox")
{
var btn=document.getElementById("MyLiveChatScriptBox");
if(btn)
{
MyLiveChat_ShowChatBox(modedisp);
}
}
}
});
function MyLiveChat_CalcBodyPoint(mode, bp)
{
if(!mode)mode="bottomright";
if(!bp && bp!==0) bp = 5;
var de=document.compatMode=="BackCompat"?document.body:document.document
Element;
var bw=de.clientWidth;
var bh=de.clientHeight;
if(mode!="float")
{
var p=MyLiveChat_CalcPoint(mode,bw,bh);
if(mode.indexOf("left")!=-1)
p.left+=bp;
if(mode.indexOf("right")!=-1)
p.left-=bp;
if(mode.indexOf("top")!=-1)
p.top+=bp;
if(mode.indexOf("bottom")!=-1)
p.top-=bp;
return p;
}
return MyLiveChat_CalcPoint(mode,bw,bh);
}
function MyLiveChat_CalcPoint(mode,w,h)
{
switch(mode)
{
case "float":
case "topleft":
return {top:0,left:0};
case "topcenter":
return {top:0,left:Math.floor(w/2)}
case "topright":
return {top:0,left:w}
case "middleleft":
return {top:Math.floor(h/2),left:0};
case "middlecenter":
return {top:Math.floor(h/2),left:Math.floor(w/2)}
case "middleright":
return {top:Math.floor(h/2),left:w}
case "bottomleft":
return {top:h,left:0};
case "bottomcenter":
return {top:h,left:Math.floor(w/2)}
case "bottomright":
return {top:h,left:w}
default:
return {top:h,left:w}
}
}
function MyLiveChat_MovePoint(src,dst)
{
return dst;
}
//uniquekey - (userid/email/guid..etc)
function MyLiveChat_SetUserName(displayname,uniquekey)
{
MyLiveChat.SourceName=displayname;
MyLiveChat.SourceKey=uniquekey;
}
function MyLiveChat_SetEmail(email)
{
MyLiveChat.SourceEmail=email;
}
function MyLiveChat_SetDepartment(department)
{
MyLiveChat.SourceDepartment=department;
}
function MyLiveChat_SetSubject(subject)
{
MyLiveChat.SourceSubject=subject;
}
function MyLiveChat_SetQuestion(question)
{
MyLiveChat.SourceQuestion=question;
}
function MyLiveChat_SetCustomData(data)
{
MyLiveChat.SourceCustomData=data;
}
function MyLiveChat_SetContextData(data)
{
MyLiveChat.SourceContextData=data;
}
function MyLiveChat_SetProductName(name)
{
MyLiveChat.SourceProductName=name;
}
function MyLiveChat_SetProductKey(key)
{
MyLiveChat.SourceProductKey=key;
}
function MyLiveChat_OnUserIsOnline(isinit)
{
var uadt=parseInt(MyLiveChat_GetLocalData("uadt"))||0;
MyLiveChat_SetLocalData("uadt",String(new Date().getTime()))
if(isinit!==true&&uadt&&new Date().getTime()-uadt>5*60*1000)
{
clearTimeout(MyLiveChat.RequestTimerId);
MyLiveChat_ChangeUrl("VISIT");
}
}
if(document.addEventListener)
{
document.addEventListener("mouseover",MyLiveChat_OnUserIsOnline,false);
document.addEventListener("keydown",MyLiveChat_OnUserIsOnline,false);
window.addEventListener("focus",MyLiveChat_OnUserIsOnline,false);
window.addEventListener("blur",MyLiveChat_OnUserIsOnline,false);
}
else
{
document.attachEvent("mouseover",MyLiveChat_OnUserIsOnline);
document.attachEvent("onkeydown",MyLiveChat_OnUserIsOnline);
window.attachEvent("focus",MyLiveChat_OnUserIsOnline);
window.attachEvent("blur",MyLiveChat_OnUserIsOnline);
}
MyLiveChat_OnUserIsOnline(true);
MyLiveChat_Initialize()
//_debugurl=null;
//if(_debugurl&&_debugurl.indexOf(',')!=-1)
//{
// alert(_debugurl);
//}

Вам также может понравиться