
/*---------Begin of InstantTracking.js---------*/
// Copyright (C) 2007 InstantService, Inc. All rights reserved. 
// All content is protected under U.S. copyright laws. Any unauthorized duplication, modification, 
// or reverse-engineering of this code without express written permission of InstantService, Inc. 
// is a violation of copyright law and is subject to penalty and prosecution.  
// This comment and the 4 lines above may not be removed from this file.
function ISVT_onInviteNotOffered(isvt_rid,isvt_iid){
var nv='?ai='+ISVT_ai+'&evt=20&ri='+isvt_rid+'&ii='+isvt_iid;
ISVT_callTS(ISVT_scr,nv);
	try
	{
		if(window.tfs_Tracker)
		{
			tfs_Tracker.sendViaImg(nv);
		}
	}
	catch(Bish)
	{
	}
}
function ISVT_onInviteOffered(isvt_rid,isvt_iid){
var nv='?ai='+ISVT_ai+'&evt=21&ri='+isvt_rid+'&ii='+isvt_iid;
ISVT_callTS(ISVT_scr,nv);
	try
	{
		if(window.tfs_Tracker)
		{
			tfs_Tracker.sendViaImg(nv);
		}
	}
	catch(Bish)
	{
	}
}
function ISVT_onInviteAccepted(isvt_iid,isvt_di){
var nv='?ai='+ISVT_ai+'&evt=22&ii='+isvt_iid+'&di='+isvt_di;
ISVT_callTS(ISVT_scr,nv);
	try
	{
		if(window.tfs_Tracker)
		{
			tfs_Tracker.sendViaImg(nv);
		}
	}
	catch(Bish)
	{
	}
}
function ISVT_onInviteDeclined(isvt_iid,isvt_di){
var nv='?ai='+ISVT_ai+'&evt=23&ii='+isvt_iid+'&di='+isvt_di;
ISVT_callTS(ISVT_scr,nv);
	try
	{
		if(window.tfs_Tracker)
		{
			tfs_Tracker.sendViaImg(nv);
		}
	}
	catch(Bish)
	{
	}
}
function ISVT_onQueueUnavailable(isvt_di){
var nv='?ai='+ISVT_ai+'&evt=30&di='+isvt_di;
ISVT_callTS(ISVT_scr,nv);
	try
	{
		if(window.tfs_Tracker)
		{
			tfs_Tracker.sendViaImg(nv);
		}
	}
	catch(Bish)
	{
	}
}
function ISVT_onEnteredQueue(isvt_cui,isvt_di){
var nv='?ai='+ISVT_ai+'&evt=31&cui='+isvt_cui+'&di='+isvt_di;
ISVT_callTS(ISVT_scr,nv);
	try
	{
		if(window.tfs_Tracker)
		{
			tfs_Tracker.sendViaImg(nv);
		}
	}
	catch(Bish)
	{
	}
}
function ISVT_onChatWithAgent(isvt_cui,isvt_ci,isvt_di,isvt_sq){
var nv='?ai='+ISVT_ai+'&evt='+((isvt_sq==0)?'32':'33')+'&cui='+isvt_cui+'&ci='+isvt_ci+'&di='+isvt_di;
ISVT_callTS(ISVT_scr,nv);
	try
	{
		if(window.tfs_Tracker)
		{
			tfs_Tracker.sendViaImg(nv);
		}
	}
	catch(Bish)
	{
	}
}
function ISVT_onMailMessagePosted(isvt_di){
if(ISVT_mmp==1)return;
var nv='?ai='+ISVT_ai+'&evt=40&di='+isvt_di;
ISVT_callTS(ISVT_scr,nv);ISVT_mmp=1;}
function ISVT_onConversion(isvt_cvi,isvt_cv,isvt_type,isvt_cd1){
var argv = ISVT_onConversion.arguments;  
var argc = ISVT_onConversion.arguments.length;  
var isvt_cd2 = (argc > 4) ? argv[4] : null;  
var isvt_cd3 = (argc > 5) ? argv[5] : null;  
var isvt_cd4 = (argc > 6) ? argv[6] : null;  
var isvt_cd5 = (argc > 7) ? argv[7] : null;  
var evt=((isvt_type == 0) ? 50 : 51);
var nv='?ai='+ISVT_ai+'&evt='+evt+'&cvi='+isvt_cvi+'&cv='+isvt_cv;
if (isvt_cd1.length > 0) nv+='&cd1='+ISVT_encode(isvt_cd1);
if (isvt_cd2 != null && isvt_cd2.length > 0) nv+='&cd2='+ISVT_encode(isvt_cd2);
if (isvt_cd3 != null && isvt_cd3.length > 0) nv+='&cd3='+ISVT_encode(isvt_cd3);
if (isvt_cd4 != null && isvt_cd4.length > 0) nv+='&cd4='+ISVT_encode(isvt_cd4);
if (isvt_cd5 != null && isvt_cd5.length > 0) nv+='&cd5='+ISVT_encode(isvt_cd5);
ISVT_callTS(ISVT_scr,nv);
	try
	{
		if(window.tfs_Tracker)
		{
			tfs_Tracker.sendViaImg(nv);
		}
	}
	catch(Bish)
	{
	}
}
  
