var ngageDisplayMode=0; var WebsiteID='184-239-228-231-167-135-182-197'; var main_url = "messenger.ngageics.com"; var ngage_yes_btn = "Yes, Lets Chat!"; var ngage_no_btn = "No Thanks"; var visitor_id = "visitor179-196.210.178.37-WinXP-Firefox-en-us"; var show_ngage_exit_popup = false; var ngage_chat_window_height = 435; var ngage_chat_window_width = 550; var ngage_ap_on=false; var ngage_ap_timeint=60000; var ngage_ap_html=''; var pageLoc = document.location.toString(); var pageRef = document.referrer.toString(); var httpsPreFix; var ns = (navigator.appName.indexOf("Netscape") != -1); var d = document; var px = document.layers ? "" : "px"; var popDiv; var _ngDomain = document.domain; var bolDeniedChat = false; var bolShowedChatInvitetoUser = false; var ng_screen_width = window.screen.width; var ng_screen_height = window.screen.height; var ng_screen_depth = window.screen.colorDepth; var NgageMouseX; var NgageMouseY; //Check if SSL or Not if((pageLoc != null) && (pageLoc.indexOf("https:") == 0)) httpsPreFix = "https://"; else httpsPreFix = "http://"; var PresenceURL=httpsPreFix + main_url + "/isrvr.aspx?websiteid=" + WebsiteID + "&vid=" + visitor_id + "&loc=" + escape(pageLoc) + "&ref=" + escape(pageRef) + "&swidth=" + ng_screen_width + "&sheight=" + ng_screen_height + "&sdepth=" + ng_screen_depth + "&upd=" + (new Date()).getTime(); var ChatCheckURL=httpsPreFix + main_url + "/isrvr.aspx?mode=chatcheck&websiteid=" + WebsiteID + "&vid=" + visitor_id + "&loc=" + escape(pageLoc) + "&ref=" + escape(pageRef) + "&swidth=" + ng_screen_width + "&sheight=" + ng_screen_height + "&sdepth=" + ng_screen_depth + "&upd=" + (new Date()).getTime(); var ChatURL="https://" + main_url + "/chat/index.aspx?websiteid=" + WebsiteID + "&vid=" + visitor_id; var ChatInvitationDivURL= httpsPreFix + main_url + "/ifloatingdiv.aspx?websiteid=" + WebsiteID + "&vid=" + visitor_id + "&domain=" + _ngDomain + "&upd=" + (new Date()).getTime(); var ChatInvitationYesButtonURL=httpsPreFix + main_url + "/ImageRetrievers/PopupButtons.aspx?websiteid=" + WebsiteID + "&type=yes&upd=" + (new Date()).getTime(); var ChatInvitationNoButtonURL=httpsPreFix + main_url + "/ImageRetrievers/PopupButtons.aspx?websiteid=" + WebsiteID + "&type=no&upd=" + (new Date()).getTime(); var ChatInvitationBackground="background-image: url(\"" + httpsPreFix + main_url + "/ImageRetrievers/PopupBG.aspx?websiteid=" + WebsiteID + "\");"; var imgChatCheck; var urlref = escape(document.referrer); var url = escape(document.URL); var screen_dim = escape(screen.width + 'x' + screen.height) function getScrollWidth() { var w = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft; return w ? w : 0; } function getScrollHeight() { var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop; return h ? h : 0; } // Functions for creating, reading, and erasing cookies function getNgageCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } function setNgageCookie(c_name,value,expiremins) { var exdate=new Date(); exdate.setMinutes(exdate.getMinutes()+expiremins); document.cookie=c_name+ "=" +escape(value)+ ((expiremins==null) ? "" : ";expires="+exdate.toGMTString()); } function FloatDiv(id, sx, sy) { var el; try { el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id]; } catch(e) { //return JSFX_FloatDivOverIframe(id, sx, sy); } window[id + "_obj"] = el; if(d.layers)el.style=el; el.cx = el.sx = sx;el.cy = el.sy = sy; el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;}; el.flt=function() { var pX, pY; pX = (this.sx >= 0) ? 0 : ns ? innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth; pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop; if(this.sy<0) pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight; this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8; this.sP(this.cx, this.cy); setTimeout(this.id + "_obj.flt()", 1); } return el; } try { window.addEventListener('load',function(e){LoadPresence();}, false); } catch(e) { window.attachEvent('onload',function(e){LoadPresence();}); } function openWindow(URL, isIntegrated) { if (isIntegrated == true) { var integrated_chat_div = document.getElementById('NgageIntegratedChat'); if (integrated_chat_div) { integrated_chat_div.innerHTML = ""; } } else { eval("chatHwin = window.open(URL, 'chatwin', 'toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=no,width=" + ngage_chat_window_width + ",height=" + ngage_chat_window_height + "');"); chatHwin.focus(); } } function LoadPresence() { //Load Image var img_tag=""; var img_adv1_tag=""; try { img_tag = "" + "Click for live chat!"; img_adv1_tag = "Live Chat!"; if(ngageDisplayMode==0) document.getElementById('nGageLH').innerHTML = img_tag; else if(ngageDisplayMode==2) document.getElementById('nGageLH').innerHTML = img_adv1_tag; else { var scripts = document.getElementsByTagName("script"); for (var i = 0; i < scripts.length; i++) { var sourceTemp = scripts[i].getAttribute("src"); if (sourceTemp != null) { var source = sourceTemp.toLowerCase(); if (source.indexOf("ilnksrvr.aspx") >= 1) { var element = null; try { element = document.createElement(""); } catch (e) { } if (!element || element.nodeName != "A") { element = document.createElement('a'); element.setAttribute("id", "ngageChatLnk"); element.setAttribute("href", "javascript:openWindow('" + ChatURL + "', false);"); } element.innerHTML = ''; scripts[i].parentNode.insertBefore(element, scripts[i]); break; } } } } } catch(e) { //Only will error if javascript is disable //or using Ngage VIEWER HTML } setTimeout("fnLoadChatChecker();", 10000); if (ngage_ap_on) setTimeout("BuildAutoChatInviteDiv();", ngage_ap_timeint); if (show_ngage_exit_popup) { LoadNgageMouseHook(); } } function LoadNgageMouseHook() { if (window.addEventListener) { window.addEventListener('mousemove', Ngage_mouseMovement, false); } else { window.attachEvent('mousemove', Ngage_mouseMovement ); } } function Ngage_mouseMovement(event) { var windowWidth = window.innerWidth - 15; if (!window.innerWidth) { windowWidth = document.body.clientWidth - 15; } else { windowWidth = window.innerWidth - 15; windowHeight = window.innerHeight - 15; } if (!event) { event = window.event; // Internet Explorer posX = event.clientX; posY = event.clientY; } else { // Mozilla and others posX = event.pageX - document.body.scrollLeft; posY = event.pageY - document.body.scrollTop; } if ((posX >= 0) && (posX <= 200) && (posY >= 0) && (posY <= 100)) { BuildAutoChatInviteDiv(); } else if ((posX >= windowWidth - 200) && (posX <= windowWidth) && (posY >= 0) && (posY <= 100)) { BuildAutoChatInviteDiv(); } } function fnLoadChatChecker() { //Start Operator Engagement imgChatCheck = document.createElement('IMG'); imgChatCheck.style.visibility = "hidden"; imgChatCheck.id = "imgChatCheck"; imgChatCheck.name = "imgCC1"; imgChatCheck.src = ChatCheckURL + "&updTime=" + (new Date()).getTime(); document.body.appendChild(imgChatCheck); try { imgChatCheck.addEventListener('load',function(e){fnCheckChatStatus();}, false); } catch(e) { imgChatCheck.attachEvent('onload',function(e){fnCheckChatStatus();}); } } function DisplayPresence() { document.getElementById('nGageLH').style.visibility = "visible"; } function BuildAutoChatInviteDiv() { var popup_w = 375; var popup_h = 275; var myBody = document.body; popDiv = document.createElement("div"); var x = screen.availWidth || screen.Width; var y = (getScrollHeight() / 2) + (popup_h / 2); var divHTML=""; var divYesNoButtons=""; x = (x / 2); x = (x - 187); var RunNgageAutoPopup = getNgageCookie('NgageAutoPopup') if (RunNgageAutoPopup == "") { if(!document.getElementById('divAutoChatInvFloater')) { if(!bolShowedChatInvitetoUser) { popDiv.style.visibility = "hidden"; popDiv.style.display = "none"; popDiv.style.position = "absolute"; popDiv.style.zIndex = 1005; popDiv.style.width = popup_w + "px"; popDiv.style.height = popup_h + "px"; popDiv.id = 'divAutoChatInvFloater'; myBody.appendChild(popDiv); popDiv.innerHTML = ngage_ap_html; FloatDiv("divAutoChatInvFloater", x,15).flt(); ShowAutoChatInviteDiv(); setNgageCookie('NgageAutoPopup', 'false', 120); } } } } function BuildChatInviteDiv() { var popup_w = 375; var popup_h = 275; var myBody = document.body; popDiv = document.createElement("div"); var x = screen.availWidth || screen.Width; var y = (getScrollHeight() / 2) + (popup_h / 2); var divHTML=""; var divYesNoButtons=""; x = (x / 2); x = (x - 187); if(bolDeniedChat) { try { document.body.removeChild(document.getElementById('divChatInvFloater')); } catch(e) { } bolDeniedChat=false; } if(!document.getElementById('divChatInvFloater')) { if(!bolShowedChatInvitetoUser) { //Get screen width/height. //Center popup on screen and make it scroll if user //starts scrolling screen. popDiv.style.visibility = "hidden"; popDiv.style.display = "none"; popDiv.style.position = "absolute"; popDiv.style.zIndex = 1005; popDiv.style.width = popup_w + "px"; popDiv.style.height = popup_h + "px"; //popDiv.style.marginLeft = x + "px"; //popDiv.style.marginTop = y + "px"; divYesNoButtons = "Yes"; divYesNoButtons = divYesNoButtons + "No"; divHTML = "
" + divYesNoButtons + "
"; popDiv.id = 'divChatInvFloater'; myBody.appendChild(popDiv); popDiv.innerHTML = divHTML; FloatDiv("divChatInvFloater", x,15).flt(); ShowChatInviteDiv(); bolShowedChatInvitetoUser=true; BlockBackground(true); // Set timer to hide invite after 3600 seconds (1 hour) setTimeout("fnAutoHideInvite();", 3600000); } } } function DenyOperEngage() { document.getElementById('frameChatInvite').src = ChatInvitationDivURL + "&EngageAnswer=false"; document.getElementById('divChatInvFloater').style.visibility = 'hidden'; document.getElementById('divChatInvFloater').style.display = 'none'; bolDeniedChat=true; BlockBackground(false); } function DenyAutoPopup() { document.getElementById('divAutoChatInvFloater').style.visibility = 'hidden'; document.getElementById('divAutoChatInvFloater').style.display = 'none'; BlockBackground(false); } function AcceptAutoPopup() { DenyAutoPopup(); openWindow(ChatURL + "&mode=AutoEngage", false); } function StartOperEngage() { HideChatInviteDiv(); openWindow(ChatURL + "&mode=OperEngage", false); } function ShowChatInviteDiv() { document.getElementById('divChatInvFloater').style.visibility = 'visible'; document.getElementById('divChatInvFloater').style.display = 'block'; } function StartIntegratedChat() { openWindow(ChatURL + "&mode=AutoEngage", true); } function HideIntegratedChat() { var integrated_chat_div = document.getElementById('NgageIntegratedChat'); if (integrated_chat_div) { // clear the InnerHTML integrated_chat_div.innerHTML = ""; } } function ShowAutoChatInviteDiv() { document.getElementById('divAutoChatInvFloater').style.visibility = 'visible'; document.getElementById('divAutoChatInvFloater').style.display = 'block'; BlockBackground(true); } function HideChatInviteDiv() { try { BlockBackground(false); document.getElementById('divChatInvFloater').style.visibility = 'hidden'; document.getElementById('divChatInvFloater').style.display = 'none'; document.body.removeChild(document.getElementById('divChatInvFloater')); } catch(e) { } } function BlockBackground(block) { var _DisableBG = document.createElement('bgDiv'); /* position: absolute; top: 0; left: 0; overflow: hidden; padding: 0; margin: 0; background-color: #000; filter: alpha(opacity=60); opacity: 0.5; display: none; z-index: 1000; width: 100%; height: 100%; */ if (block) { if (!document.getElementById('DisableBackgroundDiv')) { _DisableBG.style.position = "fixed"; _DisableBG.style.top = 0; _DisableBG.style.left = 0; _DisableBG.style.overflow = "hidden"; _DisableBG.style.padding = 0; _DisableBG.style.margin = 0; _DisableBG.style.backgroundColor = "#000"; _DisableBG.style.filter = "alpha(opacity=60)"; _DisableBG.style.opacity = 0.5; _DisableBG.style.display = "block"; _DisableBG.style.zIndex = 1000; _DisableBG.style.width = "100%"; _DisableBG.style.height = "100%"; _DisableBG.style.zoom = "1.0"; _DisableBG.id = 'DisableBackgroundDiv'; document.body.appendChild(_DisableBG); } else { _DisableBG = document.getElementById('DisableBackgroundDiv'); _DisableBG.style.display = 'block'; } } else { if (document.getElementById('DisableBackgroundDiv')) { _DisableBG = document.getElementById('DisableBackgroundDiv'); _DisableBG.style.display = 'none'; } } } function fnAutoHideInvite() { DenyOperEngage(); BlockBackground(false); } function fnCheckChatStatus() { try { //Check Image Status var OpersAvailable=document.getElementById('imgChatCheck').height; var ChatRequested=document.getElementById('imgChatCheck').width; if(ChatRequested==2) { //This is only called to BUILD and display on demand //When a user is engaged. BuildChatInviteDiv(); } setTimeout("imgChatCheck.src = '" + ChatCheckURL+ "&upd=' + (new Date()).getTime();", 9000); } catch(err) { txt=""; } } function LoadAdvChatWindow1() { if(document.getElementById('txtNGageQuickChatName').value.length <=0) document.getElementById('txtNGageQuickChatName').value = "Visitor"; var ngv_name=document.getElementById('txtNGageQuickChatName').value; var ngv_question=document.getElementById('txtNGageQuickChatQuestion').value; var advChatURL="https://" + main_url + "/chat/index.aspx?websiteid=" + WebsiteID + "&vid=" + visitor_id + "&txtVName=" + escape(ngv_name) + "&txtVQuestion=" + escape(ngv_question); openWindow(advChatURL, false); } function NgageIntegratedInvite(InviteMsg) { var integrated_chat_div = document.getElementById('NgageIntegratedChat'); var ChatDivHTML = ""; var RunNgageAutoPopup = getNgageCookie('NgageAutoPopup'); if (RunNgageAutoPopup == "") { if (integrated_chat_div) { //Build Integrated Chat Invite ChatDivHTML = ChatDivHTML + "
"; ChatDivHTML = ChatDivHTML + "
"; ChatDivHTML = ChatDivHTML + "" + InviteMsg + ""; ChatDivHTML = ChatDivHTML + "
"; ChatDivHTML = ChatDivHTML + ""; ChatDivHTML = ChatDivHTML + ""; ChatDivHTML = ChatDivHTML + "
\"Yes\"\"No\"
"; integrated_chat_div.innerHTML = ChatDivHTML; setNgageCookie('NgageAutoPopup', 'false', 120); } } }