/* [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','401',jdecode('Home'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','5301',jdecode('Swim+Lessons'),jdecode(''), jdecode('%2F5301.html'), 'false',[],'',''],
	['PAGE','247223',jdecode('2012+Swim+%26+Dive+Dates'),jdecode(''), jdecode('%2F247223.html'), 'true',[],'',''],
	['PAGE','10501',jdecode('Swim+Team'),jdecode(''), jdecode('%2F10501.html'), 'true',[],'',''],
	['PAGE','10522',jdecode('Dive+Programs'),jdecode(''), jdecode('%2F10522.html'), 'true',[],'',''],
	['PAGE','17201',jdecode('Early+Morning+Swim'),jdecode(''), jdecode('%2F17201.html'), 'true',[],'',''],
	['PAGE','9885',jdecode('Tennis+Program'),jdecode(''), jdecode('%2F9885.html'), 'true',[],'',''],
	['PAGE','163512',jdecode('Junior+Tennis+Team'),jdecode(''), jdecode('%2F163512.html'), 'true',[],'',''],
	['PAGE','10627',jdecode('Tennis+Events'),jdecode(''), jdecode('%2F10627.html'), 'true',[],'',''],
	['PAGE','515',jdecode('Social+Events'),jdecode(''), jdecode('%2F515.html'), 'true',[],'',''],
	['PAGE','536',jdecode('Pool+Hours+%2F+Calendar'),jdecode(''), jdecode('%2F536.html'), 'true',[],'',''],
	['PAGE','236423',jdecode('Fall+2011+Newsletter'),jdecode(''), jdecode('%2F236423.html'), 'true',[],'',''],
	['PAGE','17222',jdecode('Registration%2FPayment'),jdecode(''), jdecode('%2F17222.html'), 'true',[],'',''],
	['PAGE','169512',jdecode('LFC+Spiritwear'),jdecode(''), jdecode('%2F169512.html'), 'true',[],'',''],
	['PAGE','578',jdecode('Membership+Applications'),jdecode(''), jdecode('%2F578.html'), 'true',[],'',''],
	['PAGE','73901',jdecode('Employment'),jdecode(''), jdecode('%2F73901.html'), 'true',[],'',''],
	['PAGE','83801',jdecode('Private+Parties'),jdecode(''), jdecode('%2F83801.html'), 'true',[],'',''],
	['PAGE','244823',jdecode('Bylaws%2FMinutes'),jdecode(''), jdecode('%2F244823.html'), 'true',[],'',''],
	['PAGE','4101',jdecode('Contact+Us'),jdecode(''), jdecode('%2F4101.html'), 'true',[],'',''],
	['PAGE','142412',jdecode('LFC+Suggestion+Box'),jdecode(''), jdecode('%2F142412.html'), 'true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='NewYork';
theSitetree.paletteFamily='FFCC33';
theSitetree.keyvisualId='970';
theSitetree.keyvisualName='delphinschwimmer.jpg';
theSitetree.fontsetId='168';
theSitetree.graphicsetId='199';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'aplus',
  product: 'WSCSYSSSSLYTCPLI'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'NewYork',
				paletteFamily: 	'FFCC33',
				keyvisualId: 	'970',
				keyvisualName: 	'delphinschwimmer.jpg',
				fontsetId: 		'168',
				graphicsetId: 	'199',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000066',
				b_color: 		'FFCC33',
				c_color: 		'000000',
				d_color: 		'406BC0',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-11963770']={
webappId:    '1501',
documentId:  '401',
internalId:  '11963770',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20120130-164337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20110921-110554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10501',
internalId:  '',
customField: '20120201-083147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17201',
internalId:  '',
customField: '20120128-150439'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10522',
internalId:  '',
customField: '20120201-090131'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9885',
internalId:  '',
customField: '20110608-110636'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10627',
internalId:  '',
customField: '20110921-111622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20110921-111756'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20110921-111911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17222',
internalId:  '',
customField: '20110523-150850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20080717-161123'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73901',
internalId:  '',
customField: '20120130-163959'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '83801',
internalId:  '',
customField: '20120128-144942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4101',
internalId:  '',
customField: '20090710-055927'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '163512',
internalId:  '',
customField: '20110423-053342'
};
webappMappings['7008']=webappMappings['7008-429']={
webappId:    '7008',
documentId:  '142412',
internalId:  '429',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '142412',
internalId:  '',
customField: '20090623-052932'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '236423',
internalId:  '-',
customField: '20111203-114654'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '169512',
internalId:  '',
customField: '20110921-112103'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '244823',
internalId:  '-',
customField: '20120130-162402'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '247223',
internalId:  '-',
customField: '20120201-075013'
};
var webAppHostname = 'cm4all.aplus.net:80';
var canonHostname = 'cm4all01.carrierzone.com';
var accountId     = 'AAPLU0INVSIE';
var companyName   = 'The+LaGrange+Field+Club';
var htmlTitle	  = 'La+Grange+Field+Club';
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();
};