function ISVT_callTS(isvt_scr, isvt_nv){
var vtid = ISVT_getVTID();
if (vtid != null && vtid != "") isvt_nv += '&vti=' + vtid;
if (isvt_scr.length > 0 && document.getElementById) {
  var head = document.getElementsByTagName('head').item(0);
  var old  = document.getElementById('vtscript');
  if (old) head.removeChild(old);
  vtscr = document.createElement('script');
  vtscr.src = isvt_scr + isvt_nv;
  vtscr.type = 'text/javascript';
  vtscr.defer = true;
  vtscr.id = 'vtscript';
  void(head.appendChild(vtscr));
}}

function ISVT_getVTID(){  
if (typeof window.ISVT_tid != 'undefined') return ISVT_tid;
var arg = "isvt_visitor=";  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
  var j = i + arg.length;    
  if (document.cookie.substring(i, j) == arg) {   
    var endstr = document.cookie.indexOf (";", j);  
    if (endstr == -1) endstr = document.cookie.length;  
    return unescape(document.cookie.substring(j, endstr));
  }
  i = document.cookie.indexOf(" ", i)+1;    
  if (i == 0) break;   
}return null;}

function ISVT_encode(s){
if (ISVT_hex == null){
  ISVT_hex = new Array(256);
  for (var i=0;i<256;i++){
    if (i < 16) ISVT_hex[i] = "%0" + i.toString(16);
    else ISVT_hex[i] = "%" + i.toString(16);
  }
}
if (s == null) return;
var sbuf = "";
for (i = 0; i < s.length; i++){
  var ch = s.charAt(i);
  var chCode = s.charCodeAt(i);
  if ("A"<=ch && ch<="Z") sbuf = sbuf.concat(ch);
  else if ("a"<=ch && ch<="z") sbuf = sbuf.concat(ch);
  else if ("0"<=ch && ch<="9") sbuf = sbuf.concat(ch);
  else if (ch==" ") sbuf = sbuf.concat("+");
  else if (ch=="-" || ch=="_" || ch=="." || ch=="!" || ch=="~" || ch=="*" || ch=="(" || ch==")") sbuf = sbuf.concat(ch);
  else if (chCode <= parseInt("007f",16)) sbuf = sbuf.concat(ISVT_hex[chCode]);
  else if (chCode <= parseInt("07ff")){              
    var idxCode0 = parseInt("c0",16) | (chCode >> 6);
    var idxCode1 = parseInt("80",16) | (chCode & parseInt("3f",16));
    sbuf = sbuf.concat(ISVT_hex[idxCode0]);
    sbuf = sbuf.concat(ISVT_hex[idxCode1]);
  } 
  else{              
    var idxCode0 = parseInt("e0",16) | (chCode >> 12);
    var idxCode1 = parseInt("80",16) | ((chCode >> 6) & parseInt("3f",16));
    var idxCode2 = parseInt("80",16) | (chCode & parseInt("3f",16));
    sbuf = sbuf.concat(ISVT_hex[idxCode0]);
    sbuf = sbuf.concat(ISVT_hex[idxCode1]);
    sbuf = sbuf.concat(ISVT_hex[idxCode2]);
  }
}return sbuf;}

function ISVT_setCookie(isvt_name, isvt_value){
if (typeof window.ISVT_tid != 'undefined') return;
var expires = new Date();
if (30 == 0) expires = null;
else expires.setTime(expires.getTime() + (30*24*60*60*1000));
var domain=ISVT_getDomain();
document.cookie=isvt_name+"="+escape(isvt_value)+
((expires==null)?"":(";expires="+expires.toGMTString()))+
";path=/"+((domain == null||domain=="")?"":(";domain="+ domain));}

function ISVT_getDomain(){ 
var dom = document.domain;
var arr = dom.split('.');
if (arr.length == 3) dom = arr[1] + '.' + arr[2];
else if (arr.length > 3) dom = arr[arr.length-3] + '.' + arr[arr.length-2] + '.' + arr[arr.length-1];
return(dom);}

var ISVT_hex=null;
var ISVT_mmp=0;
var ISVT_prtcl=document.location.protocol.indexOf("https")!=-1?"https://":"http://";
var ISVT_scr=ISVT_prtcl+'ts.istrack.com/trackingAPI.js';
var ISVT_ai='B16iRZqXr+efh8pVE8IB2IEX4Qp4OT1z';
if(document.all && !document.getElementById) document.getElementById = function(id) { return document.all[id]; }
if (ISVT_getVTID() == null) ISVT_callTS(ISVT_scr, '?ai='+ISVT_ai);

