/* [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','11201',jdecode('Home'),jdecode(''), jdecode('%2F11201.html'), 'true',[],'',''],
	['PAGE','46101',jdecode('Public+Notices'),jdecode(''), jdecode('%2F46101.html'), 'true',[],'',''],
	['PAGE','32501',jdecode('About+Us'),jdecode(''), jdecode('%2F32501.html'), 'true',[],'',''],
	['PAGE','32101',jdecode('Mission+Statement'),jdecode(''), jdecode('%2F32101.html'), 'true',[],'',''],
	['PAGE','32522',jdecode('Board+of+Directors'),jdecode(''), jdecode('%2F32522.html'), 'true',[],'',''],
	['PAGE','33501',jdecode('Bill+Payment'),jdecode(''), jdecode('%2F33501.html'), 'true',[],'',''],
	['PAGE','37401',jdecode('Residential+Rates+%26+Fees'),jdecode(''), jdecode('%2F37401.html'), 'true',[],'',''],
	['PAGE','38901',jdecode('Residential+Tap+Fees+'),jdecode(''), jdecode('%2F38901.html'), 'true',[],'',''],
	['PAGE','39801',jdecode('Tenant+%2F+Landlord+Fees'),jdecode(''), jdecode('%2F39801.html'), 'true',[],'',''],
	['PAGE','40801',jdecode('Developers+%26+Contractors'),jdecode(''), jdecode('%2F40801.html'), 'true',[],'',''],
	['PAGE','40301',jdecode('Water+Use+Information'),jdecode(''), jdecode('%2F40301.html'), 'true',[],'',''],
	['PAGE','32564',jdecode('Buisness+Contact'),jdecode(''), jdecode('%2F32564.html'), 'true',[],'',''],
	['PAGE','44001',jdecode('Call+Before+You+Dig'),jdecode(''), jdecode('%2F44001.html'), 'true',[],'',''],
	['PAGE','32543',jdecode('Emergency+call'),jdecode(''), jdecode('%2F32543.html'), 'true',[],'',''],
	['PAGE','45301',jdecode('Compliance'),jdecode(''), jdecode('%2F45301.html'), 'true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Padma';
theSitetree.paletteFamily='006699';
theSitetree.keyvisualId='1039';
theSitetree.keyvisualName='apothekenglas1.jpg';
theSitetree.fontsetId='179';
theSitetree.graphicsetId='216';
theSitetree.contentColor='003366';
theSitetree.contentBGColor='9E9D90';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp35-attweb',
  product: 'WSCSYSSSSLY0X9RC'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Padma',
				paletteFamily: 	'006699',
				keyvisualId: 	'1039',
				keyvisualName: 	'apothekenglas1.jpg',
				fontsetId: 		'179',
				graphicsetId: 	'216',
				contentColor: 	'003366',
				contentBGColor: '9E9D90',
				a_color: 		'006699',
				b_color: 		'003366',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11201',
internalId:  '',
customField: '20100127-091810'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37401',
internalId:  '',
customField: '20110318-100427'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32101',
internalId:  '',
customField: '20101026-090803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32501',
internalId:  '',
customField: '20110714-102807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32522',
internalId:  '',
customField: '20110714-103129'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32543',
internalId:  '',
customField: '20091111-150830'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32564',
internalId:  '',
customField: '20110714-102948'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33501',
internalId:  '',
customField: '20091111-150708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38901',
internalId:  '',
customField: '20110510-163750'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39801',
internalId:  '',
customField: '20091123-170000'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40301',
internalId:  '',
customField: '20100127-090057'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40801',
internalId:  '',
customField: '20100127-090014'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '11201',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-15096322']={
webappId:    '1501',
documentId:  '11201',
internalId:  '15096322',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44001',
internalId:  '',
customField: '20101026-095715'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45301',
internalId:  '',
customField: '20111102-091816'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46101',
internalId:  '',
customField: '20120207-115030'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INHZN0';
var companyName   = 'Newberry+County+Water+%26+Sewer+Authority';
var htmlTitle	  = 'Newberry+County+Water+%26+Sewer+Authority';
var metaKeywords  = '';
var metaContents  = '';
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();
};

