<!--
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
// 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 = 163505;
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 = "T.Wall";
			break;
		case "n-sitemap" :
			contentGroup = "Sitemap";
			break;
		case "n-calendar" :
			contentGroup = "Calendar";
			break;			
		case "n-property" :
			contentGroup = "Properties";
			break;	
		default :
			contentGroup = "T.Wall";
	}
	//alert ("filename=" + fileName.toLowerCase() + " query=" + queryString.toLowerCase());
	switch (fileName.toLowerCase()) {	
		case "" :
			pageName = "T.Wall Home Page";
			break;
		case "index.asp" :
			switch(queryString.toLowerCase()) {
				case mylc("menuID=126&firstlevelmenuID=110") :
					pageName = "About T.Wall Properties";
					break;
				case mylc("menuID=130&firstlevelmenuID=110") :
					pageName = "Meet the T.Wall Team";
					break;
				case mylc("menuID=139&firstlevelmenuID=110") :
					pageName = "Meet Terrence R. Wall";
					break;
				case mylc("menuID=140&firstlevelmenuID=110") :
					pageName = "Corporate Videos";
					break;
				case mylc("menuid=146") :
					pageName = "Contact Us";
					break;
				case mylc("menuid=109&firstlevelmenuid=109") :
					pageName = "Space for Lease";
					break;
				case mylc("menuid=124") :
					pageName = "Property Search & Map";
					break;
				case mylc("menuid=119&firstlevelmenuid=109") :
					pageName = "Testimonials";
					break;		
				case mylc("menuid=120&firstlevelmenuid=109") :
					pageName = "City Center West";
					break;	
				case mylc("menuid=141&firstlevelmenuid=109") :
					pageName = "City Center West - Thumbnail Map";
					break;
				case mylc("menuid=121&firstlevelmenuid=109") :
					pageName = "High Crossing";
					break;
				case mylc("menuid=142&firstlevelmenuid=109") :
					pageName = "High Crossing - Thumbnail Map";
					break;	
				case mylc("menuid=122&firstlevelmenuid=109") :
					pageName = "High Point Office Park";
					break;		
				case mylc("menuid=143&firstlevelmenuid=109") :
					pageName = "High Point Office Park - Thumbnail Map";
					break;
				case mylc("menuid=123&firstlevelmenuid=109") :
					pageName = "Center for Industry & Commerce";
					break;
				case mylc("menuid=110&firstlevelmenuid=110") :
					pageName = "Property For Sale";
					break;		
				case mylc("menuid=116&firstlevelmenuid=112") :
					pageName = "Investor Relations";
					break;
				case mylc("menuid=113&firstlevelmenuid=113") :
					pageName = "Vendor Relations";
					break;
				case mylc("menuID=218&firstlevelmenuID=218") :
					pageName = "The Wall Report";
					break;
				case "" :
					pageName = "Home Page";
					break;
				default :
					//pageName = fileName.toLowerCase();
					pageName = "ACE Content Page " + queryString;
			}
			break;
		case "properties.asp" :
			//alert ("query=" + queryString.toLowerCase());
			switch(queryString.toLowerCase()) {
				case mylc("map_property_id=3") :
					pageName = "High Crossing Environ";
					break;
				case mylc("map_property_id=4") :
					pageName = "City Center West";
					break;
				case "" : 
					pageName = "All Properties";
					break;
				default :
					if (queryString.indexOf('property_type=') > -1) {
						var firstPos;
						var lastPos;
						firstPos = queryString.indexOf('property_type=') + 14;
						if (queryString.indexOf('#') > 14) {
							lastPos = queryString.indexOf('#');
						}
						else {
							lastPos = queryString.length;
						}
						//pageName = queryString;
						pageName = unescape(queryString.substring(firstPos, lastPos));
					}
					else {
						pageName = fileName.toLowerCase();
					}
			}
			break;
		case "calendar.asp" :
			//alert ("query=" + queryString.toLowerCase());
			switch(queryString.toLowerCase()) {
				case mylc("category=12") :
					pageName = "Events";
					break;
				case mylc("category=8") :
					pageName = "2418 Crossroads: Board Room";
					break;
				case mylc("category=9") :
					pageName = "2601 Crossroads: Board Room";
					break;		
				case mylc("category=7") :
					pageName = "2810 Crossroads: Board Room";
					break;		
				case mylc("category=6") :
					pageName = "2810 Crossroads: Conference Ctr.";
					break;	
				case mylc("category=10") :
					pageName = "5315 Wall St.: Board Room";
					break;		
				case mylc("category=11") :
					pageName = "5325 Wall St.: Board Room";
					break;	
				case mylc("category=5") :
					pageName = "CCW: Board Room";
					break;		
				case mylc("category=4") :
					pageName = "CCW Conference Center";
					break;																															
				default :
					pageName = fileName.toLowerCase();
			}
			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 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;
}

//-->
