var IMAGEURL = "https://templateshares-ue.net/livechat/themes/default/images/", FULLURL = "https://templateshares-ue.net/livechat/", AJAXLOADER = ''; var type_your_msg_here = "type your message here and press ENTER to send"; var loading = "Loading..."; var you_got_a_new_message = "You got a new message!"; var need_help_chat_now = "Need help? Chat now!"; var end_chat = "End Chat"; var chat_session_end = "This chat session has been end."; function _unixtimestamp() { return Math.round(+new Date()/1000); } $.ajaxSetup({type: "POST", dataType: "json", contentType: "application/x-www-form-urlencoded; charset=UTF-8", encoding: "UTF-8", cache: false, timeout: 25000}); $(document).ready(function() { onlineVisitors(); setInterval(function(){agentWantChat();}, 5000); $(document).on("click", ".liveChatHeader,#yeshelpme", function(e) { e.preventDefault(); if($("#liveChatContainer").css("margin-bottom").charAt(0) == "-") { $("#liveChatContainer").animate({"margin-bottom": 0}, "slow", "easeOutBounce").fadeTo("fast", 1); $(".showHide").attr("src", IMAGEURL+"minimize.png"); $(".alert").html("").hide(); $(".liveChatHeader span").html('Status '+need_help_chat_now); clearInterval(docTitleInterval); document.title = orjDocTitle; totalNewMessages=0; $(".endChat").show(); $("#yourName").focus(); } else { $("#liveChatContainer").animate({"margin-bottom": -420}, "slow", "easeOutBounce").fadeTo("fast", 0.6); $(".showHide").attr("src", IMAGEURL+"maximize.png"); $(".endChat").hide(); } return false; }); $(document).on("submit", "#startChat", function(e) { e.preventDefault(); $(".ajaxError").remove(); var $form = $(this), $data = "isAjax=1&"+$form.serialize(); $form.hide(); $('
'+AJAXLOADER+'Please wait while we establish a connection...
').prependTo(".liveChatNow"); $.ajax ({ url: FULLURL+"ajax/chatNow.php", data: $data, success: function(response) { $(".pleaseWait").remove(); enableInputBoxes(); $("#yourName,#yourEmail,#yourQuestion").removeClass("fieldError"); if(response["ERROR"]) { $('
'+response["ERROR"]+'
').prependTo(".liveChatNow").fadeIn("slow"); $form.show(); if(response["yourName"] && response["yourName"] == "error") { $("#yourName").addClass("fieldError"); } if(response["yourEmail"] && response["yourEmail"] == "error") { $("#yourEmail").addClass("fieldError"); } if(response["yourQuestion"] && response["yourQuestion"] == "error") { $("#yourQuestion").addClass("fieldError"); } } else if(response["CHATSESSION"]) { $(".liveChatNow").html('
'+AJAXLOADER+'One of our agents will be with you shortly...
'); checkAgent(); } } }); return false; }); setInterval(function() { $("#chatStatusIMG").attr("src", "https://templateshares-ue.net/livechat/img.php?t="+_unixtimestamp()); }, 5000); });