this.STVisitorValue = "0b04bba2d247472f97e0c4ea13a88aec";
this.STLastCallbackImageHeight = 0;
this.STLastCallbackAction = 0;
this.STIntervalID = 0;
this.STImgHeightActions = 
{
    None: 1,
    DisableAsyncCallback: 2,
    EnableAsyncCallback: 3,
    RemoveFromListPerm: 4,
    RemoveFromList: 5,
    ForceChat: 6, 
    InviteChat: 7,
    SendClientLocation: 8,
    NavigateUrl: 9,
    PopupUrl: 10,
    Biggest_Image: 11
}
var STMovableInvite = null;
var STIsInviteMoving = false;
var STWindowPosX = 0;
var STWindowPosY = 0;

function SmarterTrackAction()
{
    this.OnNormalCheck = function()
    {
        // does nothing
    }
    this.EnableAsyncCallback = function()
    {
        // does nothing
    }
    this.DisableAsyncCallback = function()
    {
        try
        {
            clearInterval(STIntervalID);
        }
        catch (err) { }
    }
    this.RemoveFromListPerm = function()
    {
        STset_cookiePerm("StopTracking", "true");
        try
        {
            clearInterval(STIntervalID);
        }
        catch (err) { }
    }
    this.RemoveFromList = function()
    {
        var paramCook = STget_cookie("OutputParameter");
        if (paramCook != "")
        {
            STset_cookieTime("StopTracking", "true", ";expires=" + paramCook);
        }
        try
        {
            clearInterval(STIntervalID);
        }
        catch (err) { }
        //";expires=Fri, 1 Jan 2038 10:00:00 UTC"
    }
    this.ForceChat = function()
    {
        STInjectScript("&forcechat=true", "");
    }
    this.InviteChat = function(interactId)
    {
        STInjectScript("&sendinvite=true", interactId);
    }
    this.SendClientLocation = function()
    {
        // feature is not allowed
    }
    this.NavigateUrl = function()
    {
        // feature is only allowed from an initiated chat
    }
    this.PopupUrl = function()
    {
        // feature is not allowed
    }
}
function SmarterTrackObject(portal)
{      
    this.TrackingUrl = portal + "App_Themes/Horizon/Javascript/ST.ashx";
    this.TrackPage = function()
    {
        //var firstTimeUrl = this.TrackingUrl + "?firstrun=true";
        this.GetTrackingCode("");
    }
    this.TrackVirtualPage = function(pagename)
    {
        //var firstTimeUrl = this.TrackingUrl + "?firstrun=true&vp="+pagename;
        this.GetTrackingCode(pagename);
    }
    this.GetTrackingCode = function(virtualpage)
    {
        try
        {
            // check and see if this is a tracked session or co-browsing session
            var stopCookie = STget_cookie("StopTracking");
            if (stopCookie == null || (stopCookie != null && stopCookie != "true"))
            {
                STset_cookiePerm("PortalUrl", portal);
                var rid = Math.round(Math.random()*2147483647);
                var trackingDivName = "SmarterTrackingArea"+rid;
                var interactDivName = "SmarterInteractiveArea"+rid;                        
                
                var isInjectCapable = false;
                try
                {
                    STInjectScript("&firstrun=true&sendactionscript=true&dt="+STEscapeTitle()+"&ref="+document.referrer+"&pp="+window.location.href, interactDivName);
                    isInjectCapable = true;
                }
                catch (err)
                {
                    // browser was not capable for the script injection... revert to use the image
                    var firstTimeUrl = this.TrackingUrl + "&firstrun=true&sendactionimage=true&dt="+STEscapeTitle()+"&ref="+document.referrer+"&pp="+window.location.href;
                    document.write("<div style='z-index:150;position:absolute;left:0px;top:0px;"+STGetVisibilityFalse()+"' id='"+trackingDivName+"'><img id='SmarterTrack_ActionDetection' src='"+firstTimeUrl+"' /></div>");            
                }
                document.write("<div style='z-index:151;position:absolute;left:0px;top:0px;"+STGetVisibilityFalse()+"' id='"+interactDivName+"'></div>");
                
                if (isInjectCapable)
                    STIntervalID = setInterval("STRetrackScript('"+interactDivName+"', '"+virtualpage+"');", 4000);
                else
                    STIntervalID = setInterval("STRetrackImage('"+interactDivName+"', '"+trackingDivName+"', '"+virtualpage+"', '"+this.TrackingUrl+"');", 4000);
                
                setTimeout("clearInterval(STIntervalID);", 900000);
            }
        }
        catch (err) { }
    }
}
function STget_cookie(Name) 
{
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) { 
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}
function STset_cookieTemp(Name, Value)
{
    document.cookie =  this.STEncode(Name) +'='+ this.STEncode(Value) + "; path=/";
}
function STset_cookiePerm(Name, Value)
{
    document.cookie =  this.STEncode(Name) +'='+ this.STEncode(Value) + ';expires=Fri, 1 Jan 2038 10:00:00 GMT; path=/';
}
function STset_cookieTime(Name, Value, Expires)
{
    document.cookie =  this.STEncode(Name) +'='+ this.STEncode(Value) + Expires + "; path=/";
}
function STdel_cookie(Name)
{
    document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/";
}
function STGetVisitorCookie()
{
    var visitCookie = STget_cookie("siteuidut");
    if (visitCookie == null || visitCookie == "")
    {
        STset_cookiePerm("siteuidut", this.STVisitorValue);
        return this.STVisitorValue;
    }
    else
    {
        return visitCookie;
    }
}
function STEncode(text)
{
    try
    {
        return encodeURIComponent(text);
    }
    catch(ex)
    {
        return 
        (text);
    }
}
function STCloseMessage(interactId)
{
    var interactArea = document.getElementById(interactId);
    STSetVisibility(interactId, false);
    interactArea.innerHTML = "";
}
function STRetrackScript(interactId, virtualpage)
{
    try
    {
        var vpQS = "";
        if (virtualpage != "")
        {
            vpQS = "&vp="+virtualpage;
        }
        STInjectScript("&sendactionscript=true&ref="+document.referrer+"&dt="+STEscapeTitle()+"&pp="+window.location.href+vpQS, interactId);
    }
    catch (err) { }
}
function STRetrackImage(interactId, trackingId, virtualpage, callerUrl)
{
    try
    {
        var vpQS = "";
        if (virtualpage != "")
        {
            vpQS = "&vp="+virtualpage;
        }
        var callerUrlID = callerUrl + "?postId="+Math.round(Math.random()*2147483647)+"&sendactionimage=true&visitorId="+STGetVisitorCookie()+"&ref="+document.referrer+"&dt="+STEscapeTitle()+"&pp="+window.location.href+vpQS;
        document.getElementById(""+trackingId+"").innerHTML = "<img id='SmarterTrack_ActionDetection' src='"+callerUrlID+"' />";
        DetectSTAction(interactId);
    }
    catch (err) { }
}
function DetectSTAction(interactId)
{
    var actionObj = document.getElementById("SmarterTrack_ActionDetection");
    if (actionObj != null)
    {
        if (actionObj.width != 1 || actionObj.height >= this.STImgHeightActions.Biggest_Image || actionObj.height == 0)
            setTimeout("DetectSTAction('"+interactId+"');", 300);
        else
            this.STHandleCallbackCommand(interactId, actionObj.height);
    }
}
function STHandleCallbackCommand(interactId, height)
{
    if (height == this.STLastCallbackImageHeight) 
        return;
    this.STLastCallbackImageHeight = height;
    if (height > 1)
        this.STLastCallbackAction = height;
    
    var STAction = new SmarterTrackAction();
    switch (height)
    {
        case this.STImgHeightActions.None: STAction.OnNormalCheck(); break; // currently does nothing
        case this.STImgHeightActions.EnableAsyncCallback: STAction.EnableAsyncCallback(); break; // currently does nothing
        case this.STImgHeightActions.DisableAsyncCallback: STAction.DisableAsyncCallback(); break; // currently does nothing
        case this.STImgHeightActions.RemoveFromListPerm: STAction.RemoveFromListPerm(); break;
        case this.STImgHeightActions.ForceChat: STAction.ForceChat(interactId); break;
        case this.STImgHeightActions.InviteChat: STAction.InviteChat(interactId); break;
        case this.STImgHeightActions.SendClientLocation: STAction.SendClientLocation(); break; // currently does nothing
        case this.STImgHeightActions.NavigateUrl: STAction.NavigateUrl(); break; // currently does nothing
        case this.STImgHeightActions.PopupUrl: STAction.PopupUrl(); break; // currently does nothing
        default: break;
    }
}
function STSendAction(visitorId, action, interactId)
{
    try
    {
        if (STGetVisitorCookie() != visitorId)
            return;
            
        this.STLastCallbackImageHeight = action;
        if (action > 1)
            this.STLastCallbackAction = action;
        
        var STAction = new SmarterTrackAction();
        switch (action)
        {
            case this.STImgHeightActions.None: STAction.OnNormalCheck(); break; // currently does nothing
            case this.STImgHeightActions.EnableAsyncCallback: STAction.EnableAsyncCallback(); break; // currently does nothing
            case this.STImgHeightActions.DisableAsyncCallback: STAction.DisableAsyncCallback(); break; // currently does nothing
            case this.STImgHeightActions.RemoveFromListPerm: STAction.RemoveFromListPerm(); break;
            case this.STImgHeightActions.ForceChat: STAction.ForceChat(interactId); break;
            case this.STImgHeightActions.InviteChat: STAction.InviteChat(interactId); break;
            case this.STImgHeightActions.SendClientLocation: STAction.SendClientLocation(); break; // currently does nothing
            case this.STImgHeightActions.NavigateUrl: STAction.NavigateUrl(); break; // currently does nothing
            case this.STImgHeightActions.PopupUrl: STAction.PopupUrl(); break; // currently does nothing
            default: break;
        }
    }
    catch (err) { }
}
function STSetVisibility(id, isVisible)
{
    var objToSet = document.getElementById(id);
    if (navigator.appName.indexOf("Microsoft")!=-1)
    {
        objToSet.style.visibility = isVisible == true ? "visible" : "hidden";
    }
    else
    {
        objToSet.style.display = isVisible == true ? "" : "none";
    }
}
function STGetVisibilityFalse()
{
    if (navigator.appName.indexOf("Microsoft")!=-1)
    {
        return "visibility: hidden;";
    }
    else
    {
        return "display: none;";
    }
}
function STHrefNull()
{
}
this.STButton = function()
{
    this.Text = "";
    this.OnClick = "";
}
this.STTextBox = function()
{
    this.ID = "";
    this.LabelText = "";
}
function SmarterTrackMessage()
{
    // attributes
    this.InteractID = "";
    this.HorizontalAlign = "";
    this.HorizontalOffset = "";
    this.VerticalOffset = "";
    this.VerticalAlign = "";
    this.IsAbsolutePosition = "false";
    this.IsSecureConnection = false;
    this.Message = "";
    this.ThemeName = "";
    this.FromName = "";
    this.ShowFromName = "false";
    this.AvatarIconURL = "";
    this.ShowFields = false;
    this.ShowAvatar = true;
    this.Title = "";
    this.AcceptButton = new STButton();
    this.RejectButton = new STButton();
    this.NameTextBox = new STTextBox();
    this.EmailTextBox = new STTextBox();
    
    this.Draw = function()
    {
        var portalUrlCook = STget_cookie("PortalUrl");
        var interactArea = document.getElementById(this.InteractId);
        if (interactArea == null)
        {
            return false;
        }
        var conWidth = 314;
        var conHeight = 196;
        
        var winWidth = 0;
        var winOuterWidth = 0;
        var winHeight = 0;
        var winOuterHeight = 0;
        if (parseInt(navigator.appVersion)>3) 
        {
            if (navigator.appName=="Netscape") 
            {
                if (document.body.offsetHeight && document.body.offsetWidth)
                {
                    winWidth = document.body.offsetWidth;
                    winHeight = document.body.offsetHeight;
                }
                else
                {
                    winWidth = window.innerWidth;
                    winHeight = window.innerHeight;
                }
            }
            if (navigator.appName.indexOf("Microsoft")!=-1)
            {
                winWidth = document.body.offsetWidth;
                winHeight = document.body.offsetHeight;
            }
        }
        
        if (window.innerWidth)
        {
            winOuterWidth = window.innerWidth;
            winOuterHeight = window.innerHeight;
        }
        else if (document.documentElement && 
            document.documentElement.clientWidth &&
            document.documentElement.clientWidth != 0)
        {
            winOuterWidth = document.documentElement.clientWidth;
            winOuterHeight = document.documentElement.clientHeight;
        }
        else
        {
            winOuterWidth = document.getElementsByTagName("body")[0].clientWidth;
            winOuterHeight = document.getElementsByTagName("body")[0].clientHeight;
        }

        var adjLeft = 0;
        var adjTop = 0;
        if (parseFloat(this.HorizontalOffset) > screen.width)
            this.HorizontalOffset = "0";
        if (parseFloat(this.VerticalOffset) > screen.height)
            this.VerticalOffset = "0";
        
        var bufferSpacer = 0;
        switch (this.HorizontalAlign)
        {
            case "left": adjLeft = 0 + parseFloat(this.HorizontalOffset); break;
            case "center": adjLeft = Math.round((winWidth - conWidth) / 2)
             + parseFloat(this.HorizontalOffset); break;
            case "right": 
                if (navigator.appName == "Netscape")
                    bufferSpacer = 20;
                else
                    bufferSpacer = 0;
                
                adjLeft = Math.round(winWidth - conWidth - bufferSpacer) - parseFloat(this.HorizontalOffset);
                break;
        }
        
        var posAbs = this.IsAbsolutePosition == "True" || this.IsAbsolutePosition == "true" ? true : false;
        var scrollTopPx = 0;

        if (document.body.scrollTop)
            scrollTopPx = document.body.scrollTop;
        else if (document.documentElement.scrollTop)
            scrollTopPx = document.documentElement.scrollTop;
        else if (window.pageYOffset)
            scrollTopPx = window.pageYOffset;
         
        switch (this.VerticalAlign)
        {
            case "top": 
                if (posAbs)
                {
                    adjTop = 0 + parseFloat(this.VerticalOffset);
                }
                else
                {
                    adjTop = scrollTopPx + parseFloat(this.VerticalOffset);
                }
                break;
            case "center": 
                if (posAbs)
                {
                    adjTop = Math.round((winHeight - conHeight) / 2) + parseFloat(this.VerticalOffset);
                }
                else
                {
                    adjTop = Math.round((winOuterHeight - conHeight) / 2) + scrollTopPx + parseFloat(this.VerticalOffset);
                }
                break;
            case "bottom":
                if (posAbs)
                {
                    adjTop = Math.round(winHeight - conHeight) - parseFloat(this.VerticalOffset);
                }
                else
                {
                    if (navigator.appName == "Netscape")
                        bufferSpacer = 0;
                    else
                        bufferSpacer = 63;
                        
                    adjTop = ((Math.round(winOuterHeight - conHeight) - bufferSpacer) + scrollTopPx) - parseFloat(this.VerticalOffset);
                }
                break;
        }
        
        interactArea.style.left = adjLeft+"px";
        interactArea.style.top = adjTop+"px";
        
        STSetVisibility(this.InteractId, true);
            
        var randomIdentifier = "ST_"+Math.round(Math.random()*2147483647);
        if (this.NameTextBox.ID == "")
            this.NameTextBox.ID = randomIdentifier+"_txtName";
        if (this.EmailTextBox.ID == "")
            this.EmailTextBox.ID = randomIdentifier+"_txtEmail";
        
        var leftTileID = randomIdentifier+"_leftChatTile";
        var centerTileID = randomIdentifier+"_centerChatTile";
        var rightTileID = randomIdentifier+"_rightChatTile";
        
        var leftRejectTileID = randomIdentifier+"_leftRejectTile";
        var centerRejectTileID = randomIdentifier+"_centerRejectTile";
        var rightRejectTileID = randomIdentifier+"_rightRejectTile";

        // styles
        var invitationDir = portalUrlCook+"App_Themes/"+this.ThemeName+"/Images/Invitations/";
        var windowDir = portalUrlCook+"App_Themes/"+this.ThemeName+"/Controls/Window/";
        
        var wmUrl = invitationDir + "Watermark.gif";
        var blueTextColor = "#335771";
        var blueColor = "#436985";
        var greenColor = "#3F621B";
        
        var conStyle = "width: "+conWidth+"px;height: "+conHeight+"px;padding: 0px;margin: 0px;";        
        var windowTopTile = "width: 304px;height:25px;cursor: move;border-left: solid 1px "+blueColor+";border-top: solid 1px "+blueColor+";border-right: solid 1px "+blueColor+";background-image: url("+windowDir+"CssImg/PopIn_UpperTile.png);background-repeat: repeat-x;";
        var windowTopTitleText = "width: 276px;padding-left: 5px;font: 9pt Arial,Verdana;font-weight: bold;color: #ffffff;vertical-align: middle;text-align: left;";
        var windowBodyText = "font: 8pt Arial,Verdana;color: #444444;text-align: left;";
        var windowTopClose = "padding: 0px;width: 26px;text-align: right;vertical-align: top;";
        var windowWM = "text-align: left;background-color: #ffffff;width: 184px;height: 150px;border-right: solid 1px "+blueColor+";border-bottom: solid 1px "+blueColor+";background-image: url("+wmUrl+");background-repeat:no-repeat;background-position: bottom right;";
        var windowWMNoAvatar = "padding: 16px 0px 0px 22px;text-align: left;background-color: #ffffff;width: 299px;height: 150px;border-left: solid 1px "+blueColor+";border-right: solid 1px "+blueColor+";border-bottom: solid 1px "+blueColor+";background-image: url("+wmUrl+");background-repeat:no-repeat;background-position: bottom right;";
        var windowMessageArea = "text-align: left;vertical-align: top;padding-left: 3px;padding-top: 8px;padding-right: 3px;";
        var windowEntryArea = "text-align: left;vertical-align: bottom;padding-left: 3px;padding-bottom: 13px; padding-right: 3px;";
        var windowTextBox = "width: 145px";
        var windowAgent = "background-color: #ffffff;border-left: solid 1px "+blueColor+";border-bottom: solid 1px "+blueColor+";width: 120px;height: 150px;";
        var windowNoAgent = "background-color: #ffffff;border-left: solid 1px "+blueColor+";border-bottom: solid 1px "+blueColor+";width: 2px;height: 150px;";
        var windowAgentFromText = "text-align: center;font: 8pt Arial,Verdana;color: #444444;padding-bottom: 3px;";
        var centerContext = "text-align: center;vertical-align: middle;";
        var windowAgentSpan = "background-color: #ffffff;padding-left: 10px;";
        
        var windowFarRight = "width: 6px;height: 25px;";
        var windowdFarRightMiddle = "width 6px; height: 150px;";
        var btmButtonAreaLeft = "width: 124px;height: 32px;";
        var btmButtonAreaTile = "width: 180px;height: 32px;border-left: solid 1px "+blueColor+";background-image: url("+invitationDir+"Button/Button_Tile.gif);background-repeat: repeat-x;background-position: top right;";
        var btmButtonAreaRight = windowFarRight+"height: 88px;background-image: url("+invitationDir+"Button/Button_RightCap.gif);background-repeat: no-repeat;background-position: bottom left;";
        
        var btmButtonArea = "width: 132px;height: 100%;text-align: right;vertical-align: middle;";
        var btmButtonArrow = "width: 48px;height: 100%;text-align: center;vertical-align: middle;";
        
        var buttonLeftTile = "width: 2px;height: 21px;background-image: url("+invitationDir+"Button/StartBtn_LeftCap.gif);background-repeat: no-repeat;";
        var buttonRightTile = "width: 2px;height: 21px;background-image: url("+invitationDir+"Button/StartBtn_RightCap.gif);background-repeat: no-repeat;";
        var buttonCenterTile = "width: 60px;height: 21px;text-align: center;background-image: url("+invitationDir+"Button/StartBtn_Tile.gif);background-repeat: repeat-x;";
        var buttonBlueText = centerContext+"color: "+blueTextColor+";font: 9pt Arial;";
        var buttonSpacer = "width: 3px;";
        
        var cursorStyle = "cursor: pointer;";
        var anchorStyle = "text-decoration: none;border: none;";
        var tableMax = "height: 100%;";
        
        if (this.FromName == "")
            this.FromName = "Agent";
        
        var fromText = "";
        if (this.ShowFromName == "true")
        {
            fromText = "<div style='"+windowAgentFromText+"'>"+this.FromName+"</div>";
        }
        var avatarSrc = "";
        if (this.AvatarIconURL == "AgentIcon.gif") 
        {
            
            avatarSrc = invitationDir+this.AvatarIconURL;
        }
        else
        {
            avatarSrc = this.AvatarIconURL;
        }
        
        var s = "";
        
        // build invitation HTML with the styles above
        s += "<table style='"+conStyle+"' cellpadding='0' cellspacing='0'>";
        
        var MovableBarAreaID = "SmarterBar"+Math.round(Math.random()*2147483647);
        // top row (where header and close are)
        s += "<tr><td colspan='2' style='"+windowTopTile+"'>";
        s += "<table cellpadding='0' cellspacing='0'><tr>";
        s += "<td id='"+MovableBarAreaID+"' onmousedown=\"STOnMouseInviteDown(e);\" onmouseup=\"STOnMouseInviteUp(e);\" style='"+windowTopTitleText+"'>"+this.Title+"</td>";
        s += "<td style='"+windowTopClose+"'>";
        s += "<img style='"+cursorStyle+"' src='"+windowDir+"Img/close.gif' onClick=\""+this.RejectButton.OnClick+"STCloseMessage('"+this.InteractId+"');\" /></td>";
        s += "</tr></table></td><td style='"+windowFarRight+"'></td></tr>";
        
        // middle row (where body of invitation is)
        s += "<tr style='height: 150px;'>";
        
        if (this.ShowAvatar)
        {
            s += "<td style='"+windowAgent+"'>";
            s += "<span style='"+windowAgentSpan+"'>";
            s += "<img src='"+avatarSrc+"' />"+fromText+"</span></td>";
        }

        var msgColSpan = (this.ShowAvatar ? "" : " colspan='2'");
        s += "<td"+msgColSpan+" style='"+(this.ShowAvatar ? windowWM : windowWMNoAvatar)+"'><table style='"+tableMax+"text-align:left;' cellpadding='0' cellspacing='0'><tr>";
        s += "<td style='"+windowMessageArea+"'><div style='"+windowBodyText+"'>"+this.STTrackingMessageDecoder(this.Message)+"</div></td></tr>";
        
        if (this.ShowFields)
        {
            s += "<tr><td style='"+windowEntryArea+"'><div style='"+windowBodyText+"'>"+this.NameTextBox.LabelText+"</div>";
            s += "<div><input type='text' id='"+this.NameTextBox.ID+"' width='120' style='"+windowTextBox+"' /></div>";
            s += "<div style='"+windowBodyText+"'>"+this.EmailTextBox.LabelText+"</div>";
            s += "<div><input type='text' id='"+this.EmailTextBox.ID+"' width='120' style='"+windowTextBox+"' /></div>";
            s += "</td></tr>";
        }
        s += "</table></td>";
        
        s += "<td rowspan='2' style='"+btmButtonAreaRight+"'></td></tr>";
        
        // bottom row (where chat invite button is)
        s += "<tr><td colspan='2'><table style='width: 100%;' cellpadding='0' cellspacing='0'><tr>";
        s += "<td style='"+btmButtonAreaLeft+"'></td>";
        s += "<td style='"+btmButtonAreaTile+"'>";
        s += "<table style='"+tableMax+"' cellpadding='0' cellspacing='0'><tr>";
        s += "<td style='"+btmButtonArrow+"'><img src='"+invitationDir+"Button/Arrow.gif' /></td>";
        s += "<td style='"+btmButtonArea+"'><table cellpadding='0' cellspacing='0'<tr><td>";
        
        // Accept button
        s += "<a style='"+anchorStyle+cursorStyle+"' onmouseover=\"STOnButton1Over('"+randomIdentifier+"', '"+invitationDir+"');\" ";
        s += "onmouseout=\"STOnButton1Out('"+randomIdentifier+"', '"+invitationDir+"');\" href='javascript:STHrefNull();' ";
        s += "onClick=\""+this.AcceptButton.OnClick+"STCloseMessage('"+this.InteractId+"');\"><table cellpadding='0' cellspacing='0'><tr>";
        s += "<td id='"+leftTileID+"' style='"+buttonLeftTile+"'></td>";
        s += "<td id='"+centerTileID+"' style='"+buttonCenterTile+"'><span style='"+buttonBlueText+"'>"+this.AcceptButton.Text+"</span></td>";
        s += "<td id='"+rightTileID+"' style='"+buttonRightTile+"'></td></tr></table></a></td>";
        
        // Spacer
        s += "<td style='"+buttonSpacer+"'></td><td>";
        
        // Reject button
        s += "<a style='"+anchorStyle+cursorStyle+"' onmouseover=\"STOnButton2Over('"+randomIdentifier+"', '"+invitationDir+"');\" ";
        s += "onmouseout=\"STOnButton2Out('"+randomIdentifier+"', '"+invitationDir+"');\" href='javascript:STHrefNull();' ";
        s += "onClick=\""+this.RejectButton.OnClick+"STCloseMessage('"+this.InteractId+"');\">";
        s += "<table cellpadding='0' cellspacing='0'><tr>";
        s += "<td id='"+leftRejectTileID+"' style='"+buttonLeftTile+"'></td>";
        s += "<td id='"+centerRejectTileID+"' style='"+buttonCenterTile+"'><span style='"+buttonBlueText+"'>"+this.RejectButton.Text+"</span></td>";
        s += "<td id='"+rightRejectTileID+"' style='"+buttonRightTile+"'></td></tr></table></a></td></tr></table></td>";
        s += "</tr></table></td>";
        
        // ends table container
        s += "</tr></table></td></tr></table>";
        interactArea.innerHTML = s;
        
        var MovableBar = document.getElementById(MovableBarAreaID);
        if (MovableBar)
        {
            MovableBar.onmousedown = this.STOnMouseInviteDown;
            MovableBar.onmouseup = this.STOnMouseInviteUp;
            STMovableInvite = interactArea;
        }
    }
    this.STTrackingMessageDecoder = function(message)
    {    
//        var retVal = message.replace("+", " ");
//        while (retVal.indexOf("+") > -1)
//            retVal = retVal.replace("+", " ");
//            
//        retVal = unescape(retVal);
//        
//        while (retVal.indexOf("%@SQUOTE@%") > -1)
//            retVal = retVal.replace("%@SQUOTE@%", "\'");
//            
//        while (retVal.indexOf("%@DQUOTE@%") > -1)    
//            retVal = retVal.replace("%@DQUOTE@%", "\"");
//            
//        return retVal;
        return message;
    }
    this.STOnMouseInviteDown = function(e)
    {
        try
        {
            if (STMovableInvite)
            {
                STIsInviteMoving = true;
            }
            if (navigator.appName == "Netscape")
            {
                STWindowPosX = e.layerX;
                STWindowPosY = e.layerY;
            }
            else
            {
                STWindowPosX = event.offsetX;
                STWindowPosY = event.offsetY;
            }  
        }  
        catch (err) { }
    }
    this.STOnMouseInviteUp = function(e)
    {
        STIsInviteMoving = false;
    }
}
function STEscapeTitle()
{
    var retVal = document.title;
    
    var numQuotes = 0;
    for (var i = 0; i < retVal.length; i++)
    {
        if (retVal[i] == "'")
            numQuotes += 1;
    }
    for (var i = 0; i <= numQuotes; i++)
        retVal = retVal.replace("'", "%SQUOTE%");
   
    return retVal;
}
function STInjectScript(inputQS, outputID)
{
    var portalUrlCook = STget_cookie("PortalUrl");
    if (portalUrlCook != "")
    {
       var rid = Math.round(Math.random()*2147483647);
       var head = document.getElementsByTagName("head")[0];
       var script = document.createElement("script");
       script.type = "text/javascript";
       
       var interactAreaId = "";
       if (outputID != "")
       {
           interactAreaId = "&interactId="+outputID;
       }
       
       script.src = portalUrlCook + "ST.ashx?PostID="+rid+inputQS+"&visitorId="+STGetVisitorCookie()+interactAreaId;
       head.appendChild(script);
   }
}
function STOnButton1Over(idPrefix, imageDir)
{
    var leftTileID = idPrefix+"_leftChatTile";
    var centerTileID = idPrefix+"_centerChatTile";
    var rightTileID = idPrefix+"_rightChatTile";
    
    document.getElementById(leftTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_LeftCap_Over.gif)";
    document.getElementById(centerTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_Tile_Over.gif)";
    document.getElementById(rightTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_RightCap_Over.gif)";
}
function STOnButton1Out(idPrefix, imageDir)
{
    var leftTileID = idPrefix+"_leftChatTile";
    var centerTileID = idPrefix+"_centerChatTile";
    var rightTileID = idPrefix+"_rightChatTile";
    
    document.getElementById(leftTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_LeftCap.gif)";
    document.getElementById(centerTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_Tile.gif)";
    document.getElementById(rightTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_RightCap.gif)";
}
function STOnButton2Over(idPrefix, imageDir)
{
    var leftTileID = idPrefix+"_leftRejectTile";
    var centerTileID = idPrefix+"_centerRejectTile";
    var rightTileID = idPrefix+"_rightRejectTile";
    
    document.getElementById(leftTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_LeftCap_Over.gif)";
    document.getElementById(centerTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_Tile_Over.gif)";
    document.getElementById(rightTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_RightCap_Over.gif)";
}
function STOnButton2Out(idPrefix, imageDir)
{
    var leftTileID = idPrefix+"_leftRejectTile";
    var centerTileID = idPrefix+"_centerRejectTile";
    var rightTileID = idPrefix+"_rightRejectTile";
    
    document.getElementById(leftTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_LeftCap.gif)";
    document.getElementById(centerTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_Tile.gif)";
    document.getElementById(rightTileID).style.backgroundImage = "url("+imageDir+"Button/StartBtn_RightCap.gif)";
}

