<!--
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
// Copyright 2004 Netphoria, Inc.  All rights reserved.
//
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

// define global variables that can be seen by the hitlens_embedded function
// with the default values that hitlens expects.
var siteId = 53937;
var pageNumber = 0;
var pageName = '';
var contentGroup = '';
var transaction = '';
var transactionId = 0;
var order = '';

hitlens_initialize();

function hitlens_customize(topLevelFolder, secondLevelFolder, fileName) {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
// Make all modifications for custom HitLens settings in this function.
//
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
	switch (topLevelFolder.toLowerCase()) {
		case "root" :
			contentGroup = "Anser";
			break;
		case "cscript" :
			contentGroup = "CallScriptor";
			break;
		case "n-news" :
			contentGroup = "Whats NEWS";
			break;
		case "n-tellafriend" :
			contentGroup = "Tell A Friend";
			break;
		default :
			contentGroup = "Anser";
	}
	
	switch (fileName.toLowerCase()) {
		case "" :
			pageName = "Home Page";
			break;
		case "index.shtml" :
			pageName = "Home Page";
			break;
		case "contact_us.asp" :
			pageName = "Contact Us";
			break;
		case "about_us.shtml" :
			pageName = "About Us";
			break;
		case "call_center_services.shtml" :
			pageName = "Call Center Services";
			break;
		case "qa_reporting.shtml" :
			pageName = "QA Reporting";
			break;
		case "our_technology.shtml" :
			pageName = "Our Technology";
			break;
		case "industries_served.shtml" :
			pageName = "Industries Served";
			break;
		case "faq.shtml" : 
			pageName = "FAQ";
			break;
		case "sitemap.shtml" : 
			pageName = "Sitemap";
			break;
		default :
			pageName = fileName.toLowerCase();
	}
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// *
// *   N O   M O D I F I C A T I O N S   B E L O W   T H I S    L I N E
// *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function hitlens_initialize() {
	// the url of this page
	var url = document.URL;											// 1.0

	// the first slash after the domain name
	var firstSlash = url.indexOf("/", "http://".length) + 1;		// 1.0

	// the second slash after the domain name which should
	// indicate the first level folder name
	var secondSlash = url.indexOf("/", firstSlash);

	// the third slash indicates the end of a second folder
	var thirdSlash = url.indexOf("/", secondSlash);

	// the last slash in a url indicates the start of the file
	// name.
	var lastSlash = url.lastIndexOf("/");

	// the query string starts with a question mark, find it
	// if it exists the file name goes between the lastSlash
	// and the firstQuestion
	var firstQuestion = url.indexOf("?");

	if (firstQuestion < 0) {
		// if the firstQuestion is not found, set this value
		// to be the length of the string.
		firstQuestion = url.length;
	}

	if (lastSlash > firstQuestion) {
		// if the lastSlash is after the first question, something
		// strange has happened, relocate the lastSlash
		// starting at the location of the firstQuestion
		lastSlash = url.lastIndexOf("/", firstQuestion);

	}

	// find the period separating the second level domain and the top
	// level domain
	var tldPeriod = url.lastIndexOf(".", firstSlash);

	// find the period separating the host name (if any) from the
	// second level domain
	var sldPeriod = url.lastIndexOf(".", tldPeriod - 1);

	// if the sldPeriod is not found, set this to be the last slash of the
	// protocol
	if (sldPeriod < 0) {
		sldPeriod = url.lastIndexOf("/", tldPeriod);
	}

	// the domain and page parsed for a constant value
	var parsePage = url.substring(sldPeriod + 1, firstQuestion)

	// the topLevelFolder is between the end of the domain and the
	// secondSlash (whether the second slash is the start of another
	// directory or a file name.
	var topLevelFolder = url.substring(firstSlash, secondSlash);	// 1.0

	var secondLevelFolder;

	// the file name is between the last slash (plus 1 so the slash
	// is not included) and the firstQuestion mark.
	var fileName = url.substring(lastSlash + 1, firstQuestion);

	// if the thirdSlash is found, there is a subfolder that might
	// need to be considered.
	if (thirdSlash > 0) {
		secondLevelFolder = url.substring(secondSlash, thirdSlash);
	}

	// if the secondSlash is not found, then we are in the root of the
	// site.
	if (secondSlash < 0) {
		topLevelFolder = "root";
	}

	// generate a (hopefully) unique number for this page, excluding the
	// the query sting.
	//pageNumber = hash_value(parsePage);
	pageNumber = 0;

	hitlens_customize(topLevelFolder, secondLevelFolder, fileName);
	self.status = contentGroup + ' ' + pageName;
	/*
	alert('url = ' + url
		+ '\nfirstSlash = ' + firstSlash
		+ '\nsecondSlash = ' + secondSlash
		+ '\nthirdSlash = ' + thirdSlash
		+ '\nlastSlash = ' + lastSlash
		+ '\ntopLevelFolder = ' + topLevelFolder
		+ '\nsecondLevelFolder = ' + secondLevelFolder
		+ '\nfileName = ' + fileName
		+ '\npageNumber = ' + pageNumber
		+ '\nfirstQuestion = ' + firstQuestion
		+ '\nparsePage = ' + parsePage
		+ '\ncontentGroup = ' + contentGroup
		+ '\npageName = ' + pageName
		+ '\nsiteId = ' + siteId);
	*/
	
}

function hash_value(s) {
	// hash the string to come up with a unique number for
	// the string's value.
	var h = 0;
	for (var i = 0; i < s.length; i++) {
		h = h + (s.charCodeAt(i) * (i + 1));
	}

	return h;
}

function hitlens_embedded() {
var id = siteId;
var pc = pageNumber;
var PAGENAME = escape(pageName);
var CONTENTGROUP = escape(contentGroup);
var TRANSACTION = escape(transaction);
var TRANSACTION_ID = transactionId;
var ORDER = escape(order);
return "id="+id+"&pc="+pc+"&p="+PAGENAME+"&gr="+CONTENTGROUP+"&tr="+TRANSACTION+"&trid="+TRANSACTION_ID+"&ord="+ORDER;
}

//-->
