// This script is to determine what 'level' of a site a user is viewing.  
//  This will allow a variable called relativePathToRoot to be used to dynamically
//  determine links in the menuing, etc. instead of having to maintain multiple version
//  depending on what subfolder you are viewing
// 


// By default, a default assumption that the site starts at level 1 
// i.e. http://www.transcanada.com
// if the root of the site started at http://www.transcanada.com/testsite/
// the level would be 2, etc.

var environmentRootLevel = 1;


var wl = "" + window.location;
var wlArray = wl.split("/");
var pathLevel = wlArray.length - 3; // How many subfolders into the site are we?
var relativePathToRoot = "http://www.transcanada.com/"; // the relative path to the root of the web site

/*
local site specific code

// adjust the pathLevel if environmentRoot isn't 1, etc.
	pathLevel = pathLevel - (environmentRootLevel - 1);

	// adjust the pathLevel if previewing site from test directory
	// i.e. Y:\Web_TCdotcom
	if (wl.indexOf("Y:") != -1) {
		pathLevel = pathLevel - 2;
	}
	
	// adjust the pathLevel if previewing site from local machine
	// i.e. C:\Web_TCdotcom
	if (wl.indexOf("C:") != -1) {
		pathLevel = pathLevel - 5;
	}

// Create the path string based on what pathLevel we're at.
for (i = 1; i < pathLevel; i++){
	relativePathToRoot = relativePathToRoot + "../";
}

// if we're displaying pages from the cgi-bin directory (i.e. search), then use absolute paths
if (wl.indexOf("/cgi-bin/") != -1) {
		relativePathToRoot = "/";
}

// if we're displaying pages from external site like shareholder.com, then point to Transcanada's site
if (wl.indexOf("shareholder.com") != -1 || wl.indexOf("foothillspipe.com") != -1) {
		relativePathToRoot = "http://www.transcanada.com/";
}
// if we're displaying pages from external site like shareholder.com, then point to Transcanada's site
if (wl.indexOf("Foothills") != -1) {
		relativePathToRoot = "http://www.transcanada.com/";
}

*/