var STOnMouseInviteDown = function(e)
{
    try
    {
        if (STMovableInvite)
        {
            STIsInviteMoving = true;
        }
        if (navigator.appName == "Netscape")
        {
            STWindowPosX = e.layerX;
            STWindowPosY = e.layerY;
        }
        else
        {
            STWindowPosX = event.offsetX;
            STWindowPosY = event.offsetY;
        }  
    }  
    catch (err) { }
}
var OnMouseInviteUp = function(e)
{
    STIsInviteMoving = false;
}
document.STOnMouseUpInviteListener = function(evt)
{
    STIsInviteMoving = false;
}
document.STOnMouseMoveInviteListener = function(evt)
{
    try
    {
        var winWidth = 0;
        var winHeight = 0;
        if (parseInt(navigator.appVersion)>3) 
        {
            if (navigator.appName=="Netscape") 
            {
                if (document.body.offsetHeight && document.body.offsetWidth)
                {
                    winWidth = document.body.offsetWidth;
                    winHeight = document.body.offsetHeight;
                }
                else
                {
                    winWidth = window.innerWidth;
                    winHeight = window.innerHeight;
                }
            }
            if (navigator.appName.indexOf("Microsoft")!=-1)
            {
                winWidth = document.body.offsetWidth;
                winHeight = document.body.offsetHeight;
            }
        }
        
        
        if (STIsInviteMoving && STMovableInvite != null)
        {
            if (navigator.appName == "Netscape")
            {
                if (evt.pageX < winWidth)
                    STMovableInvite.style.left = (evt.pageX - STWindowPosX) + 'px';
                if (evt.pageY < winHeight)
                    STMovableInvite.style.top = (evt.pageY - STWindowPosY) + 'px';
            }
            else
            {
                if (event.clientX < winWidth)
                    STMovableInvite.style.left = event.clientX-STWindowPosX + document.body.scrollLeft + 'px';
                if (event.clientY < winHeight)
                    STMovableInvite.style.top = event.clientY-STWindowPosY + document.body.scrollTop + 'px';
            }
            return false;
        }
    }
    catch (err) { }
}
STAddHandler(document, "mousemove", "STOnMouseMoveInviteListener");
STAddHandler(document, "mouseup", "STOnMouseUpInviteListener");
function STAddHandler(target,eventName,handlerName) 
{
	if (target.addEventListener)
	{
		target[eventName + handlerName] = function(e){return target[handlerName](e)};
		target.addEventListener(eventName, target[eventName + handlerName], false);
	}
	else if (target.attachEvent)
	{
		target[eventName + handlerName] = function(e){return target[handlerName](e)};
		target.attachEvent("on" + eventName, target[eventName + handlerName]);
	}
	else 
	{ 
		var originalHandler = target["on" + eventName]; 
		if (originalHandler)
		{
			target[eventName + handlerName] = function(e){originalHandler(e); return target[handlerName](e);};
			target["on" + eventName] = target[eventName + handlerName]; 
		}
		else 
		{
			target["on" + eventName] = target[handlerName]; 
		}
    } 
}
function STAcceptForcedChat(responseUrl)
{
    window.open(responseUrl, "LiveChat", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=480");
}
function STAcceptChatInvite(responseUrl, interactId, txtNameID, txtEmailID)
{
    var cName = document.getElementById(txtNameID).value;
    if (cName != "")
        cName = "&cName="+cName;
        
    var cEmail = document.getElementById(txtEmailID).value;
    if (cEmail != "")
        cEmail = "&cEmail="+cEmail;
    
    var respUrl = responseUrl+cName+cEmail;
    window.open(respUrl, "LiveChat", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=480");
    
    //STCloseMessage(interactId);
    STInjectScript('&inputparameter=ChatInviteState%3DAccepted"', "");
}