<?php

date_default_timezone_set('UTC');

$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$domainName = $_SERVER['HTTP_HOST'].'/';
$url = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], "?"));
$url = array_values(array_filter(explode('/', $url)));
unset($url[count($url) - 1]);
unset($url[count($url) - 1]);
define( 'APP_PATH', $protocol.$domainName.implode('/', $url) );

$preset_string = file_get_contents('../data/config/presets/config.json');
$preset = json_decode($preset_string, true);

if (!isset($preset['selectedPreset'])){ $preset['selectedPreset'] = '1';}

$decoded_data = json_decode(base64_decode($_GET['d']), true);

if (isset($decoded_data['selected_preset']) && $decoded_data['selected_preset'] != '' && $decoded_data['selected_preset'] != 'undefined' && $decoded_data['selected_preset'] != 'null' && is_numeric($decoded_data['selected_preset'])){
	$preset['selectedPreset'] = $decoded_data['selected_preset'];
}

$preset['emoji_family'] = 'twitter';

$js_array = file_get_contents('../data/config/presets/preset_' . $preset['selectedPreset'] . '.json');
$php_array = json_decode($js_array);

include("../data/config/config.php");
$PDO = PDO_CONNECT();

// LOAD THEME

echo '<script type="text/javascript">';
echo "var jsThemeConfig = " . $js_array . ";\n";
echo "var jsGlobalConfig = " . $preset_string . ";\n";
echo '</script>';

echo '<link type="text/css" rel="stylesheet" href="'.APP_PATH.'/data/css/ultimate_chat_widget.min.css">';
echo '<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script>';
echo '<script type"text/javascript">
		$(document).ready(function(){
			$(".ultimate_chat_input_m1#username").val($("#ChatAlias", window.parent.document).val());
			$(".ultimate_chat_input_m1#username").attr("readonly", true);
			if(window.parent.location.search == "?splash=true"){
				$("#chat_link_holder").click();
				//$(".ultimate_chat_button[value=GO]").click();
				setTimeout(function(){
					$("#chat_link_holder").click();
				}, 2000);
			}
		});
		

	</script>';

if ($preset['emoji_family'] == 'twitter'){
	echo '<script src="'.APP_PATH.'/data/js/usc_emoji.min.js"></script>';
}