/*---------End of InstantTracking.js---------*/

/*---------Begin of InstantInvite3.js---------*/
function ii_callServer(id,scr)
{
  var win = (ii_callServer.arguments.length==3)?ii_callServer.arguments[2]:window;
  var head = win.document.getElementsByTagName('head').item(0);
  var old  = win.document.getElementById(id);
  if (old) head.removeChild(old);
  var script = document.createElement('script');
  script.src = scr;
  script.type = 'text/javascript';
  script.defer = true;
  script.id = id;
  void(head.appendChild(script));
}

function ii_getProtocol()
{
  return((document.location.href.toLowerCase().indexOf("https")==0)?"https":"http");
}

//geo data
function ii_getCookie(name)
{
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen)
  {
    var j = i + alen;
    if (document.cookie.substring(i, j)==arg)
    {
      var endstr = document.cookie.indexOf (";", j);
      if (endstr == -1) endstr = document.cookie.length;
      return unescape(document.cookie.substring(j, endstr));
    }
    i = document.cookie.indexOf(" ",i) + 1;
    if (i==0) break;
  }
  return(null);
}
function ii_setCookie(name, value)
{
  var argv = ii_setCookie.arguments;
  var argc = ii_setCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  document.cookie = name + "=" + escape(value)+
   ((expires == null) ? "" : ("; expires="+expires.toGMTString()))+
   "; path=/"+((ii_Var.domain==null||ii_Var.domain=="") ? "" : ("; domain="+ii_Var.domain));
}
function ii_upGSV(name,value)
{
  var up = false;
  var sv = '';
  var arrSV = ii_getCookie(ii_Var.GSV_COOKIE);
  arrSV=(arrSV==null)?[]:arrSV.split('_');
  if (typeof(value) == 'string')
  {
    value = value.replace(/\-/g,"%2D");
    value = value.replace(/\_/g,"%5F");
  }
  for (var i=0;i<arrSV.length;i++)
  {
    if ((arrSV[i].split('-'))[0]==name)
    {
      arrSV[i]=name+'-'+value; 
      up=true; 
      break;
    }
  }
  if (!up) arrSV[arrSV.length] = name+'-'+value;
  for (i=0;i<arrSV.length;i++)
  {
    sv += arrSV[i];
    if (i < arrSV.length - 1) 
      sv += '_';
  }
  ii_setCookie(ii_Var.GSV_COOKIE, sv, null);
}
function ii_getGSV(name)
{
  var arrSV = ii_getCookie(ii_Var.GSV_COOKIE);
  arrSV=(arrSV==null)?[]:arrSV.split('_');
  for (var i=0;i<arrSV.length;i++)
  {
    if ((arrSV[i].split('-'))[0]==name)
    {
      var s = (arrSV[i].split('-'))[1];
      s = s.replace(/\%2D/g,"-");
      s = s.replace(/\%5F/g,"_");
      return(s);
    }
  }
  return('');
}

function ii_resetGSVCookie()
{
  ii_upGSV('DPL',0);
  ii_upGSV('TES',parseInt(new Date().getTime()/1000));
  ii_upGSV('PCT',parseInt(new Date().getTime()/1000));
  ii_upGSV('GeoIP','*');
  ii_upGSV('GeoCo','');
  ii_upGSV('GeoRg','');
  ii_upGSV('GeoCt','');
  ii_upGSV('GeoNs','');
  ii_upGSV('GeoDm','');

  //tfs start
  ii_upGSV('GeoCc','');
  ii_upGSV('GeoCn','');
  ii_upGSV('GeoDa','');
  ii_upGSV('GeoAc','');
  ii_upGSV('GeoLa','');
  ii_upGSV('GeoLo','');
  ii_upGSV('GeoIs','');
  ii_upGSV('GeoOr','');
  //tfs end

}

