<!--
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
// 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 = 136235;
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.
//
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

//  Setting the top level folder isn't necessary for Carroll Chair
//	switch (topLevelFolder.toLowerCase()) {
//		case "root" :
//			contentGroup = "Carroll Chair";
//			break;
//		default :
//			contentGroup = "Carroll Chair";
//	}

	switch (fileName.toLowerCase()) {	
		case "" :
			pageName = "Carroll Chair Home Page";
			break;		
		case "index.htm" :
			pageName = "Carroll Chair Home Page";
			break;		
		case "why_carroll.asp" :
			pageName = "Why Choose Carroll Chair?";
			break;	
		case "press_releases.asp" :
			pageName = "Press Releases"
			break;
		case "employment.asp" :
			pageName = "Employment Opportunities";
			break;				
		case "product_overview.asp" :
			pageName = "About Our Products...";
			contentGroup = "Products";
			break;		
		case "product_detail.asp" :
			pageName = "Product Detail";
			break;							
		case "stack_chair_overview.asp" :
			pageName = "About Our Stack Chair Collection...";
			contentGroup = "Products";
			break;
		case "specs_stack.asp" :
			pageName = "Stack Chair Collection Specifications";
			contentGroup = "Products";
			break;				
		case "dining_and_cafe_overview.asp" :
			pageName = "About Our Dining & Cafe Collection...";
			contentGroup = "Products";
			break;
		case "specs_dining_masters.asp" :
			pageName = "Dining and Cafe Collection Specifications";
			contentGroup = "Products";
			break;				
		case "barstool_overview.asp" :
			pageName = "About Our Barstool Collection...";
			contentGroup = "Products";
			break;
		case "specs_barstool.asp" :
			pageName = "Barstool Specifications...";
			contentGroup = "Products";
			break;	
		case "barstools_by_design.asp" :
			pageName = "About Our Barstools by Design Program...";
			contentGroup = "Products";
			break;					
		case "lounge_overview.asp" :
			pageName = "About Our Lounge & Conference Collection...";
			contentGroup = "Products";
			break;		
		case "specs_lounge.asp" :
			pageName = "Lounge & Conference Collection Specifications...";
			contentGroup = "Products";
			break;				
		case "tables_overview.asp" :
			pageName = "About Our Table Tops & Bases Collection...";
			contentGroup = "Products";
			break;
		case "tables_category.asp" :
			pageName = "Table Tops and Bases...";
			break;	
		case "base_top_combos.asp" :
			pageName = "Table Tops & Bases Combinations...";
			contentGroup = "Products";
			break;					
		case "product_category.asp" :
			pageName = "Product Categories...";
			contentGroup = "Products";
			break;			
		case "touchstone_finishes.asp" :
			pageName = "About Our Frame & Wood Finishes...";
			contentGroup = "Products";
			break;			
		case "upholsteries.asp" :
			pageName = "Upholsteries";
			contentGroup = "Products";
			break;
		case "grade1.asp" :
			pageName = "Upholstery Swatches - Grade 1";
			contentGroup = "Products";
			break;	
		case "grade2.asp" :
			pageName = "Upholstery Swatches - Grade 2";
			contentGroup = "Products";
			break;						
		case "grade3.asp" :
			pageName = "Upholstery Swatches - Grade 3";
			break;			
		case "grade4.asp" :
			pageName = "Upholstery Swatches - Grade 4";
			contentGroup = "Products";
			break;
		case "grade5.asp" :
			pageName = "Upholstery Swatches - Grade 5";
			contentGroup = "Products";
			break;		
		case "grade6.asp" :
			pageName = "Upholstery Swatches - Grade 6 to 10";
			contentGroup = "Products";
			break;										
		case "grade11.asp" :
			pageName = "Upholstery Swatches - Grade 11 to 15";
			contentGroup = "Products";
			break;	
		case "grade16.asp" :
			pageName = "Upholstery Swatches - Grade 16 & up";
			contentGroup = "Products";
			break;							
		case "quality_construction.asp" :
			pageName = "Quality Construction";
			contentGroup = "Products";
			break;
		case "brochures_downloads.asp" :
			pageName = "Brochures & Downloads";
			break;
		case "questionnaire.asp" :
			pageName = "Brochures & Downloads Questionnaire";
			break;
		case "carroll_express.asp" :
			pageName = "Express Dining & Cafe Chairs";
			break;
		case "find_rep.asp" :
			pageName = "Find a Rep";
			break;
		case "contact_us.asp" :
			pageName = "Contact Us...";
			break;
		case "search.cfm" :
			pageName = "Search";
			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.
	var queryString = url.substring(firstQuestion+1, 10000);

	// 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
		+ '\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 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;
}

//-->
