<!--
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
// 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 = 163515;
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 contentGroup based on topLevelFolder won't work for LB White. JR

//	switch (topLevelFolder.toLowerCase()) {
//		case "root" :
//			contentGroup = "LB White";
//			break;
//		case "content" :
//			contentGroup = "Specification Comparison";
//			break;
//		default :
//			contentGroup = "LB White";
//	}

	switch (fileName.toLowerCase()) {	
		case "" :
			pageName = "PSI Heaters Home Page";
			break;
		case "index.asp" :
			switch(queryString.toLowerCase()) {
				case "" :
					pageName = "PSI Heaters Home Page";
					break;
				case "menuid=157" :
					pageName = "About PSI Heaters";
					break;
				case "menuid=158" :
					pageName = "Employment Opportunities";
					break;
				case "menuid=151" :
					pageName = "PSI Heaters Poultry Heaters";
					break;
				case "menuid=150" :
					pageName = "PSI Heaters Swine Heaters";
					break;
				case "menuid=154" :
					pageName = "Poultry - Horizon Forced Air Heaters";
					break;
				case "menuid=155" :
					pageName = "Poultry - Infraconic Radiant Brooders";
					break;		
				case "menuid=152" :
					pageName = "Swine - Horizon Forced Air Heaters";
					break;	
				case "menuid=130" :
					pageName = "Swine - Classic Forced Air Heaters";
					break;
				case "menuid=153" :
					pageName = "Swine - Infraconic Radiat Heaters";
					break;	
				case "menuid=111" :
					pageName = "What\'s New";
					break;	
				case "menuid=156" :
					pageName = "Location Map";
					break;
				default :
					pageName = "";
			}
			break;
		case "search.asp" :
			pageName = "Service &amp; Support";
			break;
		case "contact_us.asp" :
			pageName = "Contact Information";
			break;	
		case "spec.asp" :
			pageName = "Specification Comparison";
			break;
		case "document.asp" :
			pageName = "Document Delivery";
			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;
}

//-->