//  GeoLocation
function ii_initGeoIP()
{
  var iivar = ii_Var;
  if (ii_getGSV("GeoIP")!="*" && iivar.gsvr.length > 0)
     iivar.geoinit = 1;

  if (window.isgeoipapi_ip_addr!=undefined && iivar.geoinit==0)
  {
    iivar.geoinit = 1;

    iivar.geoip = window.isgeoipapi_ip_addr;
    iivar.geoco = (window.isgeoipapi_country_code!=undefined)?window.isgeoipapi_country_code:'';
    iivar.georg = (window.isgeoipapi_region!=undefined)?window.isgeoipapi_region:'';
    iivar.geoct = (window.isgeoipapi_city!=undefined)?window.isgeoipapi_city:'';
    iivar.geons = (window.isgeoipapi_netspeed!=undefined)?window.isgeoipapi_netspeed:'';
    iivar.geodm = (window.isgeoipapi_domain!=undefined)?window.isgeoipapi_domain:'';
	//tfs start
    iivar.GeoCc = (window.isgeoipapi_continent_code!=undefined)?window.isgeoipapi_continent_code:'';
    iivar.GeoCn = (window.isgeoipapi_country_name!=undefined)?window.isgeoipapi_country_name:'';
    iivar.GeoDa = (window.isgeoipapi_dma_code!=undefined)?window.isgeoipapi_dma_code:'';
    iivar.GeoAc = (window.isgeoipapi_area_code!=undefined)?window.isgeoipapi_area_code:'';
    iivar.GeoLa = (window.isgeoipapi_latitude!=undefined)?window.isgeoipapi_latitude:'';
    iivar.GeoLo = (window.isgeoipapi_longitude!=undefined)?window.isgeoipapi_longitude:'';
    iivar.GeoIs = (window.isgeoipapi_isp!=undefined)?window.isgeoipapi_isp:'';
    iivar.GeoOr = (window.isgeoipapi_organization!=undefined)?window.isgeoipapi_organization:'';
	//tfs end

    ii_upGSV('GeoIP',window.isgeoipapi_ip_addr);
    ii_upGSV('GeoCo',(window.isgeoipapi_country_code!=undefined)?window.isgeoipapi_country_code:'');
    ii_upGSV('GeoRg',(window.isgeoipapi_region!=undefined)?window.isgeoipapi_region:'');
    ii_upGSV('GeoCt',(window.isgeoipapi_city!=undefined)?window.isgeoipapi_city:'');
    ii_upGSV('GeoNs',(window.isgeoipapi_netspeed!=undefined)?window.isgeoipapi_netspeed:'');
    ii_upGSV('GeoDm',(window.isgeoipapi_domain!=undefined)?window.isgeoipapi_domain:'');

    //tfs start
    ii_upGSV('GeoCc',(window.isgeoipapi_continent_code!=undefined)?window.isgeoipapi_continent_code:'');
    ii_upGSV('GeoCn',(window.isgeoipapi_country_name!=undefined)?window.isgeoipapi_country_name:'');
    ii_upGSV('GeoDa',(window.isgeoipapi_dma_code!=undefined)?window.isgeoipapi_dma_code:'');
    ii_upGSV('GeoAc',(window.isgeoipapi_area_code!=undefined)?window.isgeoipapi_area_code:'');
    ii_upGSV('GeoLa',(window.isgeoipapi_latitude!=undefined)?window.isgeoipapi_latitude:'');
    ii_upGSV('GeoLo',(window.isgeoipapi_longitude!=undefined)?window.isgeoipapi_longitude:'');
    ii_upGSV('GeoIs',(window.isgeoipapi_isp!=undefined)?window.isgeoipapi_isp:'');
    ii_upGSV('GeoOr',(window.isgeoipapi_organization!=undefined)?window.isgeoipapi_organization:'');
	try
	{
		if(window.tfs_Tracker)
		{
			ii_upGSV('GeoTr',tfs_Tracker.track);
		}
	}
	catch(Bish)
	{
	}
    //tfs end
    // load gsv cookie settings into local variables for performance
  }
  
  if (iivar.geoip==null && iivar.geoinit==1)
  {
    // load gsv cookie settings into local variables for performance
    iivar.geoip = ii_getGSV("GeoIP");
    iivar.geoco = ii_getGSV("GeoCo");
    iivar.georg = ii_getGSV("GeoRg");
    iivar.geoct = ii_getGSV("GeoCt");
    iivar.geons = ii_getGSV("GeoNs");
    iivar.geodm = ii_getGSV("GeoDm");
	//tfs start
    iivar.GeoCc = ii_getGSV("GeoCc");
    iivar.GeoCn = ii_getGSV("GeoCn");
    iivar.GeoDa = ii_getGSV("GeoDa");
    iivar.GeoAc = ii_getGSV("GeoAc");
    iivar.GeoLa = ii_getGSV("GeoLa");
    iivar.GeoLo = ii_getGSV("GeoLo");
    iivar.GeoIs = ii_getGSV("GeoIs");
    iivar.GeoOr = ii_getGSV("GeoOr");
	try
	{
		if(window.tfs_Tracker)
		{
			if(ii_getGSV("GeoTr") == 1)
			{
				tfs_Tracker.track = 1;
			}
		}
	}
	catch(Bish)
	{
	}
	//tfs end
  }
}
//geo data

