(function(global) {
'use strict';
var iframe = document.createElement('iframe');
// Attributes
iframe['id'] = 'motion-chat-iframe';
iframe['src'] = 'https://guestservices.myhostedcallcenter.com:443/snippet?location=' + btoa(window.location.host) + '&version=1.0.12&onlineForm=&offlineForm=&id=2&name=weekiwachee.com&address=http%3A%2F%2Fwww.weekiwachee.com&description=weekiwachee.com&mapKey=email&mapKeyOffline=email&key=WEEKI&agentAlias=Agent&customerAlias=Me&color=%233399ff&color_button=%233399ff&textColor=%23ffffff&fontSize=15&remote=https%3A%2F%2Fguestservices.myhostedcallcenter.com%3A443&animation=true&header_shape=rounded&header_online=Chat%20with%20Us!&start_chat_button=Chat&offline_chat_button=Send&header_offline=Contact%20us&download_transcript=true&timeout=0&whiteLabel=Powered%20by%20xCALLY&defaultWhiteLabel=true&sitepic=&closingQuestion=Do%20you%20want%20to%20close%20the%20interaction%3F&formSubmitSuccessMessage=Form%20properly%20submitted&formSubmitFailureMessage=Form%20submission%20error¬eTitle=Note&placeholderMessage=Type%20a%20message&closingMessage=Thanks%20you%20for%20your%20time!&closingMessageButton=Send&skipMessageButton=Skip&conditionAgreement=false&enableRating=true&enableFeedback=true&ratingType=star&ratingStarsNumber=5&token=kcwATBKNeD8xALsMmFfkNOlfsXarSKa2&autoclose=true&enableCustomerWriting=false&forwardTranscript=false&forwardTranscriptMessage=&forwardOffline=true&forwardOfflineAddress=Weekiwacheeinfo%40guestservices.com&waitingTitle=All%20of%20our%20agents%20are%20busy%20at%20this%20time.%20Your%20chat%20is%20very%20important%20to%20us.&waitingMessage=Please%20hold%20and%20we%20will%20answer%20your%20request%20as%20soon%20as%20possible.&offlineMessageSubject=New%20offline%20message%20from%20Weeki%20Wachee&offlineMessageBody=You%20received%20a%20new%20offline%20message%20from%20Weeki%20Wachee.%20Here%20you%20can%20find%20the%20details%20of%20the%20request%3A&enableUnmanagedNote=true&unmanagedMessage=Your%20request%20has%20not%20been%20processed.&skipUnmanaged=Skip&sendUnmanaged=Send&enableCustomerAttachment=true&enableCustomerCheckmarks=false&agentAvatar=&showAgentAvatar=false&timezone=America%2FNew_York¬ificationTemplate=%3Cp%3EAccount%3A%20%7B%7Baccount.name%7D%7D%3Cbr%20%2F%3E%0A%7B%7B%23queue%7D%7DQueue%3A%20%7B%7Bqueue.name%7D%7D%3Cbr%20%2F%3E%0A%7B%7B%2Fqueue%7D%7DFrom%20%3A%20%7B%7Bfrom%7D%7D%3C%2Fp%3E%0A¬ificationSound=true¬ificationShake=false&hideWhenOffline=false&agentIdentifier=website_alias&waitForTheAssignedAgent=10&alignment=left&verticalAlignment=10&messagesAlignment=alternate&defaultTitle=&customerAvatar=&showCustomerAvatar=false&messageFontSize=12&backgroundColor=%23fafafa&queueTransfer=false&queueTransferTimeout=300&agentTransfer=false&agentTransferTimeout=300&systemAlias=System&systemAvatar=&mandatoryDispositionPauseId=&mandatoryDisposition=false&createdAt=&updatedAt=&ListId=6&IntervalId=15&Interval=&customerIp=95.216.226.236&referer=https%3A%2F%2Fweekiwachee.com%2Fmermaids%2F&openedInteractions=851&maxInteractions=0&virtual=&online=false&custom=false';
// Style attributes
iframe.style['position'] = 'fixed';
iframe.style['height'] = '450px';
iframe.style['border'] = '0';
iframe.style['-webkit-transition'] = 'all 0.7s ease-out';
iframe.style['-moz-transition'] = 'all 0.7s ease-ou';
iframe.style['-ms-transition'] = 'all 0.7s ease-out';
iframe.style['-o-transition'] = 'all 0.7s ease-out';
iframe.style['transition'] = 'all 0.7s ease-out';
iframe.style['z-index'] = '9999';
// Left
var link = document.createElement('link');
link.href = 'https://guestservices.myhostedcallcenter.com:443/snippet/styles/vendor.css?version=1.0.12';
link.rel = 'stylesheet';
document.getElementsByTagName('head')[0].appendChild(link);
iframe.style['width'] = '295px';
iframe.style['top'] = '10%';
iframe.style['left'] = '-272px';
var div_tab = document.createElement('div');
var tab_status = 0;
div_tab.style['left'] = '0px';
div_tab.style['display'] = 'none';
//div_tab.style['top'] = iframe.style['top'];
div_tab['id'] = 'motion-chat-iframe-tab';
div_tab.style['position'] = 'fixed';
div_tab.style['cursor'] = 'pointer';
div_tab.style['height'] = '100px';
div_tab.style['width'] = '25px';
div_tab.style['-webkit-transition'] = 'all 0.7s ease-out';
div_tab.style['-moz-transition'] = 'all 0.7s ease-ou';
div_tab.style['-ms-transition'] = 'all 0.7s ease-out';
div_tab.style['-o-transition'] = 'all 0.7s ease-out';
div_tab.style['transition'] = 'all 0.7s ease-out';
div_tab.style['z-index'] = '9999';
document.body.appendChild(iframe);
div_tab.style["top"] = parseInt(iframe.getBoundingClientRect().top + 350) + "px";
document.body.appendChild(div_tab);
var html = 'CHAT';
div_tab.innerHTML = html;
document.getElementById("motion-chat-iframe-tab").addEventListener("click", function() {
if (tab_status % 2 == 0) {
div_tab.style.left = '295px';
iframe.style.left = '0px';
document.getElementById("chat_tab_arrow").classList.remove("mdi-chevron-right");
document.getElementById("chat_tab_arrow").classList.add("mdi-chevron-left");
var iframeEl = document.getElementById('motion-chat-iframe');
iframeEl.contentWindow.postMessage({
"evt": "show"
}, '*');
} else {
div_tab.style.left = '0px';
iframe.style.left = '-312px';
document.getElementById("chat_tab_arrow").classList.remove("mdi-chevron-left");
document.getElementById("chat_tab_arrow").classList.add("mdi-chevron-right");
var iframeEl = document.getElementById('motion-chat-iframe');
iframeEl.contentWindow.postMessage({
"evt": "hide"
}, '*');
}
tab_status++;
});
// START Events management
window.addEventListener('message', function(evt) {
switch (evt.data.cmd) {
case 'show':
// Left
iframe.style.left = '0px';
div_tab.style.left = '295px';
// Left
break;
case 'hide':
// Left
iframe.style.left = '-312px';
div_tab.style.left = '0px';
break;
case "init":
// Bottom, right
div_tab.style.backgroundColor = evt.data.div_color;
document.getElementById("chat_tab_text").style.color = evt.data.text_color;
document.getElementById("motion-chat-iframe-tab").style.display = "block";
break;
case "offline":
// Bottom, right
document.getElementById("motion-chat-iframe-tab").style.display = "none";
break;
default:
}
}, false);
// END Events management
// START Proactive action management
// END Proactive action management
}());