?>

    <div id="ultimate_support_chat_wrap"></div>
	
	
 	<script>	
	    var encodedGetVars = '<?php echo $_GET['d']; ?>';		
		var jsGetVars = JSON.parse('<?php echo json_encode($decoded_data) ?>');
		var target_origin;
		var appDir = '<?php echo APP_PATH; ?>';
    	var dataServer = appDir+'/data/';
    	var trackPages = '<?php echo $preset['track_users'] ?>';
    	var allowInvite = '<?php echo $preset['allow_chat_invite'] ?>';		
		var wysiwygNode = '';
		var emojiFamily = '<?php echo $preset['emoji_family']; ?>';
		
	function generateJsUniqueID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,a="x"==e?t:3&t|8;return a.toString(16)})}function logAllLocalStorage(){for(var e=0,t=localStorage.length;t>e;++e)console.log(localStorage.getItem(localStorage.key(e)))}function logAllSessionStorage(){for(var e=0,t=sessionStorage.length;t>e;++e)console.log(sessionStorage.getItem(sessionStorage.key(e)))}function initTracker(){var e=new XMLHttpRequest;e.onreadystatechange=function(){if(4==e.readyState&&200==e.status&&""!=e.responseText){var t=JSON.parse(e.responseText),a=generateJsUniqueID();sessionStorage.setItem("ultimate_support_chat-jsSession",a),sessionStorage.setItem("ultimate_support_chat-jsSession--user_id",t.user_id),sessionStorage.setItem("ultimate_support_chat-jsSession--ip_address",jsGetVars.ip_address),sessionStorage.setItem("ultimate_support_chat-jsSession--country_name",t.country_name),sessionStorage.setItem("ultimate_support_chat-jsSession--country_code",t.country_code),sessionStorage.setItem("ultimate_support_chat-jsSession--longitude",t.longitude),sessionStorage.setItem("ultimate_support_chat-jsSession--latitude",t.latitude)}},e.open("POST","tracker.php",!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.send("jsCookie="+localStorage.getItem("ultimate_support_chat-jsCookie")+"&encodedGetVars="+encodedGetVars+"&track_page="+trackPages)}function trackerPing(){var e=new XMLHttpRequest;e.onreadystatechange=function(){4==e.readyState&&200==e.status&&""!=e.responseText},e.open("POST","tracker_ping.php",!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.send("jsCookie="+localStorage.getItem("ultimate_support_chat-jsCookie")+"&encodedGetVars="+encodedGetVars)}function getBrowserNoVersion(e){return-1===e.indexOf(" ")?e:e.substr(0,e.indexOf(" "))}function chatInit(e,t){function a(e,t){if(1==e){var a=new XMLHttpRequest;a.open("POST","post.php",!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send("request_id="+t+"&status=1")}m=0}function o(e){var t=new XMLHttpRequest;t.open("POST","post.php",!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.send("request_id="+e+"&status=0")}function s(e,t,a){if(!a.replace(/\s/g,"").length)return!1;if("<div><br></div><div><br></div>"==a||"<br>"==a||"<p<br></p><p<br></p>"==a)return!1;emojiPanel("close");var o=(document.getElementById("user_ui").value,new XMLHttpRequest);o.onreadystatechange=function(){4==o.readyState&&200==o.status&&"posted"==o.responseText&&(sessionStorage.setItem("ultimate_support_chat-jsSession--post_started","post-started"),i(t,!1),setInterval(function(){i(t)},2500))},o.open("POST","post.php",!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.send("encodedGetVars="+encodedGetVars+"&request_id="+t+"&username="+e+"&message="+encodeURIComponent(a)+"&emojiFamily="+emojiFamily+"&status=0")}function i(e,t){var a=(document.getElementById("user_ui").value,new XMLHttpRequest);a.onreadystatechange=function(){if(4==a.readyState&&200==a.status){if(null==a.responseText)return;var e=JSON.parse(a.responseText),o="";"1"==e.operator_typing&&"open"==slideToggleState&&(o='<div id="op_is_typing" class="is_typing">Operator is typing...</div>'),"dynamic"==jsThemeConfig.userAvatarCssContentStyle&&(jsThemeConfig.userAvatarCssContent=e.user_name.charAt(0).toUpperCase()),c=e.rows.length;var s="",i="";for(var n in e.rows)e.rows.hasOwnProperty(n)&&(i+=e.rows[n],s=n);if(1==t&&sessionStorage.setItem("ultimate_support_chat-jsSession--userLogResults",c),c>sessionStorage.getItem("ultimate_support_chat-jsSession--userLogResults")&&(sessionStorage.setItem("ultimate_support_chat-jsSession--userLogResults",c),0!=e.operator_id[s]&&"off"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widget_soundNotification"))){var r="0";void 0!=jsThemeConfig.userMessageAudio&&(r=jsThemeConfig.userMessageAudio);var l=new Audio(dataServer+"/audio/"+r+".mp3");l.play()}var d='<div class="last_row_spacer">&nbsp;</div>';document.getElementById("chat_history").innerHTML=i+d+o;var m="</terminate>";if(i.indexOf(m)>-1==1&&document.getElementById("end_chat_btn").click(),sessionStorage.setItem("ultimate_support_chat-jsSession--operator_avatar",JSON.stringify(e.operator_avatar)),"operator"==jsThemeConfig.headerImageType&&"undefined"!=sessionStorage.getItem("ultimate_support_chat-jsSession--operator_avatar")&&void 0!=sessionStorage.getItem("ultimate_support_chat-jsSession--operator_avatar")){var g=JSON.parse(sessionStorage.getItem("ultimate_support_chat-jsSession--operator_avatar"));g&&(""!=g[0]?document.getElementById("header_image").innerHTML='<img src="'+dataServer+g[0]+'"/>':document.getElementById("header_image").innerHTML='<img src="'+dataServer+'config/themes/img/avatars/default.png"/>')}buildLayout(),"manual"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widget_scroll_type")&&e.rows.length>sessionStorage.getItem("ultimate_support_chat-jsSession--widget_chat_length")&&(sessionStorage.setItem("ultimate_support_chat-jsSession--widget_chat_length",e.rows.length),document.getElementById("chat_history").scrollTop=document.getElementById("chat_history").scrollHeight)}},a.open("POST","log.php",!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send("encodedGetVars="+encodedGetVars+"&request_id="+e)}window.addEventListener&&("slideside"==jsThemeConfig.triggerMethod?parent.postMessage({task:"iframe_resize_"+jsThemeConfig.triggerMethod},target_origin):parent.postMessage({task:"iframe_resize"},target_origin)),document.getElementById("ultimate_support_chat_wrap").innerHTML=chatMarkup;var n=document.getElementById("usc_emoji_picker"),r='<input id="tab0" type="radio" name="tabs" class="emoji_select_btn"> <label for="tab0" style="width:36px">&#x1F558;</label> <input id="tab1" type="radio" name="tabs" class="emoji_select_btn" checked> <label for="tab1">&#x1F60A;</label> <input id="tab2" type="radio" name="tabs" class="emoji_select_btn"> <label for="tab2">&#x1F44D;</label> <input id="tab3" type="radio" name="tabs" class="emoji_select_btn"> <label for="tab3" >&#x1F698;</label> <input id="tab4" type="radio" name="tabs" class="emoji_select_btn"> <label for="tab4">&#x1F334;</label> <input id="tab5" type="radio" name="tabs" class="emoji_select_btn"> <label for="tab5">&#x1F34E;</label> <input id="tab6" type="radio" name="tabs" class="emoji_select_btn"> <label for="tab6" >&#x1F3E3;</label> <input id="tab7" type="radio" name="tabs" class="emoji_select_btn"> <label for="tab7">&#x1F414;</label> <input id="tab8" type="radio" name="tabs" class="emoji_select_btn"> <label for="tab8" style="width:30px">&#x2B50;</label> <div class="usc_emoji_content" id="content0"><ul id="emoji-list-0" class="emoji-list"></ul></div> <div class="usc_emoji_content" id="content1"><ul id="emoji-list-1" class="emoji-list"></ul></div> <div class="usc_emoji_content" id="content2"><ul id="emoji-list-2" class="emoji-list"></ul></div> <div class="usc_emoji_content" id="content3"><ul id="emoji-list-3" class="emoji-list"></ul></div> <div class="usc_emoji_content" id="content4"><ul id="emoji-list-4" class="emoji-list"></ul></div> <div class="usc_emoji_content" id="content5"><ul id="emoji-list-5" class="emoji-list"></ul></div> <div class="usc_emoji_content" id="content6"><ul id="emoji-list-6" class="emoji-list"></ul></div> <div class="usc_emoji_content" id="content7"><ul id="emoji-list-7" class="emoji-list"></ul></div> <div class="usc_emoji_content" id="content8"><ul id="emoji-list-8" class="emoji-list"></ul></div>';if(n.innerHTML=r,buildLayout(!0),""!=jsThemeConfig.initMsgModule_2&&null===sessionStorage.getItem("ultimate_support_chat-jsSession--post_started")){var l='<div class="a_reply"><span class="a_1"></span><span class="a_avatar_border"></span><span class="a_content_wrap"><span class="a_2">Operator</span><span class="a_3">&nbsp;</span><span class="a_4">'+jsThemeConfig.initMsgModule_2+"</span></span></div>";document.getElementById("chat_history").innerHTML=l,buildLayout()}setSlideUpToggle("open"),"wide"==sessionStorage.getItem("ultimate_support_chat-jsSession--widgetWidthMode")&&(removeClass("a_avatar_border","a_avatar_border_wide"),removeClass("a_content_wrap","content_wrap_wide"),removeClass("admin_msg","admin_msg_wide"),removeClass("u_avatar_border","u_avatar_border_wide"),removeClass("u_content_wrap","content_wrap_wide"),removeClass("user_msg","user_msg_wide"),wideMode()),null!==sessionStorage.getItem("ultimate_support_chat-jsSession--post_started")&&(i(t,!0),setInterval(function(){i(t)},2500)),"default"==jsThemeConfig.triggerMethod&&void 0!=document.getElementById("ultimate_chat_btn_wrap")&&(document.getElementById("ultimate_chat_btn_wrap").onclick=function(){setSlideUpToggle("open")}),document.getElementById("user_ui").value=encodedGetVars;var d,m=0;wysiwygNode=document.getElementById("usc_wysiwyg"),wysiwygNode.addEventListener("keyup",function(i){0==m&&a(!0,t),clearTimeout(m),m=setTimeout(function(){a(!1)},2500),void 0!=d&&clearTimeout(d),d=setTimeout(function(){o(t)},2500);var n=i.keyCode?i.keyCode:i.which;if(13==n){var r=wysiwygNode.innerHTML;wysiwygNode.innerHTML="",s(e,t,r)}}),wysiwygNode.addEventListener("keydown",function(e){var t=(window.getSelection().getRangeAt(0),e.keyCode||e.charCode);(8==t||46==t)&&setTimeout(function(){if(""==wysiwygNode.innerHTML||"<br>"==wysiwygNode.innerHTML)for(;wysiwygNode.firstChild;)wysiwygNode.removeChild(wysiwygNode.firstChild)},1)}),document.getElementById("submit_reply").onclick=function(){var a=document.getElementById("usc_wysiwyg").innerHTML;document.getElementById("usc_wysiwyg").innerHTML="",s(e,t,a)},void 0!=document.getElementById("end_chat_btn")&&(document.getElementById("end_chat_btn").onclick=function(){"slideup"==jsThemeConfig.triggerMethod&&(void 0!=document.getElementById("op_is_typing")&&(document.getElementById("op_is_typing").innerHTML=""),void 0!=document.getElementById("header_image")&&(document.getElementById("header_image").style.display="none"),document.getElementById("ultimate_chat_bottom_textarea_wrapper").style.display="none"),setSlideUpToggle("closed");var a=new XMLHttpRequest;a.onreadystatechange=function(){4==a.readyState&&200==a.status&&"chat_terminated"==a.responseText&&(sessionStorage.clear(),location.reload())},a.open("POST","exit_chat.php",!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send("request_id="+t+"&username="+e)});var c=""}function messageInit(){document.getElementById("ultimate_support_chat_wrap").innerHTML=message_init,buildLayout(!0),setSlideUpToggle("closed")}function markup(){document.getElementById("ultimate_support_chat_wrap").innerHTML=mark_up,buildLayout(!0),setSlideUpToggle("closed")}function onbeforeunload(e){sessionStorage.setItem("ultimate_support_chat-jsSession--page_before_refresh",sessionStorage.getItem("ultimate_support_chat-current_url"))}function createClass(e,t){var a=document.createElement("style");a.type="text/css",document.getElementsByTagName("head")[0].appendChild(a),(a.sheet||{}).insertRule?a.sheet.insertRule(e+"{"+t+"}",0):(a.styleSheet||a.sheet).addRule(e,t)}function addClass(e,t){for(var a=document.getElementsByClassName(e),o=0,s=a.length;s>o;o++)a[o].className+=" "+t}function removeClass(e,t){for(var a=document.getElementsByClassName(e),o=0,s=a.length;s>o;o++)a[o].className=a[o].className.replace(t,"")}function modifyClass(e,t,a){var o,s=document.getElementsByClassName(e);for(o=0;o<s.length;o++)s[o].setAttribute("style",t+": "+a+";")}function setStyleRule(e,t){var a=document.styleSheets[document.styleSheets.length-1];for(var o in document.styleSheets)if(document.styleSheets.hasOwnProperty(o)&&document.styleSheets[o].href&&document.styleSheets[o].href.indexOf("ultimate_chat_widget.css")){a=document.styleSheets[o];break}a.addRule?a.addRule(e,t):a.insertRule&&a.insertRule(e+" { "+t+" }",a.cssRules.length)}function appendClassContent(e,t){for(var a=document.getElementsByClassName(e),o=0,s=a.length;s>o;o++)a[o].innerHTML=t}function buildLayout(e){var t=document.getElementById("ultimate_chat_holder").getAttribute("data-module");if("slideside"==jsThemeConfig.triggerMethod&&2!=t&&(document.getElementById("ultimate_chat_header_text").style.marginTop="-55px"),1==e){if("image"==jsThemeConfig.backgroundStyle){addClass("ultimate_chat_holder","ultimate_chat_holder_bg_img");var a=jsThemeConfig.widgetBackgroundFile;modifyClass("ultimate_chat_holder_bg_img","background","url("+a+") repeat center;"),modifyClass("default_chat_history","background","transparent")}if("image"==jsThemeConfig.headerStyle){"slideside"==jsThemeConfig.triggerMethod?addClass(" ultimate_chat_link_holder_slideside","ultimate_chat_header_bg_img"):addClass("ultimate_chat_header","ultimate_chat_header_bg_img");var o=jsThemeConfig.widgetHeaderFile,s="";"slideside"==jsThemeConfig.triggerMethod&&(s="border-top-left-radius: "+jsThemeConfig.widgetRadius+"; border-top-right-radius: "+jsThemeConfig.widgetRadius+"; border-bottom-left-radius: "+jsThemeConfig.widgetRadius),modifyClass("ultimate_chat_header_bg_img","background","url("+o+") repeat left;"+s)}2==t&&"none"!=jsThemeConfig.headerImageType&&(addClass("ultimate_chat_header","header_tall"),addClass("ultimate_chat_link_holder_slideside","header_tall"),addClass("ultimate_chat_options_li","options_tall"),void 0!=document.getElementById("header_subtext")&&(document.getElementById("header_subtext").style.position="relative"),void 0!=document.getElementById("header_image")&&"logo"==jsThemeConfig.headerImageType&&(document.getElementById("header_image").innerHTML='<img src="'+jsThemeConfig.widgetLogoFile+'"/>'),addClass(jsThemeConfig.triggerMethod+"_chat_history_holder",jsThemeConfig.triggerMethod+"_chat_history_holder_low"),addClass(jsThemeConfig.triggerMethod+"_chat_history",jsThemeConfig.triggerMethod+"_chat_history_low")),"slideside"!=jsThemeConfig.triggerMethod&&"20px"==jsThemeConfig.widgetRadius&&(document.getElementById("ultimate_chat_header").style.borderTopLeftRadius="20px",document.getElementById("ultimate_chat_header").style.borderTopRightRadius="20px");var i=document.getElementById("username"),n=document.getElementById("useremail");null!=i&&(i.style.background=jsThemeConfig.textarea1BackgroundColor),null!=n&&(n.style.background=jsThemeConfig.textarea1BackgroundColor),"Microsoft"!=browser&&"Microsoft Internet Explorer"!=browser?(null!=i&&(i.style.color=jsThemeConfig.textarea1FontColor),null!=n&&(n.style.color=jsThemeConfig.textarea1FontColor)):setStyleRule(".ultimate_chat_input_m1","color:"+jsThemeConfig.textarea1FontColor),jsThemeConfig.textarea1PlaceholderColor&&(("Chrome"==browser||"Safari"==browser||"Opera"==browser)&&setStyleRule(".ultimate_chat_input_m1::-webkit-input-placeholder","color:"+jsThemeConfig.textarea1PlaceholderColor),"Firefox"==browser&&(setStyleRule(".ultimate_chat_input_m1:-moz-placeholder","opacity:1; color:"+jsThemeConfig.textarea1PlaceholderColor),setStyleRule(".ultimate_chat_input_m1::-moz-placeholder","opacity:1; color:"+jsThemeConfig.textarea1PlaceholderColor)),("Microsoft"==browser||"Microsoft Internet Explorer"==browser)&&setStyleRule(".ultimate_chat_input_m1:-ms-input-placeholder","color:"+jsThemeConfig.textarea1PlaceholderColor)),setStyleRule(".ultimate_chat_bottom_textarea","color:"+jsThemeConfig.textarea2FontColor),jsThemeConfig.textarea2PlaceholderColor&&setStyleRule("#usc_wysiwyg:empty:before","content: attr(placeholder);display: block; color:"+jsThemeConfig.textarea2PlaceholderColor);var r=document.getElementById("contact_name"),l=document.getElementById("contact_email"),d=document.getElementById("contact_message");null!=r&&(r.style.background=jsThemeConfig.textarea3BackgroundColor),null!=l&&(l.style.background=jsThemeConfig.textarea3BackgroundColor),null!=d&&(d.style.background=jsThemeConfig.textarea3BackgroundColor),"Microsoft"!=browser&&"Microsoft Internet Explorer"!=browser?(null!=r&&(r.style.color=jsThemeConfig.textarea3FontColor),null!=l&&(l.style.color=jsThemeConfig.textarea3FontColor),null!=d&&(d.style.color=jsThemeConfig.textarea3FontColor)):setStyleRule(".ultimate_chat_input","color:"+jsThemeConfig.textarea3FontColor),jsThemeConfig.textarea3PlaceholderColor&&(("Chrome"==browser||"Safari"==browser||"Opera"==browser)&&setStyleRule(".ultimate_chat_input::-webkit-input-placeholder","color:"+jsThemeConfig.textarea3PlaceholderColor),"Firefox"==browser&&(setStyleRule(".ultimate_chat_input:-moz-placeholder","opacity:1; color:"+jsThemeConfig.textarea3PlaceholderColor),setStyleRule(".ultimate_chat_input::-moz-placeholder","opacity:1; color:"+jsThemeConfig.textarea3PlaceholderColor)),("Microsoft"==browser||"Microsoft Internet Explorer"==browser)&&setStyleRule(".ultimate_chat_input:-ms-input-placeholder","color:"+jsThemeConfig.textarea3PlaceholderColor)),"50%"==jsThemeConfig.avatarRadius&&addClass("avatar_li","avatar_li_round")}else{if(addClass("a_reply","theme"+jsThemeConfig.themeSelect),"none"==jsThemeConfig.adminAvatarSelect?addClass("a_1","a_no_avatar"):addClass("a_1","admin_avatar"),2==jsThemeConfig.themeSelect&&setStyleRule(".right_bubble::after",'content: ""; position: absolute; border-style: solid;border-width: 6px 0 6px 29px;border-color: transparent '+jsThemeConfig.adminMessageColor+"; right: -12px; top: 24px;"),addClass("a_content_wrap","right_bubble"),5!=jsThemeConfig.themeSelect&&modifyClass("a_content_wrap","background",jsThemeConfig.adminMessageColor),addClass("a_2","admin_name"),modifyClass("admin_name","color",jsThemeConfig.adminNameColor),addClass("a_3","admin_time"),setStyleRule(".admin_time","color: "+jsThemeConfig.adminTimeColor+" !important"),addClass("a_4","admin_msg right_msg_bubble"),modifyClass("admin_msg","background",jsThemeConfig.adminMessageColor),setStyleRule(".admin_msg","color: "+jsThemeConfig.adminFontColor+" !important"),2==jsThemeConfig.themeSelect&&""==jsThemeConfig.adminNameColor&&""==jsThemeConfig.adminTimeColor&&modifyClass("admin_msg","margin","22px 30% 15px 10px;"),3==jsThemeConfig.themeSelect&&(modifyClass("a_avatar_border","background",jsThemeConfig.adminMessageColor),""==jsThemeConfig.adminNameColor&&modifyClass("admin_time","margin-right","0px"),"none"==jsThemeConfig.adminAvatarSelect&&addClass("a_1","admin_avatar_ex")),4==jsThemeConfig.themeSelect&&(setStyleRule(".right_msg_bubble::after",'content: ""; position: absolute; border-style: solid; border-width: 0 10px 10px; border-color: '+jsThemeConfig.adminMessageColor+" transparent; display: block; width: 0; z-index: 1; top: -10px; right: 20px;"),"none"==jsThemeConfig.adminAvatarSelect&&(addClass("a_2","admin_name_ex"),addClass("a_3","admin_time_ex"))),5==jsThemeConfig.themeSelect&&setStyleRule(".admin_msg::after",'border-radius: 20px / 10px;content: ""; display: block; position: absolute;border: 8px solid transparent; bottom: 1px; border-bottom-color: '+jsThemeConfig.adminMessageColor+"; border-radius: 20px / 10px; left: auto;right: -5px;"),""==jsThemeConfig.adminNameColor&&modifyClass("admin_name","display","none"),""==jsThemeConfig.adminTimeColor&&modifyClass("admin_time","display","none"),addClass("u_reply","theme"+jsThemeConfig.themeSelect),"none"==jsThemeConfig.userAvatarSelect?addClass("u_1","u_no_avatar"):addClass("u_1","user_avatar"),2==jsThemeConfig.themeSelect&&setStyleRule(".left_bubble::after",'content: ""; position: absolute; border-style: solid; border-width: 6px 29px 6px 0; ;border-color: transparent '+jsThemeConfig.userMessageColor+"; left: -12px; top: 24px;"),addClass("u_content_wrap","left_bubble"),5!=jsThemeConfig.themeSelect&&modifyClass("u_content_wrap","background",jsThemeConfig.userMessageColor),addClass("u_2","user_name"),modifyClass("user_name","color",jsThemeConfig.userNameColor),addClass("u_3","user_time"),setStyleRule(".user_time","color: "+jsThemeConfig.userTimeColor+" !important"),addClass("u_4","user_msg left_msg_bubble"),modifyClass("user_msg","background",jsThemeConfig.userMessageColor),setStyleRule(".user_msg","color: "+jsThemeConfig.userFontColor+" !important"),2==jsThemeConfig.themeSelect&&""==jsThemeConfig.userNameColor&&""==jsThemeConfig.userTimeColor&&modifyClass("user_msg","margin","22px 30% 15px 10px;"),3==jsThemeConfig.themeSelect&&(modifyClass("u_avatar_border","background",jsThemeConfig.userMessageColor),""==jsThemeConfig.userNameColor&&modifyClass("user_name","margin-left: 0px"),"none"==jsThemeConfig.userAvatarSelect&&addClass("u_1","user_avatar_ex")),4==jsThemeConfig.themeSelect&&(setStyleRule(".left_msg_bubble::after",'content: ""; position: absolute; border-style: solid; border-width: 0 12px 12px; border-color: '+jsThemeConfig.userMessageColor+" transparent; display: block; width: 0; z-index: 1; top: -10px; left: 20px;"),"none"==jsThemeConfig.userAvatarSelect&&(addClass("u_2","user_name_ex"),addClass("u_3","user_time_ex"))),5==jsThemeConfig.themeSelect&&setStyleRule(".user_msg::after",'border-radius: 20px / 10px;content: ""; display: block; position: absolute; border: 8px solid transparent; border-bottom-color: '+jsThemeConfig.userMessageColor+"; bottom: 1px; left: -5px;"),""==jsThemeConfig.userNameColor&&modifyClass("user_name","display","none"),""==jsThemeConfig.userTimeColor&&modifyClass("user_time","display","none"),"50%"==jsThemeConfig.avatarRadius&&(addClass("admin_avatar","avatar_round"),addClass("user_avatar","avatar_round")),"css"==jsThemeConfig.adminAvatarSelect){var m=jsThemeConfig.adminAvatarCssContent;if("dynamic"==jsThemeConfig.adminAvatarCssContentStyle)if(null===sessionStorage.getItem("ultimate_support_chat-jsSession--post_started"))m="A";else for(var c=document.getElementsByClassName("a_1"),g=document.getElementsByClassName("a_2"),u=0;u<c.length;u++)c[u].innerHTML=g[u].innerHTML.charAt(0).toUpperCase();else appendClassContent("admin_avatar",m);modifyClass("admin_avatar","background-color",jsThemeConfig.adminAvatarColor),addClass("a_1","a_css_text_color"),setStyleRule(".a_css_text_color","color: "+jsThemeConfig.adminAvatarColorText+"; font-size:13px")}if("img"==jsThemeConfig.adminAvatarSelect){modifyClass("admin_avatar","background-color","transparent");var c=document.getElementsByClassName("a_1");if("undefined"!=sessionStorage.getItem("ultimate_support_chat-jsSession--operator_avatar")){var _=JSON.parse(sessionStorage.getItem("ultimate_support_chat-jsSession--operator_avatar"));if(_)for(var h,u=0;u<c.length;u++)h="null"!=_[u]&&""!=_[u]?dataServer+_[u]:dataServer+"config/themes/img/avatars/default.png",c[u].innerHTML='<img src="'+h+'"/>'}if(""!=jsThemeConfig.initMsgModule_2&&null===sessionStorage.getItem("ultimate_support_chat-jsSession--post_started")){var h=dataServer+"config/themes/img/avatars/default.png";if(void 0==c[0])return;c[0].innerHTML='<img src="'+h+'"/>'}}if("css"==jsThemeConfig.userAvatarSelect&&(appendClassContent("user_avatar",jsThemeConfig.userAvatarCssContent),modifyClass("user_avatar","background-color",jsThemeConfig.userAvatarColor),addClass("u_1","u_css_text_color"),setStyleRule(".u_css_text_color","color: "+jsThemeConfig.userAvatarColorText+"; font-size:13px")),"img"==jsThemeConfig.userAvatarSelect)if("true"==jsThemeConfig.userAvatarSelectChoice){var p=sessionStorage.getItem("ultimate_support_chat-jsSession--userAvatar");appendClassContent("u_1",'<img src="'+p+'"/>')}else appendClassContent("u_1",'<img src="'+jsThemeConfig.userAvatarFile+'"/>');"wide"==sessionStorage.getItem("ultimate_support_chat-jsSession--widgetWidthMode")&&(addClass("a_avatar_border","a_avatar_border_wide"),addClass("a_content_wrap","content_wrap_wide"),addClass("admin_msg","admin_msg_wide"),addClass("u_avatar_border","u_avatar_border_wide"),addClass("u_content_wrap","content_wrap_wide"),addClass("user_msg","user_msg_wide"))}}function showAvatarSelect(){function e(){var e=document.getElementById("avatar_holder").getElementsByTagName("li");e[0].parentNode.appendChild(e[0])}for(var t=dataServer+"config/themes/img/avatars/"+jsThemeConfig.userAvatarSet+"/",a=document.getElementById("avatar_list"),o=0;o<jsThemeConfig.avatar_set_files.length;o++){var s=document.createElement("li"),i=new Image;i.src=t+jsThemeConfig.avatar_set_files[o],s.appendChild(i),a.appendChild(s)}var n=document.querySelectorAll("#avatar_holder ul li").length,r=document.querySelectorAll("#avatar_holder ul li"),l=r[0].clientWidth,d=r[0].clientHeight;document.getElementById("avatar_holder").style.width=l,document.getElementById("avatar_holder").style.height=d,selectAvatar(),document.getElementById("control_prev").onclick=function(){for(var t=0;n-1>t;t++)e();selectAvatar()},document.getElementById("control_next").onclick=function(){e(),selectAvatar()}}function selectAvatar(){var e=document.querySelectorAll("#avatar_holder ul li img")[0].src;sessionStorage.setItem("ultimate_support_chat-jsSession--userAvatar",e)}function allowInviteScan(){if("post-started"!=sessionStorage.getItem("ultimate_support_chat-jsSession--post_started")){var e=new XMLHttpRequest;e.onreadystatechange=function(){4==e.readyState&&200==e.status&&""!=e.responseText&&(sessionStorage.setItem("ultimate_support_chat-jsSession--user_name","Guest"),sessionStorage.setItem("ultimate_support_chat-jsSession--request_id",e.responseText),sessionStorage.setItem("ultimate_support_chat-jsSession--post_started","post-started"),chatInit("Invited user",e.responseText))},e.open("POST","invites.php",!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.send("jsCookie="+localStorage.getItem("ultimate_support_chat-jsCookie")+"&encodedGetVars="+encodedGetVars+"&track_page="+trackPages)}}function setSlideUpToggle(e){if(slideToggleState=e,"default"==jsThemeConfig.triggerMethod&&(slideToggleState="open","closed"==e?(document.getElementById("ultimate_chat_btn_wrap").style.display="block",document.getElementById("ultimate_chat_holder").style.display="none"):(document.getElementById("ultimate_chat_holder").style.display="block",void 0!=document.getElementById("ultimate_chat_btn_wrap")&&(document.getElementById("ultimate_chat_btn_wrap").style.display="none"),window.addEventListener&&("wide"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widgetWidthMode")?parent.postMessage({task:"iframe_resize"},target_origin):parent.postMessage({task:"iframe_wide"},target_origin))),void 0!=document.getElementById("ultimate_chat_close_holder")&&(document.getElementById("ultimate_chat_close_holder").onclick=function(){setSlideUpToggle("closed"),window.addEventListener&&("wide"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widgetWidthMode")?parent.postMessage({task:"iframe_init_"+jsThemeConfig.triggerMethod},target_origin):parent.postMessage({task:"iframe_wide"},target_origin))})),"slideup"==jsThemeConfig.triggerMethod){var t=document.getElementById("ultimate_chat_holder"),a=40,o=400,s=400,i=null,n="";"closed"==e?(n=!1,t.style.height=a+"px"):(n=!0,slideToggleState="open",t.style.height=o+"px"),document.getElementById("chat_link_holder").onclick=function(){window.addEventListener&&"40px"==t.style.height&&("wide"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widgetWidthMode")?parent.postMessage({task:"iframe_resize"},target_origin):parent.postMessage({task:"iframe_wide"},target_origin)),void 0!=document.getElementById("op_is_typing")&&(document.getElementById("op_is_typing").style.display="none");var e=document.getElementById("ultimate_chat_holder").getAttribute("data-module"),r=getStyle("ultimate_chat_holder","width");o="580px"==r?580:400,clearInterval(i);var l=parseInt(t.style.height),d=(new Date).getTime(),m=(n=!n)?o:a,c=m-parseInt(t.style.height);i=setInterval(function(){var a=(new Date).getTime()-d;if(s>a){var o=Math.floor(c*a/s),n=l+o;2==e&&"default"!=jsThemeConfig.headerStyle&&(45>n?(void 0!=document.getElementById("header_image")&&(document.getElementById("header_image").style.display="none"),void 0!=document.getElementById("header_subtext")&&(document.getElementById("header_subtext").style.display="none")):(void 0!=document.getElementById("header_image")&&(document.getElementById("header_image").style.display="block"),void 0!=document.getElementById("header_subtext")&&(document.getElementById("header_subtext").style.display="block"))),void 0!=document.getElementById("ultimate_chat_bottom_textarea_wrapper")&&(n>390?document.getElementById("ultimate_chat_bottom_textarea_wrapper").style.display="block":document.getElementById("ultimate_chat_bottom_textarea_wrapper").style.display="none"),slideToggleState=45>n?"closed":"open",t.style.height=n+"px"}else t.style.height=m+"px",clearInterval(i),window.addEventListener&&"40px"==t.style.height&&("wide"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widgetWidthMode")?parent.postMessage({task:"iframe_init_"+jsThemeConfig.triggerMethod},target_origin):parent.postMessage({task:"iframe_wide"},target_origin))},1)}}if("slideside"==jsThemeConfig.triggerMethod){var r="-330px";"closed"==e?document.getElementById("ultimate_chat_holder").style.marginRight=r:document.getElementById("ultimate_chat_holder").style.marginRight="0px",document.getElementById("ultimate_chat_link_holder").onclick=function(){var e=getStyle("ultimate_chat_holder","width");r="330px"==e?"-330px":"-580px";var t=getStyle("ultimate_chat_holder","margin-right");t==r?(window.addEventListener&&("wide"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widgetWidthMode")?parent.postMessage({task:"iframe_resize_"+jsThemeConfig.triggerMethod},target_origin):parent.postMessage({task:"iframe_wide"},target_origin)),document.getElementById("ultimate_chat_holder").style.marginRight="0px"):(document.getElementById("ultimate_chat_holder").style.marginRight=r,window.addEventListener&&("wide"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widgetWidthMode")?setTimeout(function(){parent.postMessage({task:"iframe_init_"+jsThemeConfig.triggerMethod},target_origin)},250):setTimeout(function(){parent.postMessage({task:"iframe_wide"},target_origin)},250)))}}}function getStyle(e,t){var a,o=document.getElementById(e);return o.currentStyle?a=o.currentStyle[t]:window.getComputedStyle&&(a=document.defaultView.getComputedStyle(o,null).getPropertyValue(t)),a}function validateEmail(e){var t=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(e)}function showOptions(){var e=getStyle("ultimate_chat_options","visibility");"hidden"==e?document.getElementById("ultimate_chat_options").style.visibility="visible":document.getElementById("ultimate_chat_options").style.visibility="hidden"}function soundOnOff(){"off"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widget_soundNotification")?(document.getElementById("sound_on_off_btn").innerHTML='<icon class="usc_options_icon" data-icon="n"></icon>Sound On</span>',sessionStorage.setItem("ultimate_support_chat-jsSession--widget_soundNotification","off")):(document.getElementById("sound_on_off_btn").innerHTML='<icon class="usc_options_icon" data-icon="o"></icon>Sound Off</span>',sessionStorage.setItem("ultimate_support_chat-jsSession--widget_soundNotification","on")),showOptions()}function wideMode(){var e=document.getElementById("wide_mode_btn");if("narrow"==e.getAttribute("data-value")){e.setAttribute("data-value","wide"),e.innerHTML='<icon class="usc_options_icon" data-icon="c"></icon>Narrow Mode',sessionStorage.setItem("ultimate_support_chat-jsSession--widgetWidthMode","wide"),window.addEventListener&&parent.postMessage({task:"iframe_wideMode"},target_origin),document.getElementById("usc_emoji_picker").style.marginTop="339px",el=document.getElementsByTagName("label");for(var t=0,a=el.length;a>t;t++)el[t].style.padding="10px 19px"}else{e.setAttribute("data-value","narrow"),e.innerHTML='<icon class="usc_options_icon" data-icon="c"></icon>Wide Mode',sessionStorage.setItem("ultimate_support_chat-jsSession--widgetWidthMode","narrow"),window.addEventListener&&("slideside"==jsThemeConfig.triggerMethod?parent.postMessage({task:"iframe_resize_"+jsThemeConfig.triggerMethod},target_origin):parent.postMessage({task:"iframe_resize"
	},target_origin)),document.getElementById("usc_emoji_picker").style.marginTop="169px",el=document.getElementsByTagName("label");for(var t=0,a=el.length;a>t;t++)el[t].style.padding="5px"}var o=getStyle("ultimate_chat_holder","width");"330px"==o?(document.getElementById("ultimate_chat_holder").style.width="580px",document.getElementById("ultimate_chat_holder").style.height="580px","slideside"!=jsThemeConfig.triggerMethod&&(document.getElementById("chat_history").style.height="485px"),void 0!=document.getElementById("chat_link_holder")&&(document.getElementById("chat_link_holder").style.width="580px"),void 0!=document.getElementById("ultimate_chat_close_holder")&&(document.getElementById("ultimate_chat_close_holder").style.width="580px"),addClass("a_avatar_border","a_avatar_border_wide"),addClass("a_content_wrap","content_wrap_wide"),addClass("admin_msg","admin_msg_wide"),addClass("u_avatar_border","u_avatar_border_wide"),addClass("u_content_wrap","content_wrap_wide"),addClass("user_msg","user_msg_wide")):(document.getElementById("ultimate_chat_holder").style.width="330px",document.getElementById("ultimate_chat_holder").style.height="400px","slideside"!=jsThemeConfig.triggerMethod&&(document.getElementById("chat_history").style.height="304px"),void 0!=document.getElementById("chat_link_holder")&&(document.getElementById("chat_link_holder").style.width="330px"),void 0!=document.getElementById("ultimate_chat_close_holder")&&(document.getElementById("ultimate_chat_close_holder").style.width="330px"),removeClass("a_avatar_border","a_avatar_border_wide"),removeClass("a_content_wrap","content_wrap_wide"),removeClass("admin_msg","admin_msg_wide"),removeClass("u_avatar_border","u_avatar_border_wide"),removeClass("u_content_wrap","content_wrap_wide"),removeClass("user_msg","user_msg_wide")),document.getElementById("ultimate_chat_options").style.visibility="hidden"}function scrollType(){"manual"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widget_scroll_type")?(document.getElementById("scroll_btn").innerHTML='<icon class="usc_options_icon" data-icon="j"></icon>Auto scroll</span>',sessionStorage.setItem("ultimate_support_chat-jsSession--widget_scroll_type","manual")):(document.getElementById("chat_history").scrollTop=document.getElementById("chat_history").scrollHeight,document.getElementById("scroll_btn").innerHTML='<icon class="usc_options_icon" data-icon="j"></icon>Manual scroll</span>',sessionStorage.setItem("ultimate_support_chat-jsSession--widget_scroll_type","auto")),document.getElementById("ultimate_chat_options").style.visibility="hidden"}function emojiPanel(e){0==emojiListenersActivated&&(activateEmojiListeners(),emojiListenersActivated=!0,"twitter"==emojiFamily&&twemoji.parse(document.getElementById("usc_emoji_picker"),{size:72}));var t=document.getElementById("usc_emoji_picker"),a=t.style.visibility;(""==a||"hidden"==a)&&(t.style.visibility="visible","wide"==sessionStorage.getItem("ultimate_support_chat-jsSession--widgetWidthMode")?document.getElementById("chat_history").style.height="339px":document.getElementById("chat_history").style.height="169px"),("visible"==a||"close"==e)&&(t.style.visibility="hidden","wide"==sessionStorage.getItem("ultimate_support_chat-jsSession--widgetWidthMode")?document.getElementById("chat_history").style.height="485px":document.getElementById("chat_history").style.height="304px"),document.getElementById("ultimate_chat_options").style.visibility="hidden"}function activateEmojiListeners(){function e(){0!=this.getAttribute("data-list")&&a(this.getAttribute("data-hex")),t('<img class="usc_emoji_lg" src="'+this.firstChild.getAttribute("src")+'" />',wysiwygNode)}function t(e,t){if(wysiwygNode.innerHTML=wysiwygNode.innerHTML+e,t.focus(),"undefined"!=typeof window.getSelection&&"undefined"!=typeof document.createRange){var a=document.createRange();a.selectNodeContents(t),a.collapse(!1);var o=window.getSelection();o.removeAllRanges(),o.addRange(a)}else if("undefined"!=typeof document.body.createTextRange){var s=document.body.createTextRange();s.moveToElementText(t),s.collapse(!1),s.select()}}function a(t){s.unshift(t),s=o(s),s.length>=72&&s.pop(),localStorage.setItem("USC-recently-used-emoji",JSON.stringify(s)),p="";for(var a=0;a<s.length;a++)p+='<li data-list="0" data-hex="'+s[a]+'">&#x'+s[a]+"</li>";recentEmojiContentHolder=document.getElementById("content0"),recentEmojiContentHolder.innerHTML='<ul id="emoji-list-0" class="emoji-list">'+p+"</ul>",twemoji.parse(recentEmojiContentHolder,{size:72}),emojiList_0=document.getElementById("emoji-list-0").getElementsByTagName("li");for(var a=0;a<emojiList_0.length;a++)emojiList_0[a].addEventListener("click",e,!1)}function o(e){for(var t=[],a=0;a<e.length;a++)-1==t.indexOf(e[a])&&t.push(e[a]);return t}var s=JSON.parse(localStorage.getItem("USC-recently-used-emoji"));null==s&&(s=["1F600","1F601","1F602"],localStorage.setItem("USC-recently-used-emoji",JSON.stringify(s)));var i=["1F600","1F601","1F602","1F603","1F604","1F605","1F606","1F607","1F608","1F609","1F60A","263A","1F60B","1F60C","1F60D","1F60E","1F60F","1F610","1F611","1F612","1F613","1F614","1F615","1F616","1F617","1F618","1F619","1F61A","1F61B","1F61C","1F61D","1F61E","1F61F","1F620","1F621","1F622","1F623","1F624","1F625","1F626","1F627","1F628","1F629","1F62A","1F62B","1F62C","1F62D","1F62E","1F62F","1F630","1F631","1F632","1F633","1F634","1F635","1F636","1F637","1F638","1F639","1F63A","1F63B","1F63C","1F63D","1F63E","1F63F","1F640","1F47D","1F47E","1F47F","1F480"],n=["1F445","1F446","1F447","1F448","1F449","1F44A","1F44B","1F44C","1F44D","1F44E","1F44F","1F450","270A","270B","270C","261D","1F4AA","1F4A9","1F451","1F452","1F453","1F454","1F455","1F456","1F457","1F458","1F459","1F45A","1F45B","1F45C","1F45D","1F45E","1F45F","1F460","1F461","1F462","1F463","1F464","1F465","1F466","1F467","1F468","1F469","1F46A","1F46B","1F46C","1F46D","1F46E","1F46F","1F470","1F471","1F472","1F473","1F474","1F475","1F476","1F477","1F478","1F479","1F47A","1F47B","1F47C","1F481","1F482","1F483","1F484","1F485","1F486","1F487","1F488","1F489","1F48A","1F48B","1F48C","1F48D","1F48E","1F48F","1F490","1F491","1F492","1F493","1F494","1F495","1F496","1F497","1F498","1F499","1F49A","1F49B","1F49C","1F49D","1F49E","1F49F","1F440","1F442","1F443","1F444","1F645","1F646","1F647","1F648","1F649","1F64A","1F64B","1F64C","1F64D","1F64E","1F64F"],r=["2708","1F680","1F681","1F682","1F683","1F684","1F685","1F686","1F687","1F688","1F689","1F68A","1F68B","1F68C","1F68D","1F68E","1F68F","1F690","1F691","1F692","1F693","1F694","1F695","1F696","1F697","1F698","1F699","1F69A","1F69B","1F69C","1F69D","1F69E","1F69F","1F6A0","1F6A1","1F6A2","1F6A3","1F6A4","1F6A5","1F6A6","1F6A7","1F6A8","1F6A9","1F6AA","1F6AB","1F6AC","1F6AD","1F6AE","1F6AF","1F6B2","1F6B3","1F6B4","1F6B5","1F6B6","1F6B7","1F6B8"],l=["1F301","1F303","1F304","1F305","1F306","1F307","1F308","1F309","1F30A","1F30B","1F30C","1F30D","1F30E","1F30F","1F310","1F311","1F312","1F313","1F314","1F315","1F316","1F317","1F318","1F319","1F31A","1F31B","1F31C","1F31D","1F31E","1F4A7","1F4A8","26C5","2600","2601","1F31F","1F320","1F330","1F331","1F332","1F333","1F334","1F335","1F337","1F338","1F339","1F33A","1F33B","1F33C","1F33D","1F33E","1F33F","1F340","1F341","1F342","1F343"],d=["1F362","1F363","1F364","1F365","1F366","1F367","1F368","1F369","1F36A","1F36B","1F36C","1F36D","1F36E","1F36F","1F370","1F371","1F372","1F373","1F374","1F375","1F376","1F377","1F378","1F379","1F37A","1F37B","1F37C","1F380","1F381","1F382","1F344","1F345","1F346","1F347","1F348","1F349","1F34A","1F34B","1F34C","1F34D","1F34E","1F34F","1F350","1F351","1F352","1F353","1F354","1F355","1F356","1F357","1F358","1F359","1F35A","1F35B","1F35C","1F35D","1F35E","1F35F","1F360","1F361"],m=["1F384","1F385","1F386","1F387","1F388","1F389","1F38A","1F38B","1F38C","1F38D","1F38E","1F38F","1F390","1F391","26FA","1F392","1F393","1F3A0","1F3A1","1F3A2","1F3A3","1F3A4","1F3A5","1F3A6","1F3A7","1F3A8","1F3A9","1F3AA","1F3AB","1F3AC","1F3AD","1F3AE","1F3AF","1F3B0","1F3B1","1F3B2","1F3B3","1F3B4","1F3B5","1F3B6","1F3B7","1F3B8","1F3B9","1F3BA","1F3BB","1F3BC","1F3BD","1F3BE","1F3BF","1F3C0","1F3C1","1F3C2","1F3C3","1F3C4","1F3C6","1F3C7","1F3C8","1F3C9","1F3CA","1F3E0","1F3E1","1F3E2","1F3E3","1F3E4","1F3E5","1F3E6","1F3E7","1F3E8","1F3E9","1F3EA","1F3EB","1F3EC","1F3ED","1F3EE","1F3EF","1F3F0","26EA","1F5FB","1F5FC","1F5FD","1F5FE","1F5FF"],g=["1F400","1F401","1F402","1F403","1F404","1F405","1F406","1F407","1F408","1F409","1F40A","1F40B","1F40C","1F40D","1F40E","1F40F","1F410","1F411","1F412","1F413","1F414","1F415","1F416","1F417","1F418","1F419","1F41A","1F41B","1F41C","1F41D","1F41E","1F41F","1F420","1F421","1F422","1F423","1F424","1F425","1F426","1F427","1F428","1F429","1F42A","1F42B","1F42C","1F42D","1F42E","1F42F","1F430","1F431","1F432","1F433","1F434","1F435","1F436","1F437","1F438","1F439","1F43A","1F43B","1F43C","1F43D","1F43E"],u=["1F4A0","1F4A1","1F4A2","1F4A3","1F4A4","1F4A5","1F4A6","1F4AB","1F4AC","1F4AD","1F4AE","1F4AF","1F4B0","1F4B1","1F4B2","1F4B3","1F4B4","1F4B5","1F4B6","1F4B7","1F4B8","1F4B9","1F4BA","1F4BB","1F4BC","1F4BD","1F4BE","1F4BF","1F4C0","1F4C1","1F4C2","1F4C3","1F4C4","1F4C5","1F4C6","1F4C7","1F4C8","1F4C9","1F4CA","1F4CB","1F4CC","1F4CD","1F4CE","1F4CF","1F4D0","1F4D1","1F4D2","1F4D3","1F4D4","1F4D5","1F4D6","1F4D7","1F4D8","1F4D9","1F4DA","1F4DB","1F4DC","1F4DD","1F4DE","1F4DF","1F4E0","1F4E1","1F4E2","1F4E3","1F4E4","1F4E5","1F4E6","1F4E7","1F4E8","1F4E9","1F4EA","1F4EB","1F4EC","1F4ED","1F4EE","1F4EF","1F4F0","1F4F1","1F4F2","1F4F3","1F4F4","1F4F5","1F4F6","1F4F7","1F4F9","1F4FA","1F4FB","1F4FC","1F500","1F507","1F508","1F50A","1F50B","1F50C","1F50D","1F50E","1F50F","1F510","1F511","1F512","1F513","1F514","1F515","1F516","1F517","1F518","1F51E","1F524","1F525","1F526","1F527","1F528","1F529","1F52A","1F52B","1F52C","1F52D","1F52E","1F52F","1F530","1F531","1F559","1F6B9","1F6BA","1F6BB","1F6BC","1F6BD","1F6BE","1F6BF","1F6C0","1F6C1","1F6C2","1F6C3","1F6C4","1F6C5","203C","2049","2122","2139","231A","231B","23F0","23F3","24C2","260E","2611","1F302","2614","2615","2648","2649","264A","264B","264C","264D","264E","264F","2650","2651","2652","2653","2660","2663","2665","2666","2668","267B","267F","2693","26A0","26A1","26AA","26AB","26BD","26BE","26C4","26CE","26D4","26F2","26F3","26F5","26FD","2702","2705","2709","270F","2712","2714","2716","2728","2733","2734","1F505","1F506","2744","2747","274C","274E","2753","2754","2755","2757","2764","2795","1F004","1F0CF"];if(null!==document.getElementById("usc_wysiwyg")){var _=s,h=[_,i,n,r,l,d,m,g,u];for(c=0;c<=8;c++){var p="";for(C=0;C<h[c].length;C++)p+='<li data-list="'+c+'" data-hex="'+h[c][C]+'">&#x'+h[c][C]+"</li>";document.getElementById("emoji-list-"+c).innerHTML=p}var F;for(c=0;c<=8;c++){F=document.getElementById("emoji-list-"+c).getElementsByTagName("li");for(var C=0;C<F.length;C++)F[C].addEventListener("click",e,!1)}}}if("all"==jsGlobalConfig.allowedDomains&&(target_origin=jsGetVars.origin),void 0==jsGlobalConfig.allowedDomains||"limited"==jsGlobalConfig.allowedDomains){for(var allowedDomainsList=jsGlobalConfig.allowedDommainsList.split(","),i=0;i<allowedDomainsList.length;i++)allowedDomainsList[i]=allowedDomainsList[i].trim();var allowedDomainBool=allowedDomainsList.indexOf(jsGetVars.origin)>-1;allowedDomainBool===!0&&(target_origin=jsGetVars.origin)}window.addEventListener&&parent.postMessage({task:"iframe_init_"+jsThemeConfig.triggerMethod},target_origin);var browser=getBrowserNoVersion(jsGetVars.browser);if(sessionStorage.setItem("ultimate_support_chat-current_url",jsGetVars.current_url),sessionStorage.setItem("ultimate_support_chat-ref_url",jsGetVars.ref_url),sessionStorage.setItem("ultimate_support_chat-current_url",jsGetVars.current_url),sessionStorage.setItem("ultimate_support_chat-ref_url",jsGetVars.ref_url),null===localStorage.getItem("ultimate_support_chat-jsCookie")){var jsCookieID=generateJsUniqueID();localStorage.setItem("ultimate_support_chat-jsCookie",jsCookieID),initTracker()}else null!==localStorage.getItem("ultimate_support_chat-jsCookie")&&null===sessionStorage.getItem("ultimate_support_chat-jsSession")?initTracker():jsGetVars.ip_address!=sessionStorage.getItem("ultimate_support_chat-jsSession--ip_address")?initTracker():null!==sessionStorage.getItem("ultimate_support_chat-jsSession--page_before_refresh")&&null===sessionStorage.getItem("ultimate_support_chat-jsSession--post_started")&&sessionStorage.getItem("ultimate_support_chat-current_url")!=sessionStorage.getItem("ultimate_support_chat-jsSession--page_before_refresh")&&"all"==trackPages&&trackerPing();if("slideside"==jsThemeConfig.triggerMethod){var holderBorder="";""!=jsThemeConfig.widgetBorder&&(holderBorder="border:1px solid "+jsThemeConfig.widgetBorder+"; border-top:none; ");var headerBorder="";""!=jsThemeConfig.widgetBorder&&(headerBorder="border:1px solid ");var headerShadow="",bodyShadow="";"true"==jsThemeConfig.widgetShadow&&(headerShadow=";box-shadow: -5px 0px 35px -10px #000; -webkit-box-shadow: -5px 0px 35px -10px #000;",bodyShadow=";box-shadow: 0px 15px 35px -10px #000; -webkit-box-shadow: 0px 15px 35px -10px #000;","Microsoft"==browser&&(headerShadow=";box-shadow: -5px 0px 42px -10px #000;",bodyShadow=";box-shadow: 0px 15px 42px -10px #000;"));var addHeaderImages="",slidesideTextMargin="",slidesideHeaderMargin="";"none"!=jsThemeConfig.headerImageType,jsThemeConfig.widgetBackgroundImg="",jsThemeConfig.headerBackgroundImg="","image"==jsThemeConfig.backgroundStyle&&(jsThemeConfig.backgroundColor="transparent")}else{var borderBool="";""!=jsThemeConfig.widgetBorder&&(borderBool="border:1px solid ");var shadowBool="";"true"==jsThemeConfig.widgetShadow&&(shadowBool=";box-shadow: 0 5px 35px -10px #000; -webkit-box-shadow: 0 5px 35px -10px #000","Microsoft"==browser&&(shadowBool=";box-shadow: 0 5px 42px -10px #000;")),addHeaderImages="",jsThemeConfig.widgetBackgroundImg="",jsThemeConfig.headerBackgroundImg=""}var headerColor="background:"+jsThemeConfig.headerColor+";";if(""!=jsThemeConfig.headerGradient&&(headerColor="background-image: -ms-linear-gradient(right, "+jsThemeConfig.headerGradient+" 0%, "+jsThemeConfig.headerColor+" 100%);background-image: -o-linear-gradient(right, "+jsThemeConfig.headerGradient+" 0%, "+jsThemeConfig.headerColor+" 100%);background:linear-gradient(right,"+jsThemeConfig.headerGradient+","+jsThemeConfig.headerColor+");background:-webkit-linear-gradient(right,"+jsThemeConfig.headerGradient+","+jsThemeConfig.headerColor+");background:-moz-linear-gradient(right,"+jsThemeConfig.headerGradient+","+jsThemeConfig.headerColor+");"),"default"==jsThemeConfig.triggerMethod){var widgetButtonColor="background:"+jsThemeConfig.widgetButtonColor+";";""!=jsThemeConfig.widgetButtonColorGradient&&(widgetButtonColor="background-image: -ms-linear-gradient(right, "+jsThemeConfig.widgetButtonColorGradient+" 0%, "+jsThemeConfig.widgetButtonColor+" 100%);background-image: -o-linear-gradient(right, "+jsThemeConfig.widgetButtonColorGradient+" 0%, "+jsThemeConfig.widgetButtonColor+" 100%);background:linear-gradient(right,"+jsThemeConfig.widgetButtonColorGradient+","+jsThemeConfig.widgetButtonColor+");background:-webkit-linear-gradient(right,"+jsThemeConfig.widgetButtonColorGradient+","+jsThemeConfig.widgetButtonColor+");background:-moz-linear-gradient(right,"+jsThemeConfig.widgetButtonColorGradient+","+jsThemeConfig.widgetButtonColor+");")}var m1BtnBackground="background:"+jsThemeConfig.chatBtnMsgBackgroundColor+";";""!=jsThemeConfig.chatBtnMsgBackgroundGradient&&(m1BtnBackground="background-image: -ms-linear-gradient(right, "+jsThemeConfig.chatBtnMsgBackgroundGradient+" 0%, "+jsThemeConfig.chatBtnMsgBackgroundColor+" 100%);background-image: -o-linear-gradient(right, "+jsThemeConfig.chatBtnMsgBackgroundGradient+" 0%, "+jsThemeConfig.chatBtnMsgBackgroundColor+" 100%);background:linear-gradient(right,"+jsThemeConfig.chatBtnMsgBackgroundGradient+","+jsThemeConfig.chatBtnMsgBackgroundColor+");background:-webkit-linear-gradient(right,"+jsThemeConfig.chatBtnMsgBackgroundGradient+","+jsThemeConfig.chatBtnMsgBackgroundColor+");background:-moz-linear-gradient(right,"+jsThemeConfig.chatBtnMsgBackgroundGradient+","+jsThemeConfig.chatBtnMsgBackgroundColor+");");var m3BtnBackground="background:"+jsThemeConfig.sendMailBtnBackgroundColor+";";""!=jsThemeConfig.sendMailBtnBackgroundGradient&&(m3BtnBackground="background-image: -ms-linear-gradient(right, "+jsThemeConfig.sendMailBtnBackgroundGradient+" 0%, "+jsThemeConfig.sendMailBtnBackgroundColor+" 100%);background-image: -o-linear-gradient(right, "+jsThemeConfig.sendMailBtnBackgroundGradient+" 0%, "+jsThemeConfig.sendMailBtnBackgroundColor+" 100%);background:linear-gradient(right,"+jsThemeConfig.sendMailBtnBackgroundGradient+","+jsThemeConfig.sendMailBtnBackgroundColor+");background:-webkit-linear-gradient(right,"+jsThemeConfig.sendMailBtnBackgroundGradient+","+jsThemeConfig.sendMailBtnBackgroundColor+");background:-moz-linear-gradient(right,"+jsThemeConfig.sendMailBtnBackgroundGradient+","+jsThemeConfig.sendMailBtnBackgroundColor+");");var requireName="",requireEmail="";1==jsThemeConfig.requireName&&(requireName='<input type="text" class="ultimate_chat_input_m1" placeholder="'+jsThemeConfig.m1PlaceholderTextName+'" id="username" name="username" value="" required/>'),1==jsThemeConfig.requireEmail&&(requireEmail='<input type="email" class="ultimate_chat_input_m1" placeholder="'+jsThemeConfig.m1PlaceholderTextEmail+'" id="useremail" name="useremail" value="" required/>');var mark_up_var1="";"default"==jsThemeConfig.triggerMethod&&(mark_up_var1='<span class="ultimate_chat_close_holder" id="ultimate_chat_close_holder"><icon class="'+jsThemeConfig.triggerMethod+'_chaticon_s" data-icon="b" style="color:'+jsThemeConfig.headerTextColor+'"></icon></span></div>'),"slideup"==jsThemeConfig.triggerMethod&&(mark_up_var1='<span class="ultimate_chat_link_holder" id="chat_link_holder"><icon class="'+jsThemeConfig.triggerMethod+'_chaticon" data-icon="e" style="color:'+jsThemeConfig.headerTextColor+'"></icon></span></div>'),"slideside"==jsThemeConfig.triggerMethod&&(mark_up_var1="");var buttonTriggerVar="",mark_up_var2="";"default"==jsThemeConfig.triggerMethod&&(buttonTriggerVar='<div class="ultimate_chat_btn_wrap" id="ultimate_chat_btn_wrap"><div class="ultimate_chat_start_btn" id="ultimate_chat_start_btn" style="'+widgetButtonColor+'"><icon class="'+jsThemeConfig.triggerMethod+'_chaticon" data-icon="e" style="color:'+jsThemeConfig.widgetButtonColorIcon+'"></icon></div></div>',mark_up_var2=buttonTriggerVar),"slideside"==jsThemeConfig.triggerMethod&&(mark_up_var2="</div>");var mark_up_var_init="",ultimate_chat_holder="",ultimate_chat_holder_slideside="",slideside_link_holder="",ultimate_chat_header="",ultimate_chat_header_text="",slideside_shadow_eraser="",slideside_header_text="";"slideside"==jsThemeConfig.triggerMethod?(ultimate_chat_holder_slideside='<div class="ultimate_chat_holder holder_'+jsThemeConfig.triggerMethod+'" id="ultimate_chat_holder" style=";'+holderBorder+shadowBool+";border-top-left-radius: "+jsThemeConfig.widgetRadius+";border-top-right-radius: "+jsThemeConfig.widgetRadius+";background:"+jsThemeConfig.backgroundColor+bodyShadow+'" ',slideside_link_holder='<div class="ultimate_chat_link_holder_'+jsThemeConfig.triggerMethod+'" id="ultimate_chat_link_holder" style=";'+headerColor+";"+headerBorder+jsThemeConfig.widgetBorder+headerShadow+";border-top-left-radius: "+jsThemeConfig.widgetRadius+";border-top-right-radius: "+jsThemeConfig.widgetRadius+";border-bottom-left-radius: "+jsThemeConfig.widgetRadius+';border-right:none;"><icon class="'+jsThemeConfig.triggerMethod+'_chaticon" data-icon="e" style="color:'+jsThemeConfig.headerTextColor+'"></icon></div>',slideside_shadow_eraser='<div class="ultimate_chat_shadow_eraser" style="background:'+jsThemeConfig.backgroundColor+'"></div>',slideside_header_text='<div id="ultimate_chat_header_text" class="ultimate_chat_header_text" style="color:'+jsThemeConfig.headerTextColor+'">',mark_up_var_init=ultimate_chat_holder_slideside+' data-module="1" >'+slideside_link_holder+slideside_shadow_eraser+slideside_header_text+jsThemeConfig.headerTextM1+"</div>"):(ultimate_chat_holder='<div class="ultimate_chat_holder" id="ultimate_chat_holder"style="'+("default"==jsThemeConfig.triggerMethod?"style='display:none'":"")+";"+borderBool+jsThemeConfig.widgetBorder+shadowBool+";border-top-left-radius: "+jsThemeConfig.widgetRadius+";border-top-right-radius: "+jsThemeConfig.widgetRadius+";background:"+jsThemeConfig.backgroundColor+'" ',ultimate_chat_header='<div class="ultimate_chat_header" id="ultimate_chat_header" style="'+headerColor+'">',ultimate_chat_header_text='<span class="header_text" style="color:'+jsThemeConfig.headerTextColor+'">',mark_up_var_init=ultimate_chat_holder+' data-module="1" >'+ultimate_chat_header+ultimate_chat_header_text+jsThemeConfig.headerTextM1+"</span>"+mark_up_var1);var mark_up=mark_up_var_init+'<div class="ultimate_chat_invite_message" style="color:'+jsThemeConfig.initMsgColor+'">'+jsThemeConfig.initMsgModule_1+'</div><div class="ultimate_chat_enter_username_spacer"></div><div id="user_avatar_wrapper" style="display:none; margin-bottom: 20px;"><span id="control_prev" class="control_prev" style="'+m1BtnBackground+"; color:"+jsThemeConfig.chatBtnMsgFontColor+'"><</span><span id="control_next" class="control_next" style="'+m1BtnBackground+"; color:"+jsThemeConfig.chatBtnMsgFontColor+'">></span><div id="avatar_holder"><ul id="avatar_list" class="avatar_li"></ul></div></div><form id="start_chat_m1" method="post">'+requireName+requireEmail+'<input type="submit" class="ultimate_chat_button" value="'+jsThemeConfig.chatBtnMsg+'" style="'+m1BtnBackground+"; color:"+jsThemeConfig.chatBtnMsgFontColor+'"/></form><div id="returned_msg" style="color:red; line-height: 0; text-align: center;"></div></div>'+mark_up_var2,chatMarkup_init="";"default"==jsThemeConfig.triggerMethod&&(chatMarkup_init=ultimate_chat_holder+' data-module="2" ><div class="ultimate_chat_header" id="ultimate_chat_header" style="'+headerColor+'"><span class="ultimate_chat_close_holder" id="ultimate_chat_close_holder"><icon class="'+jsThemeConfig.triggerMethod+'_chaticon_s" data-icon="b" style="color:'+jsThemeConfig.headerTextColor+'"></icon></span><span class="header_image" id="header_image">'+addHeaderImages+'</span><span class="header_text" style="color:'+jsThemeConfig.headerTextColor+'">'+jsThemeConfig.headerTextM2+'</span><span class="ultimate_chat_options_btn" onclick="showOptions()"><icon class="'+jsThemeConfig.triggerMethod+'_optionsicon" data-icon="r" style="color:'+jsThemeConfig.headerTextColor+'"></icon></span></div>'),"slideup"==jsThemeConfig.triggerMethod&&(chatMarkup_init=ultimate_chat_holder+' data-module="2" ><div class="ultimate_chat_header" id="ultimate_chat_header" style="'+headerColor+'"><span class="header_image" id="header_image">'+addHeaderImages+'</span><span class="header_text" style="color:'+jsThemeConfig.headerTextColor+'">'+jsThemeConfig.headerTextM2+'</span><span class="ultimate_chat_link_holder" id="chat_link_holder"><icon class="'+jsThemeConfig.triggerMethod+'_chaticon" data-icon="e" style="color:'+jsThemeConfig.headerTextColor+'"></icon></span><span class="ultimate_chat_options_btn" onclick="showOptions()"><icon class="'+jsThemeConfig.triggerMethod+'_optionsicon" data-icon="r" style="color:'+jsThemeConfig.headerTextColor+'"></icon></span></div>'),"slideside"==jsThemeConfig.triggerMethod&&(chatMarkup_init=ultimate_chat_holder_slideside+' data-module="2" >'+slideside_link_holder+'<span class="ultimate_chat_options_btn" onclick="showOptions()"><icon class="'+jsThemeConfig.triggerMethod+'_optionsicon" data-icon="r" style="color:'+jsThemeConfig.headerTextColor+'"></icon></span><div class="ultimate_chat_shadow_eraser w_menu" style="background:'+jsThemeConfig.backgroundColor+'"></div><div id="ultimate_chat_header_text" class="ultimate_chat_header_text" style="'+slidesideTextMargin+"; color:"+jsThemeConfig.headerTextColor+'">'+jsThemeConfig.headerTextM2+'</div><span class="header_image" id="header_image" style="'+slidesideHeaderMargin+'">'+addHeaderImages+"</span>");var chatHistoryVar="";chatHistoryVar="default"==jsThemeConfig.triggerMethod?'<div class="'+jsThemeConfig.triggerMethod+'_chat_history_holder" id="chat_history_holder"><div class="'+jsThemeConfig.triggerMethod+'_chat_history" id="chat_history" style="background:'+jsThemeConfig.backgroundColor+'; color:white">':'<div class="'+jsThemeConfig.triggerMethod+'_chat_history_holder"><div class="'+jsThemeConfig.triggerMethod+'_chat_history" id="chat_history">';var sound_status="Sound on",sound_status_icon="n";if("off"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widget_soundNotification")){sound_status="Sound off";var sound_status_icon="o"}var scroll_type="Auto";if("manual"!=sessionStorage.getItem("ultimate_support_chat-jsSession--widget_scroll_type"))var scroll_type="Manual";var chatMarkup=chatMarkup_init+'<ul id="ultimate_chat_options"><li class="ultimate_chat_options_li" '+("slideside"==jsThemeConfig.triggerMethod?"style='margin-right: 20px !important; top: 50px;'":"")+'><span id="sound_on_off_btn" onclick="soundOnOff()"><icon class="usc_options_icon" data-icon="'+sound_status_icon+'"></icon>'+sound_status+'</span><span id="wide_mode_btn" data-value="narrow" onclick="wideMode()"><icon class="usc_options_icon" data-icon="c"></icon>Wide mode</span><span id="scroll_btn" data-value="auto" onclick="scrollType()"><icon class="usc_options_icon" data-icon="j"></icon>'+scroll_type+' scroll</span><span id="emogi_btn" onclick="emojiPanel()"><icon class="usc_options_icon" data-icon="d"></icon>Emoji</span><span id="end_chat_btn"><icon class="usc_options_icon" data-icon="g"></icon>End chat</span></li></ul>'+chatHistoryVar+'<div class="a_reply"><span class="a_1"></span><span class="a_avatar_border"></span><span class="a_content_wrap"><span class="a_2"></span><span class="a_3"></span><span class="a_4"></span></span></div><div class="u_reply"><span class="u_1"></span><span class="u_avatar_border"></span><span class="u_content_wrap"><span class="u_2"></span><span class="u_3"></span><span class="u_4"></span></span></div></div></div><div id="usc_emoji_picker"></div><div id="ultimate_chat_bottom_textarea_wrapper" style="background-color: '+jsThemeConfig.textarea2BackgroundColor+'"><div id="usc_wysiwyg" class="ultimate_chat_bottom_textarea" contenteditable="true" placeholder="'+jsThemeConfig.m2PlaceholderTextMessage+'"></div><input name="user_ui"  type="hidden" id="user_ui" value=""><button id="emoji_btn" class="emoji_btn_icon" style="color: '+jsThemeConfig.textarea2EmojiBtnColor+'" onclick="emojiPanel()"><icon data-icon="d"></icon></button><button id="submit_reply" class="sendicon" style="color: '+jsThemeConfig.textarea2BtnColor+'"><icon data-icon="s"></icon></button></div></div>'+buttonTriggerVar,message_init_front="";"default"==jsThemeConfig.triggerMethod&&(message_init_front=ultimate_chat_holder+' data-module="3" >'+ultimate_chat_header+ultimate_chat_header_text+jsThemeConfig.headerTextM3+'</span><span class="ultimate_chat_close_holder" id="ultimate_chat_close_holder" style="color:'+jsThemeConfig.headerTextColor+'"><icon class="'+jsThemeConfig.triggerMethod+'_chaticon_s" data-icon="b"></icon></span></div>'),"slideup"==jsThemeConfig.triggerMethod&&(message_init_front=ultimate_chat_holder+' data-module="3" >'+ultimate_chat_header+ultimate_chat_header_text+jsThemeConfig.headerTextM3+'</span><span class="ultimate_chat_link_holder" id="chat_link_holder"><icon class="'+jsThemeConfig.triggerMethod+'_chaticon" data-icon="e" style="color:'+jsThemeConfig.headerTextColor+'"></icon></span></div>'),"slideside"==jsThemeConfig.triggerMethod&&(message_init_front=ultimate_chat_holder_slideside+' data-module="3" >'+slideside_link_holder+slideside_shadow_eraser+slideside_header_text+jsThemeConfig.headerTextM3+'<div class="ultimate_chat_enter_username_spacer"></div>');var message_init=message_init_front+'<div class="ultimate_chat_enter_username_spacer"></div><form id="send_msg_m3" method="post"><div id="error_handling" style="color:red; margin-top:-22px; text-align: center; height:22px"></div><input type="text" class="ultimate_chat_input" name="contact_name" id="contact_name" placeholder="'+jsThemeConfig.m3PlaceholderTextName+'" required/><input type="email" class="ultimate_chat_input" name="contact_email" id="contact_email" placeholder="'+jsThemeConfig.m3PlaceholderTextEmail+'" required/><textarea class="ultimate_chat_textarea ultimate_chat_input"  name="contact_message" id="contact_message" placeholder="'+jsThemeConfig.m3PlaceholderTextMessage+'" required></textarea><input type="submit" class="ultimate_chat_button" value="'+jsThemeConfig.sendMailBtn+'" style="'+m3BtnBackground+"; color:"+jsThemeConfig.sendMailBtnFontColor+'"/></form/></div>'+buttonTriggerVar;if(null===sessionStorage.getItem("ultimate_support_chat-jsSession--user_name")){var operatorsOnline="<?php echo checkOperator();?>";operatorsOnline>0?(markup(),"1"==jsThemeConfig.requireAvatar&&"img"==jsThemeConfig.userAvatarSelect&&(document.getElementById("user_avatar_wrapper").style.display="block",showAvatarSelect())):"true"!=jsGlobalConfig.offline_hide&&messageInit()}else chatInit(sessionStorage.getItem("ultimate_support_chat-jsSession--user_name"),sessionStorage.getItem("ultimate_support_chat-jsSession--request_id"));void 0!=document.getElementById("ultimate_chat_start_btn")&&(document.getElementById("ultimate_chat_start_btn").onclick=function(){setSlideUpToggle("open")}),void 0!=document.getElementById("start_chat_m1")&&(document.getElementById("start_chat_m1").onsubmit=function(){var e="usc_client",t="";if(1==jsThemeConfig.requireName&&(e=document.getElementById("username").value,""==e))return document.getElementById("returned_msg").innerHTML="Please fill out all fields.",!1;if(1==jsThemeConfig.requireEmail){if(t=document.getElementById("useremail").value,""==t)return document.getElementById("returned_msg").innerHTML="Please fill out all fields.",!1;var a=validateEmail(t);if(0==a)return document.getElementById("returned_msg").innerHTML="Please enter a valid email address.",!1}var o=new XMLHttpRequest;return o.onreadystatechange=function(){if(4==o.readyState&&200==o.status){var t=JSON.parse(o.responseText);"0"!=t.request_id?(sessionStorage.setItem("ultimate_support_chat-jsSession--user_name",t.user_name),sessionStorage.setItem("ultimate_support_chat-jsSession--request_id",t.request_id),sessionStorage.setItem("ultimate_support_chat-jsSession--widget_chat_length","1"),chatInit(e,t.request_id)):document.getElementById("returned_msg").innerHTML="start chat error"}},o.open("POST","start_chat.php",!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.send("jsCookie="+localStorage.getItem("ultimate_support_chat-jsCookie")+"&encodedGetVars="+encodedGetVars+"&user_id="+sessionStorage.getItem("ultimate_support_chat-jsSession--user_id")+"&country_name="+sessionStorage.getItem("ultimate_support_chat-jsSession--country_name")+"&country_code="+sessionStorage.getItem("ultimate_support_chat-jsSession--country_code")+"&longitude="+sessionStorage.getItem("ultimate_support_chat-jsSession--longitude")+"&latitude="+sessionStorage.getItem("ultimate_support_chat-jsSession--latitude")+"&avatar="+sessionStorage.getItem("ultimate_support_chat-jsSession--userAvatar")+"&username="+e+"&useremail="+t),!1}),void 0!=document.getElementById("send_msg_m3")&&(document.getElementById("send_msg_m3").onsubmit=function(){var e=document.getElementById("contact_name").value,t=document.getElementById("contact_email").value,a=document.getElementById("contact_message").value;if(""==e||""==t||""==a)return document.getElementById("error_handling").innerHTML="Please fill out all fields.",!1;if(""!=t){var o=validateEmail(t);if(0==o)return document.getElementById("error_handling").innerHTML="Please enter a valid email address.",!1}var s=new XMLHttpRequest;return s.onreadystatechange=function(){4==s.readyState&&200==s.status&&(document.getElementById("error_handling").innerHTML="Thank you. Your message has been sent",
	setTimeout(function(){setSlideUpToggle("closed")},2e3))},s.open("POST","send_email.php",!0),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.send("contact_name="+e+"&contact_email="+t+"&contact_message="+a+"&encodedGetVars="+encodedGetVars),!1}),window.addEventListener("beforeunload",onbeforeunload);var adminWelcomeMsg;"true"==allowInvite&&null==sessionStorage.getItem("ultimate_support_chat-jsSession--post_started")&&(allowInviteScan(),setInterval(function(){allowInviteScan()},2500));var slideToggleState="";emojiListenersActivated=!1;var iOS=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;1==iOS&&(document.getElementsByTagName("input")[0].addEventListener("focus",function(){parent.postMessage({task:"iOS_focus"},target_origin)}),document.getElementsByTagName("input")[0].addEventListener("blur",function(){parent.postMessage({task:"iOS_blur"},target_origin)}),document.getElementsByTagName("input")[1].addEventListener("focus",function(){parent.postMessage({task:"iOS_focus"},target_origin)}),document.getElementsByTagName("input")[1].addEventListener("blur",function(){parent.postMessage({task:"iOS_blur"},target_origin)}),document.getElementById("usc_wysiwyg").addEventListener("focus",function(){parent.postMessage({task:"iOS_focus"},target_origin)}),document.getElementById("usc_wysiwyg").addEventListener("blur",function(){parent.postMessage({task:"iOS_blur"},target_origin)}));
		

    </script>


<?php


function checkOperator() {
    global $PDO;

    $time = time()-30;
    $command_admin_ready = "SELECT * FROM users WHERE status > $time";
    $result_admin_ready = $PDO->prepare($command_admin_ready);
    $result_admin_ready->execute();
    $num_rows = $result_admin_ready->rowCount();

    return $num_rows;
}