function ii_VarObj() 
{
  this.IE=!!(document.all&&document.getElementById);
  this.MZ=(!this.IE)?!!(document.getElementById):false;
  this.accountid = 6384;
  this.gsvr = 'gs.instantservice.com';
  this.rsvr = 'rs.instantservice.com';
  this.vtscrname = 'InstantTracking.js';
  this.vtscrloc = 'UnknownDomain.com/UnknownWebroot/webchat/js/InstantTracking.js';
  this.referrer = document.referrer;

  this.GSV_COOKIE = 'IS3_GSV';
  this.geoinit = 0;
  this.geoip = null;
  this.geoco = null;
  this.georg = null;
  this.geoct = null;
  this.geons = null;
  this.geodm = null;
  this.tmes  = null;

  //tfs start
  this.GeoCc = null;
  this.GeoCn = null;
  this.GeoDa = null;
  this.GeoAc = null;
  this.GeoLa = null;
  this.GeoLo = null;
  this.GeoIs = null;
  this.GeoOr = null;

  //tfs end
}

ii_Var = new ii_VarObj();
if (navigator.cookieEnabled)
{ 
	if (ii_getCookie(ii_Var.GSV_COOKIE) == null) ii_resetGSVCookie();
}
if (ii_getGSV("GeoIP")=="*" && ii_Var.gsvr.length > 0)
{
	ii_callServer('geoipAPI.js',ii_getProtocol()+'://'+ii_Var.gsvr+'/geoipAPI.js?src=ii3&ts='+(parseInt(new Date().getTime()/1000)));
}

/*---------End of InstantInvite3.js---------*/

/*---------Begin of ISSB.js---------*/
function tfs_ObjTracker()
{
	this.imgPipe=null;
	this.availOnLoad = null;
	this.availOnError = null;
	this.timestamp = 0;
	this.tracker = ISVT_prtcl + 'ilreports.247customer.com/Tracker/';
	this.img = "tracker.gif"
	this.imgDefault = ""
	this.script = "tracker.js";
	this.failCount = 0;
	this.inAgentConsole = 0;
	this.abortSendAfter = 5000;
	this.hAbortTimer = null;
	this.url = "";
	this.track = 0;
	this.ErrMsg = "";
	this.rightNow = new Date();
	this.sampleHour = 9;
	this.sampleMinute = 0;
	tfs_TrackerSelf = this;

	this.sendViaImg = function()
	{
		if (this.track != 1)
		{
			return;
		}
		this.timestamp = parseInt(new Date().getTime()/1000);
		if(this.imgPipe)
		{
			if(this.failCount == 0)
			{
				this.imgPipe.src = this.tracker + this.img + ((this.sendViaImg.arguments[0].substr(0,1) == "?")?"":"?") + this.sendViaImg.arguments[0] + '&ts=' + this.timestamp;
				this.hAbortTimer = setTimeout(tfs_TrackerSelf.abortSendViaImg, this.abortSendAfter);
			}
		}
	};

	this.sendViaScript = function()
	{
		var id = "id_tfs_ScriptPipe";
		this.timestamp = parseInt(new Date().getTime()/1000);
		var scr = this.tracker + this.script + ((this.sendViaScript.arguments[0].substr(0,1) == "?")?"":"?") + this.sendViaScript.arguments[0] + '&ts=' + this.timestamp;
		var win = window;
		var head = win.document.getElementsByTagName('head').item(0);
		var old  = win.document.getElementById(id);
		if (old) head.removeChild(old);
		var script = document.createElement('script');
		script.src = scr;
		script.type = 'text/javascript';
		script.defer = true;
		script.id = id;
		void(head.appendChild(script));
	};

	this.defAvailOnLoad = function()
	{
		if(tfs_TrackerSelf.hAbortTimer)
		{
			tfs_TrackerSelf.hAbortTimer = clearTimeout(tfs_TrackerSelf.hAbortTimer);
		}
		switch(tfs_TrackerSelf.imgPipe.width)
		{
			case 2:
				ii_upGSV('GeoTr','1');
				break;

			default:
				ii_upGSV('GeoTr','0');
		}
	};

	this.defAvailOnError = function()
	{
		tfs_TrackerSelf.failCount++;
		if(tfs_TrackerSelf.hAbortTimer)
		{
			tfs_TrackerSelf.hAbortTimer = clearTimeout(tfs_TrackerSelf.hAbortTimer);
		}
		tfs_TrackerSelf.track = 0;
		ii_upGSV('GeoTr','0');
	};

	this.abortSendViaImg = function()
	{
		tfs_TrackerSelf.track = 0;
		ii_upGSV('GeoTr','0');
		if(tfs_TrackerSelf.hAbortTimer)
		{
			tfs_TrackerSelf.hAbortTimer = clearTimeout(tfs_TrackerSelf.hAbortTimer);
		}
		if(tfs_TrackerSelf.imgDefault != "")
		{
			tfs_TrackerSelf.timestamp = parseInt(new Date().getTime()/1000);
			if(tfs_TrackerSelf.imgPipe)
			{
				tfs_TrackerSelf.imgPipe.width = 1;
				tfs_TrackerSelf.imgPipe.height = 1;
				tfs_TrackerSelf.imgPipe.src = tfs_TrackerSelf.imgDefault + '?ts=' + tfs_TrackerSelf.timestamp;
			}
		}
	};

	this.init = function()
	{
		try
		{
			this.url = window.location.href;
			if(window.location.href.indexOf('instantservice.com') > -1)
			{
				this.inAgentConsole = 1;
			}
			if (navigator.appName.indexOf("Microsoft") != -1 && navigator.platform.indexOf("Mac") != -1) 
			{
				this.imgPipe = document.createElement('IMG');
			}
			else 
			{
				this.imgPipe = new Image();
			}

			this.availOnLoad = (tfs_ObjTracker.arguments[0])?tfs_ObjTracker.arguments[0]:this.defAvailOnLoad;
			this.availOnError = (tfs_ObjTracker.arguments[1])?tfs_ObjTracker.arguments[1]:this.defAvailOnError;
			this.imgPipe.onload = this.availOnLoad;
			this.imgPipe.onerror = this.availOnError;
			if ((this.rightNow.getHours() == this.sampleHour) && (this.rightNow.getMinutes() == this.sampleMinute))
			{
				this.track = 1;
			}
			else
			{
				this.track = 0;
			}
		}
		catch(Bish)
		{
		}
	};

	this.init();
}

