/* [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','8101',jdecode('Home'),jdecode(''),'/8101.html','true',[],'',''],
	['PAGE','11601',jdecode('About+Us'),jdecode(''),'/11601.html','true',[],'',''],
	['PAGE','8152',jdecode('Water+Treatment'),jdecode(''),'/8152/index.html','true',[ 
		['PAGE','8257',jdecode('Reverse+Osmosis'),jdecode(''),'/8152/8257.html','true',[],'',''],
		['PAGE','30693',jdecode('Sulfur+Filters'),jdecode(''),'/8152/30693.html','true',[],'',''],
		['PAGE','8236',jdecode('Ultraviolet+Systems'),jdecode(''),'/8152/8236.html','true',[],'',''],
		['PAGE','8278',jdecode('Chem+Feed+Pumps'),jdecode(''),'/8152/8278.html','true',[],'','']
	],'',''],
	['PAGE','8173',jdecode('Water+Softeners'),jdecode(''),'/8173/index.html','true',[ 
		['PAGE','24953',jdecode('CareSoft+EM+%C2%AE'),jdecode(''),'/8173/24953.html','true',[],'','']
	],'',''],
	['PAGE','8194',jdecode('Water+Filters'),jdecode(''),'/8194/index.html','true',[ 
		['PAGE','24974',jdecode('CareClear+%C2%AE'),jdecode(''),'/8194/24974.html','true',[],'',''],
		['PAGE','8215',jdecode('Sulfur+Filters'),jdecode(''),'/8194/8215.html','true',[],'','']
	],'',''],
	['PAGE','8299',jdecode('Water+Testing+Services'),jdecode(''),'/8299.html','true',[],'',''],
	['PAGE','8404',jdecode('Route+Services'),jdecode(''),'/8404.html','true',[],'',''],
	['PAGE','8509',jdecode('Well+Chlorination'),jdecode(''),'/8509.html','true',[],'',''],
	['PAGE','8593',jdecode('Construction+Planning'),jdecode(''),'/8593.html','true',[],'',''],
	['PAGE','8530',jdecode('Petzold+Well+House'),jdecode(''),'/8530.html','true',[],'',''],
	['PAGE','8656',jdecode('GE+HomeSpring+%C2%AE'),jdecode(''),'/8656.html','true',[],'',''],
	['PAGE','29337',jdecode('Klean+Kanteen'),jdecode(''),'/29337.html','true',[],'',''],
	['PAGE','8677',jdecode('Water+FAQs'),jdecode(''),'/8677.html','true',[],'',''],
	['PAGE','12815',jdecode('Helpful+Links'),jdecode(''),'/12815.html','true',[],'',''],
	['PAGE','8698',jdecode('Contact+Us'),jdecode(''),'/8698.html','true',[],'','']];
var siteelementCount=22;
theSitetree.topTemplateName='Fields';
theSitetree.paletteFamily='FEFEFE';
theSitetree.keyvisualId='11286';
theSitetree.keyvisualName='kv_11286.jpg';
theSitetree.fontsetId='31972';
theSitetree.graphicsetId='13807';
theSitetree.contentColor='8E8C8C';
theSitetree.contentBGColor='FEFEFE';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Fields',
				paletteFamily: 	'FEFEFE',
				keyvisualId: 	'11286',
				keyvisualName: 	'kv_11286.jpg',
				fontsetId: 		'31972',
				graphicsetId: 	'13807',
				contentColor: 	'8E8C8C',
				contentBGColor: 'FEFEFE',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-16718']={
webappId:    '7008',
documentId:  '8698',
internalId:  '16718',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8101',
internalId:  '',
customField: '20110121-094215'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8698',
internalId:  '',
customField: '20090720-110732'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12815',
internalId:  '',
customField: '20090724-092609'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '8101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11601',
internalId:  '',
customField: '20100522-112540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8152',
internalId:  '',
customField: '20090810-170032'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8173',
internalId:  '',
customField: '20090711-144649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8194',
internalId:  '',
customField: '20090810-170607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8215',
internalId:  '',
customField: '20090710-171315'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8236',
internalId:  '',
customField: '20090810-170154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8257',
internalId:  '',
customField: '20090810-170253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8278',
internalId:  '',
customField: '20090711-170843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8299',
internalId:  '',
customField: '20090724-092759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30693',
internalId:  '',
customField: '20090810-170414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8404',
internalId:  '',
customField: '20090810-170720'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8509',
internalId:  '',
customField: '20090724-101344'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8530',
internalId:  '',
customField: '20090823-100812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8593',
internalId:  '',
customField: '20090724-094943'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24953',
internalId:  '',
customField: '20090711-160942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24974',
internalId:  '',
customField: '20090712-101415'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8656',
internalId:  '',
customField: '20090711-164731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8677',
internalId:  '',
customField: '20090718-174224'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29337',
internalId:  '',
customField: '20090810-170840'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN3QAI';
var companyName   = '...because+good+water+is+priceless';
var htmlTitle	  = 'Priceless+WaterCare...because+good+water+is+priceless.';
var metaKeywords  = 'WaterCare%2C+water+treatment%2C+water+systems%2C+water+purification%2C+water+quality';
var metaContents  = 'Priceless+WaterCare...because+good+water+is+priceless.';
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();
};

