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 = ""
+ "";
img_adv1_tag = "
";
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 = "