function ii_247VarObj()
{
	this.tjsl = "";		//Tracker JS location
	this.errMsg = "";
	//this.wcl = "ilreports.247customer.com/webchat";		//webchat location 247
	//this.wcl = "151.149.116.94:8180/webchat";		//webchat location Sears Dev
	this.wcl = "www.searspartsdirect.com/webchat";		//webchat location Sears Prdn

	this.setTrackerJSPath = function()
	{
		var proto = ii_getProtocol();
		var hn = location.host;
		var pn = document.location.pathname;
		var wr = pn.substr(0, pn.lastIndexOf("/"));		//web root
		var addwr = 0;		//add web root part

		try
		{
			if(proto.length > 3 &&  hn != "" && pn != "")
			{
				/*this.wcl = hn + ((addwr==1)?wr:"") + "/webchat"; //used when js is hosted in the same domain*/
				this.tjsl = ii_Var.vtscrloc;
				ii_Var.vtscrloc = this.wcl + "/js/" + ii_Var.vtscrname;
				this.wcl = proto + "://" + this.wcl;
			}
		}
		catch(bish)
		{
			this.errMsg = bish.message.toString();
		}
	}

	this.initObj = function()
	{
		this.setTrackerJSPath();
	};

	this.initObj();
};

function ii_247cdaObj()
{
	this.iiAvailImg=null;
	this.di = ii_247cdaObj.arguments[0];
	this.availOnLoad = ii_247cdaObj.arguments[1];
	this.availOnError = ii_247cdaObj.arguments[2];

	this.checkDeptAvailability = function()
	{
		var timestamp = parseInt(new Date().getTime()/1000);
		var img = "available.gif";
		this.iiAvailImg.src = ii_getProtocol() + '://'+ii_Var.rsvr+'/resources/smartbutton/' + ii_Var.accountid + '/' + this.di + '/' + img + '?src=ii3&ts=' + timestamp;
	};

	this.initObj = function()
	{
		if (navigator.appName.indexOf("Microsoft") != -1 && navigator.platform.indexOf("Mac") != -1) 
			this.iiAvailImg = document.createElement('IMG');
		else 
			this.iiAvailImg = new Image();

		this.iiAvailImg.onload = this.availOnLoad;
		this.iiAvailImg.onerror = this.availOnError;
		this.checkDeptAvailability();
	};

	this.initObj();

};

