// ==============================================================================
// WhosOn LiveStats & Chat Gateway script www.whoson.com
// (c) 2005 Parker Software Ltd
// ==============================================================================
// This script should be placed in the root directory of your web site. It should
// be included in each page you want to track.
// Place the Include on your page at the place where you want the Click-To-Chat 
// graphic to appear.
// ===============================================================================

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

// changed 79.99.68.29:8010 to 79.99.68.27:80 and 79.99.68.29:8443 to 79.99.68.27:443 - gateway.cxcommerce.com

var sWOGateway       = "gateway.cxcommerce.com:80"; // specify the address of the WhosOn Gateway server
var sWOGatewaySSL    = "gateway.cxcommerce.com:443"; // specify the external address:port of the WhosOn Gateway server SSL interface
var sWODomain        = "www.cxcommerce.com"; // the domain you are monitoring
var sWODepartment    = ""; // optional department
var sWOChatstart     = "http://gateway.cxcommerce.com/chat/chatstart.htm"; // url to the chatstart.htm page 
var sWOLanguage      = "en"; // language for the chat window
var sWOBackgroundURL = ""; // optional custom background url
var sWOResponse      = ""; // set to a blank string if you do NOT want a visible chat link
var sWOInvite        = "";  // set to a blank string if you do NOT want invite requests to be polled
var sWOPreselect     = ""; // set to D to pre-select Department before starting chat, O to pre-select Operator



var sWOSession;
var sWOUrl;
var sWOPage="";
var sWOPage=urlforwhoson;
var sWOProtocol=window.location.protocol;

var sWOCost=0;    // specify a visit cost 
var sWORevenue=0; // specify the revenue generated by the visitor

// optional contact information. Specify values for these variables if you want contact info for the visitor passed to WhosOn
var sWOName="";
var sWOCompany="";
var sWOEmail="";
var sWOTelephone="";

// specify a user name here if you want a specific user name instead of a session cookie
if(sWOUser==""){
	sWOUser=readCookie('UUID');
}
// specify a page name here if you want a specific page name shown in WhosOn instead of the window.location
// sWOPage="my page";

if(sWOUser!="")sWOSession=sWOUser;
if(sWOPage=="")sWOPage=escape(window.location);
if(sWOProtocol=="file:")sWOProtocol="http:";

sWOUrl=sWOProtocol+"//"+sWOGateway+"/stat.gif?u="+sWOSession+"&d="+sWODomain;
if(sWODepartment.length>0)sWOUrl+="&t="+sWODepartment;
sWOUrl+="&p='"+sWOPage+"'&r='"+escape(document.referrer)+"'";
if(sWOCost!=0)sWOUrl+="&c="+sWOCost;
if(sWORevenue!=0)sWOUrl+="&v="+sWORevenue;

if(sWOResponse==""){
	if(document.layers)document.write("<layer name=\"WhosOn\" visibility=hide><img src=\""+sWOUrl+"\" height=1 width=1><\/layer>");
	else document.write("<div id=\"WhosOn\" STYLE=\"position:absolute;visibility:hidden;\"><img src=\""+sWOUrl+"\" height=1 width=1><\/div>");
} else {
	sWOUrl+="&response=g";sWOChatstart+="?domain="+sWODomain+"&lang="+sWOLanguage;
	if(sWOBackgroundURL!="")sWOChatstart+="&bg="+sWOBackgroundURL;
	if(sWODepartment.length>0)sWOChatstart+="&department="+sWODepartment;
	document.write("<a target=\"_blank\" href=\""+sWOChatstart+"\" onclick=\"javascript:window.open('"+sWOChatstart+"','new_win','width=484,height=361');return false;\"><img border=\"0\" src=\""+sWOUrl+"\"><\/a>");
}
sWOUrl=sWOProtocol+"//"+sWOGateway+"/invite.js?domain="+sWODomain;
if(sWOInvite=="Y")document.write("<script language='Javascript' src='"+sWOUrl+"'><\/script>");


