<!--
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
// 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 = 240178;
var pageNumber = 0;
var pageName = '';
var contentGroup = '';
var transaction = '';
var transactionId = 0;
var order = '';

hitlens_initialize();

function hitlens_customize(topLevelFolder, secondLevelFolder, fileName, queryString) {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
// Make all modifications for custom HitLens settings in this function.
//
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

	switch (topLevelFolder.toLowerCase()) {
		case "root" :
			contentGroup = "Mcloone Business Cards";
			break;
		case "forms" :
			contentGroup = "Request Forms";
			break;
		case "n-myphoto" :
			contentGroup = "Create Your Own Card";
			break;
		default :
			contentGroup = "Mcloone Business Cards";
	}
	//alert ("filename=" + fileName.toLowerCase() + " query=" + queryString.toLowerCase());
	switch (fileName.toLowerCase()) {	
		case "" :
			pageName = "Mcloone Business Cards Home Page";
			break;
		case "contact-us.shtml" :
			pageName = "Contact Us";
			break;
		case "about.shtml" :
			pageName = "About Mcloone Business Cards";
			break;
		case "price-compare.shtml" :
			pageName = "Price Page";
			break;
		case "n-myphoto/Create-your-own-prof.asp" :
			pageName = "Professional DYO";
			break;
		case "n-myphoto/Create-your-own-impact.asp" :
			pageName = "Impact DYO";
			break;
		case "Create-your-own-sleek.asp" :
			pageName = "Sleek DYO";
			break;
		case "360products.shtml" :
			pageName = "360 Products";
			break;
		case "360-agency.html" :
			pageName = "360 Agency Card";
			break;
		case "360-brand-animal.html" :
			pageName = "360 Brand Animal Card";
			break;
		case "360-RFE.html" :
			pageName = "360 RFE Card";
			break;
		case "forms/quote-req.asp" :
			pageName = "Business Card Quotes";
			break;
		case "forms/quote-sample.asp" :
			pageName = "Business Card Samples";
			break;
		case "forms/thank_you.asp" :
			pageName = "Thank you for your submission!";
			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 + 1);

	// 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("?");
	
	var firstPound = 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 (firstPound < 0) {
		// if the firstPound is not found, set this value
		// to be the length of the string.
		firstPound = 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;
	
	// decide which is first, the firstPound or firstQuestion and 
	// assign it to firstQuestion
	if (firstQuestion > firstPound) {
		firstQuestion = firstPound;
	}

	// 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);

	// the QueryString is between the firstQuestion mark and the end of the string.
	if (firstPound == -1) {
		firstPound = 10000;
	}
	
	var queryString = url.substring(firstQuestion+1, firstPound);

	// if the thirdSlash is found, there is a subfolder that might
	// need to be considered.
	if (thirdSlash > 0) {
		secondLevelFolder = url.substring(secondSlash + 1, 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, queryString);
	self.status = contentGroup + ' ' + pageName;
/*	
	alert('url = ' + url
		+ '\nfirstSlash = ' + firstSlash
		+ '\nsecondSlash = ' + secondSlash
		+ '\nthirdSlash = ' + thirdSlash
		+ '\nlastSlash = ' + lastSlash
		+ '\nfirstPound = ' + firstPound
		+ '\ntopLevelFolder = ' + topLevelFolder
		+ '\nsecondLevelFolder = ' + secondLevelFolder
		+ '\nfileName = ' + fileName
		+ '\npageNumber = ' + pageNumber
		+ '\nfirstQuestion = ' + firstQuestion
		+ '\nparsePage = ' + parsePage
		+ '\ncontentGroup = ' + contentGroup
		+ '\npageName = ' + pageName
		+ '\nqueryString = ' + queryString
		+ '\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 mylc(s) {
	// lowercase string
	s = s.toLowerCase;
	return s
}

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;
}

//-->
