/* [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','2801',jdecode('Home'),jdecode(''), jdecode('%2F2801.html'), 'true',[],'',''],
	['PAGE','3069',jdecode('About+Us'),jdecode(''), jdecode('%2F3069.html'), 'true',[],'',''],
	['PAGE','2943',jdecode('Directors+and+Staff'),jdecode(''), jdecode('%2F2943.html'), 'true',[],'',''],
	['PAGE','3048',jdecode('Public+Notices%2F+Agendas'),jdecode(''), jdecode('%2F3048.html'), 'true',[],'',''],
	['PAGE','13912',jdecode('Meeting+Minutes'),jdecode(''), jdecode('%2F13912.html'), 'true',[],'',''],
	['PAGE','6201',jdecode('Management+Plan'),jdecode(''), jdecode('%2F6201.html'), 'true',[],'',''],
	['PAGE','6222',jdecode('Permanent+Rules'),jdecode(''), jdecode('%2F6222.html'), 'true',[],'',''],
	['PAGE','6243',jdecode('Bylaws'),jdecode(''), jdecode('%2F6243.html'), 'true',[],'',''],
	['PAGE','30023',jdecode('Transfer+of+Ownership'),jdecode(''), jdecode('%2F30023.html'), 'true',[],'',''],
	['PAGE','18412',jdecode('Abandoned+Wells'),jdecode(''), jdecode('%2F18412.html'), 'true',[],'',''],
	['ITEM','22512',jdecode('Rainwater+Harvesting'),jdecode(''), jdecode('http%3A%2F%2Fwww.twdb.state.tx.us%2Fpublications%2Freports%2FRainwaterHarvestingManual_3rdedition.pdf'), 'true',[],'','_blank'],
	['PAGE','6264',jdecode('Water+Well+Applications'),jdecode(''), jdecode('%2F6264.html'), 'true',[],'',''],
	['PAGE','35823',jdecode('Water+Well+Prod+Forms'),jdecode(''), jdecode('%2F35823.html'), 'true',[],'',''],
	['PAGE','19812',jdecode('GMA+11'),jdecode(''), jdecode('%2F19812.html'), 'true',[],'',''],
	['ITEM','34923',jdecode('Fun+for+Kids'),jdecode(''), jdecode('http%3A%2F%2Fwww.twdb.state.tx.us%2Fpublications%2Fbrochures%2Fconservation%2Fdoc%2FKids_education_brochure.pdf'), 'true',[],'','_blank'],
	['PAGE','2852',jdecode('Contact+Us'),jdecode(''), jdecode('%2F2852.html'), 'true',[],'',''],
	['PAGE','21413',jdecode('Conservation+Tips'),jdecode(''), jdecode('%2F21413.html'), 'true',[],'',''],
	['PAGE','12812',jdecode('FAQ'),jdecode(''), jdecode('%2F12812.html'), 'true',[],'',''],
	['PAGE','23412',jdecode('Useful+Links'),jdecode(''), jdecode('%2F23412.html'), 'true',[],'','']];
var siteelementCount=19;
theSitetree.topTemplateName='Toronto';
theSitetree.paletteFamily='3358C6';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='16881';
theSitetree.graphicsetId='12318';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='3358C6';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp35-attweb',
  product: 'WSCSYSSSSLY0X9RC'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Toronto',
				paletteFamily: 	'3358C6',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'16881',
				graphicsetId: 	'12318',
				contentColor: 	'FFFFFF',
				contentBGColor: '3358C6',
				a_color: 		'3358C6',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2801',
internalId:  '',
customField: '20120131-135727'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3069',
internalId:  '',
customField: '20090611-160918'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2943',
internalId:  '',
customField: '20110520-161212'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6264',
internalId:  '',
customField: '20120119-151647'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6243',
internalId:  '',
customField: '20111207-175956'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2852',
internalId:  '',
customField: '20110520-161104'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6201',
internalId:  '',
customField: '20090523-131741'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6222',
internalId:  '',
customField: '20120118-173318'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3048',
internalId:  '',
customField: '20120131-135746'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12812',
internalId:  '',
customField: '20101027-140831'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21413',
internalId:  '',
customField: '20100825-105110'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23412',
internalId:  '',
customField: '20101004-122909'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13912',
internalId:  '',
customField: '20120131-135629'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18412',
internalId:  '',
customField: '20100119-095135'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19812',
internalId:  '',
customField: '20110602-155940'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30023',
internalId:  '',
customField: '20110822-163114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35823',
internalId:  '',
customField: '20120210-110546'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INHNUM';
var companyName   = 'Panola+County+Groundwater+Conservation+District';
var htmlTitle	  = 'PCGCD';
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();
};

