/* [nodename, id, name, navigationtext, href, isnavigation, childs[], templatename] */

if (typeof(decodeURIComponent) == 'undefined') {
  decodeURIComponent = function(s) {
    return unescape(s);
  }
}

function jdecode(s) {
    s = s.replace(/\+/g, "%20")
    return decodeURIComponent(s);
}

var POS_NODENAME=0;
var POS_ID=1;
var POS_NAME=2;
var POS_NAVIGATIONTEXT=3;
var POS_HREF=4;
var POS_ISNAVIGATION=5;
var POS_CHILDS=6;
var POS_TEMPLATENAME=7;
var POS_TARGET=8;
var theSitetree=[ 
	['PAGE','index',jdecode('Home'),jdecode(''),'/index.html','true',[],'',''],
	['PAGE','denver-area-storage-facility',jdecode('Facility'),jdecode(''),'/denver-area-storage-facility.html','true',[],'',''],
	['PAGE','storage-units',jdecode('Units'),jdecode(''),'/storage-units.html','true',[],'',''],
	['PAGE','self-storage-location',jdecode('Location'),jdecode(''),'/self-storage-location.html','true',[],'',''],
	['PAGE','contact-self-storage',jdecode('Contact+Us'),jdecode(''),'/contact-self-storage.html','true',[],'',''],
	['PAGE','storage-facility-photos',jdecode('Photo%26%23x27%3Bs'),jdecode(''),'/storage-facility-photos.html','true',[],'','']];
var siteelementCount=6;
theSitetree.topTemplateName='Staples';
theSitetree.paletteFamily='D1DED4';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10351';
theSitetree.graphicsetId='10484';
theSitetree.contentColor='0a2712';
theSitetree.contentBGColor='D1DED4';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Staples',
				paletteFamily: 	'D1DED4',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10351',
				graphicsetId: 	'10484',
				contentColor: 	'0a2712',
				contentBGColor: 'D1DED4',
				a_color: 		'd1ded4',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'09541e',
				e_color: 		'2f3a32',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'trebuchet ms, lucida, helvetica',
				contentFontSize:'11',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7101',
internalId:  '',
customField: '20100707-230006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16801',
internalId:  '',
customField: '20100704-121239'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16843',
internalId:  '',
customField: '20100704-122308'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16822',
internalId:  '',
customField: '20100706-143731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16864',
internalId:  '',
customField: '20100704-112753'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '7101',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-3016230']={
webappId:    '1501',
documentId:  '7101',
internalId:  '3016230',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44923',
internalId:  '',
customField: '20100716-152548'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I7CE8Y';
var companyName   = 'Go+Green+Self+Storage++++++++++303-833-1112';
var htmlTitle	  = 'Go+Green+Self+Storage';
var metaKeywords  = 'Storage+Dacono+CO%0D%0AStorage+Frederick+CO%0D%0AStorage+Boulder+CO%0D%0AStorage+Firestone+CO%0D%0APublic+Storage+CO%0D%0ACheap+Storage+CO%0D%0ABoat+Parking+CO%0D%0ARV+Parking+CO%0D%0AStorage+CO%0D%0ASelf+Storage+CO%0D%0AStorage+Locker%0D%0AStorage+Locker+CO%0D%0A';
var metaContents  = 'Go+Green+Self+Storage+201+Thomas+ct+Dacono%2C+CO+80514%0D%0AColorado%27s+First+Solar+Powered+Storage+Facility';
theSitetree.getById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		if (ar[i][POS_ID] == id){
			return ar[i];
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getParentById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		for (var j = 0; j < ar[i][POS_CHILDS].length; j++) {
			if (ar[i][POS_CHILDS][j][POS_ID] == id) {
				// child found
				return ar[i];
			}
			var result=this.getParentById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getName = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAME];
	}
	return null;
};

theSitetree.getNavigationText = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAVIGATIONTEXT];
	}
	return null;
};

theSitetree.getHREF = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_HREF];
	}
	return null;
};

theSitetree.getIsNavigation = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_ISNAVIGATION];
	}
	return null;
};

theSitetree.getTemplateName = function(id, lastTemplateName, ar) {
	if (typeof(lastTemplateName) == 'undefined'){
		lastTemplateName = this.topTemplateName;
	}
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		var actTemplateName = ar[i][POS_TEMPLATENAME];
		if (actTemplateName == ''){
			actTemplateName = lastTemplateName;
		}
		if (ar[i][POS_ID] == id) {
			return actTemplateName;
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getTemplateName(id, actTemplateName, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getByXx = function(lookup, xx, ar) {
    if (typeof(ar) == 'undefined'){
    	ar = this;
    }
    for (var i=0; i < ar.length; i++) {
        if (ar[i][xx] == lookup){
        	return ar[i];
        }
        if (ar[i][POS_CHILDS].length > 0) {
        	var result=this.getByXx(lookup, xx, ar[i][POS_CHILDS]);
            if (result != null){
                return result;
               }
        }
    }
    return null;
};

function gotoPage(lookup) {
	if(__path_prefix__ == "/servlet/CMServeRES" && typeof (changePage) == 'function'){
		changePage(lookup);
		return;
	}
	var page = theSitetree.getHREF(lookup);
	if (!page) {
		var testFor = [ POS_NAME, POS_NAVIGATIONTEXT ];
		for (var i=0 ; i < testFor.length ; i++) {
			var p = theSitetree.getByXx(lookup, testFor[i]);
			if (p != null) {
				page = p[POS_HREF];
				break;
			}
		}
	}
	document.location.href = (new URL(__path_prefix__ + page, true, true)).toString();
};