function ii_247SBObj()
{
	this.di = ii_247SBObj.arguments[0];
	this.odi = ii_247SBObj.arguments[1];
	this.useOdi = 0;
	this.ii_247cda = null;
	this.userClicked = 0;
	this.hChildWnd = null;
	Me = this;
	var imgClickToChat = "";
	this.trackerLoaded = 0;
	this.tmrGeoApi = null;
	this.retryGeo = 3;

	this.deptOpen = function()
	{
		Me.useOdi = 0;
		Me.showLink();
	};

	this.deptClosed = function()
	{
		Me.useOdi = 1;
		Me.showLink();
	};

	this.onClick = function()
	{
		if(this.userClicked == 1)
		{
			return false;
		}
		this.userClicked = 1;
		var index = 0;
		var sbimg;
		var hlsb;
		while(index > -1)
		{
			sbimg = document.getElementById("id_ImgClickToChat_" + index);
			hlsb = document.getElementById("id_HLSB_" + index);
			if(sbimg && hlsb)
			{
				try
				{
					sbimg.className = "tfsDisabledimg";
				}
				catch(Bish)
				{
					ii_247Var.ErrMsg = Bish.message.toString();
				}
				try
				{
					hlsb.className = "tfsDisableda";
				}
				catch(Bish)
				{
					ii_247Var.ErrMsg = Bish.message.toString();
				}
				index++;
			}
			else
			{
				break;
			}
		}
		if(index > -1)
		{
			var WndSpec = "width=570,height=395,scrollbars=0";
			this.hChildWnd = window.open('about:blank', 'chatclient', WndSpec);
			this.ii_247cda.checkDeptAvailability();
		}
	};

	this.showLink = function()
	{
		if(this.userClicked == 0)
		{
			var index = 0;
			var sb;
			while(index > -1)
			{
				sb = document.getElementById("id_SmartButton_" + index);
				if(sb)
				{
					if(this.useOdi == 0)
					{
						sb.innerHTML = "<A id=\u0022id_HLSB_" + index + "\u0022 class=\u0022\u0022 HREF=\u0022\u0022 onClick=\u0022if(ii_247SB){ii_247SB.onClick();return false;}\u0022>" + "<IMG id=\u0022id_ImgClickToChat_" + index + "\u0022 SRC=\u0022" + imgClickToChat + "\u0022 border=\u00220\u0022 class=\u0022\u0022></A>";
					}
					else
					{
						sb.innerHTML = "";
						/*dept closed*/
					}
					index ++;
				}
				else
				{
					break;
				}
			}
			if(index > -1)
			{
				if(this.useOdi == 0)
				{
					if(window.ISVT_onInviteOffered)
					{
						setTimeout('ISVT_onInviteOffered(19720, 16320)', 1000);
					}
				}
				else
				{
					if(window.ISVT_onInviteNotOffered)
					{
						setTimeout('ISVT_onInviteNotOffered(19720, 16320)', 1000);
					}
				}
			}
		}
		else if(this.userClicked == 1)
		{
			var deptId = ((this.useOdi == 0)?this.di:this.odi);
			if(this.hChildWnd)
			{
				if(window.ISVT_onInviteAccepted)
				{
					ISVT_onInviteAccepted(16320, deptId);
				}
				this.hChildWnd.location = ii_247Var.wcl.replace('http://', 'https://') + "/forms/SearsLoadChat.html?d=" + deptId + "&v=" + escape(((window.ISVT_getVTID())?(window.ISVT_getVTID()):"")) + "&u=" + encodeURIComponent(window.location.href);
			}
		}
		
	};

	this.callIS = function()
	{
		var AccUrl = window.location.href, QS, Index, NV, d, u, v;
		try
		{
			if(AccUrl.indexOf("?") != -1)
			{
				AccUrl = AccUrl.substr(AccUrl.indexOf("?"));
				if(AccUrl.length > 1)
				{
					AccUrl = AccUrl.substr(1);
					QS = AccUrl.split("&");
					for(Index=0; Index < QS.length; Index++)
					{
						NV = QS[Index].split("=");
						if(NV[0] == "d")
						{
							d = NV[1];
						}
						if(NV[0] == "u")
						{
							u = NV[1];
						}
						if(NV[0] == "v")
						{
							v = NV[1];
						}
					}
				}
			}
		}
		catch(Bish)
		{
		}
		document.customerform.ai.value = ii_Var.accountid;
		document.customerform.di.value = d;
		try
		{
			document.customerform.custurl.value = unescape(u);
			if(window.ISVT_getVTID)
			{
				document.customerform.trackingid.value = unescape(v);
			}
			document.customerform.optionaldata1.value = this.getGeoData();
			document.customerform.optionaldata2.value = ((navigator.cookieEnabled)?"~cookie=1":"cookie=0") + "~ua=" + navigator.userAgent.substr(0,300);
		}
		catch(Bish)
		{
		}
		document.customerform.action = "https://admin.instantservice.com/Customer";
		document.customerform.submit();
	};

	this.preloadButton = function()
	{
		var sbImg;

		if (navigator.appName.indexOf("Microsoft") != -1 && navigator.platform.indexOf("Mac") != -1) 
			sbImg = document.createElement('IMG');
		else 
			sbImg = new Image();

		sbImg.src = imgClickToChat;
	};

	this.loadCSS =function(id,scr)
	{
	  var win = window;
	  var head = win.document.getElementsByTagName('head').item(0);
	  var old  = win.document.getElementById(id);
	  if (old) head.removeChild(old);
	  var style = document.createElement('link');
	  style.href = scr;
	  style.rel = "stylesheet";
	  style.type = 'text/css';
	  style.id = id;
	  void(head.appendChild(style));
	}

	this.addCSS = function(id, cssSeg)
	{
		var win = window;
		var oldValue = "";
		var head = win.document.getElementsByTagName('head').item(0);
		var old  = win.document.getElementById(id);
		try
		{
			if(old)
			{
				if(ii_Var.IE)
				{
					oldValue = old.styleSheet.cssText;
				}
				if(ii_Var.MZ)
				{
					oldValue = old.firstChild.nodeValue;
				}
				head.removeChild(old);
			}
			cssSeg = oldValue + cssSeg;
			var style = document.createElement('style');
			style.type = 'text/css';
			style.id = id;
			if(ii_Var.IE)
			{
				style.styleSheet.cssText = cssSeg;
			}
			if(ii_Var.MZ)
			{
				style.appendChild(document.createTextNode(cssSeg));
			}
			void(head.appendChild(style));
		}
		catch(Bish)
		{
			ii_247Var.ErrMsg = Bish.message.toString();
		}
	};

	this.isGeoLoaded = function()
	{
		if(window.isgeoipapi_ip_addr)
		{
			Me.tmrGeoApi = clearInterval(Me.tmrGeoApi);
			ii_initGeoIP();
		}
		else
		{
			Me.retryGeo--;
			if(Me.retryGeo < 1)
			{
				Me.tmrGeoApi = clearInterval(Me.tmrGeoApi);
			}
		}
	};

	this.getGeoData = function()
	{
		var geodata = "";
		if(window.ISVT_getVTID)
		{
			var vt = window.ISVT_getVTID();
			geodata = "vtid=" + ((vt)?vt:"");
		}
		try
		{
			if(window.tfs_Tracker)
			{
				geodata = geodata + "~Tr=" + tfs_Tracker.track;
			}
			else
			{
				geodata = geodata + "~Tr=-1";
			}
			geodata = geodata + "~utco=" + (new Date()).getTimezoneOffset();
		}
		catch(Bish)
		{
		}
		geodata = geodata + "~ip=" + ((ii_Var.geoip)?ii_Var.geoip:"") + "~co=" + ((ii_Var.geoco)?ii_Var.geoco:"") + "~rg=" + ((ii_Var.georg)?ii_Var.georg:"") + "~ct=" + ((ii_Var.geoct)?ii_Var.geoct:"") + "~ns=" + ((ii_Var.geons)?ii_Var.geons:"") + "~dm=" + ((ii_Var.geodm)?ii_Var.geodm:"") + "~Cc=" + ((ii_Var.GeoCc)?ii_Var.GeoCc:"") + "~Cn=" + ((ii_Var.GeoCn)?ii_Var.GeoCn:"") + "~Da=" + ((ii_Var.GeoDa)?ii_Var.GeoDa:"") + "~Ac=" + ((ii_Var.GeoAc)?ii_Var.GeoAc:"") + "~La=" + ((ii_Var.GeoLa)?ii_Var.GeoLa:"") + "~Lo=" + ((ii_Var.GeoLo)?ii_Var.GeoLo:"") + "~Is=" + ((ii_Var.GeoIs)?ii_Var.GeoIs:"") + "~Or=" + ((ii_Var.GeoOr)?ii_Var.GeoOr:"");
		return(geodata);
	};

	this.onPageLoad = function()
	{
		var isct_type = 0;
		var isct_id = 944742050;
		var isct_value = 0;
		var isct_custdata1 = window.location.href;
		var isct_custdata2 = "" + this.getGeoData();
		var isct_custdata3 = "";
		try
		{
			isct_custdata3 = ((navigator.cookieEnabled)?"~cookie=1":"cookie=0") + "~ua=" + navigator.userAgent.substr(0,200);
		}
		catch(Bish)
		{
			isct_custdata3 = "";
		}
		if((isct_custdata1.length + isct_custdata2.length + isct_custdata3.length) > 1990)
		{
			isct_custdata3 = "";
		}
		if((isct_custdata1.length + isct_custdata2.length) > 1990)
		{
			isct_custdata2 = "";
		}

		if (window.ISVT_onConversion)
		{
			ISVT_onConversion(isct_id,isct_value,isct_type,isct_custdata1,isct_custdata2,isct_custdata3);
		}
	};

	this.initObj = function()
	{
		ii_247Var = new ii_247VarObj();
		imgClickToChat = ii_247Var.wcl + '/images/clicktochat.gif';
		try
		{
			tfs_Tracker = new tfs_ObjTracker(null, null);
			tfs_Tracker.imgDefault = imgClickToChat;
		}
		catch(Bish)
		{
		}
		if (ii_getGSV("GeoIP")=="*" && ii_Var.gsvr.length > 0)
		{
			this.tmrGeoApi = setInterval(Me.isGeoLoaded, 1000);
		}
		else
		{
			ii_initGeoIP();
		}
		if(this.di == 0 && this.odi == 0)
		{
			this.callIS();
			return(true);
		}
		this.onPageLoad();
		var cssSrc = ii_247Var.wcl + "/forms/TFSStyles.css";
		//ii_callServer("InstantTracking.js", ii_getProtocol()+'://'+ii_Var.vtscrloc);
		this.loadCSS("id_247css", cssSrc);
		this.preloadButton();
		this.ii_247cda = new ii_247cdaObj(this.di, this.deptOpen, this.deptClosed);
	};

	this.initObj();
};




/*---------End of ISSB.js---------*/
