/* [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','4598',jdecode('Home'),jdecode(''), jdecode('%2F4598.html'), 'true',[],'',''],
	['PAGE','6303',jdecode('Opening+Times'),jdecode(''), jdecode('%2F6303.html'), 'true',[],'',''],
	['PAGE','6330',jdecode('Costs'),jdecode(''), jdecode('%2F6330.html'), 'true',[],'',''],
	['PAGE','7084',jdecode('AquaCise'),jdecode(''), jdecode('%2F7084.html'), 'true',[],'',''],
	['PAGE','68201',jdecode('Aqua+Zumba'),jdecode(''), jdecode('%2F68201.html'), 'true',[],'',''],
	['PAGE','7111',jdecode('Ashswim+Learn+to+Swim'),jdecode(''), jdecode('%2F7111%2Findex.html'), 'true',[ 
		['PAGE','25501',jdecode('About+Ashswim'),jdecode(''), jdecode('%2F7111%2F25501.html'), 'true',[],'',''],
		['PAGE','41301',jdecode('Ashswim+Programmes'),jdecode(''), jdecode('%2F7111%2F41301.html'), 'true',[],'',''],
		['PAGE','43101',jdecode('Bookings'),jdecode(''), jdecode('%2F7111%2F43101.html'), 'true',[],'',''],
		['PAGE','64501',jdecode('Prgramme+Dates'),jdecode(''), jdecode('%2F7111%2F64501.html'), 'true',[],'','']
	],'',''],
	['PAGE','11603',jdecode('Pool+Hire%2FBookings'),jdecode(''), jdecode('%2F11603.html'), 'true',[],'',''],
	['PAGE','11841',jdecode('Pool+Shop'),jdecode(''), jdecode('%2F11841.html'), 'true',[],'',''],
	['PAGE','13226',jdecode('Pool+Rules'),jdecode(''), jdecode('%2F13226.html'), 'true',[],'',''],
	['PAGE','32501',jdecode('Ash+Trust+Swim+Team'),jdecode(''), jdecode('%2F32501.html'), 'true',[],'',''],
	['PAGE','4655',jdecode('Contact+Us'),jdecode(''), jdecode('%2F4655.html'), 'true',[],'',''],
	['PAGE','19321',jdecode('Guestbook'),jdecode(''), jdecode('%2F19321%2Findex.html'), 'true',[ 
		['PAGE','19320',jdecode('Read+Guestbook'),jdecode(''), jdecode('%2F19321%2F19320.html'), 'false',[],'','']
	],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='NewYork';
theSitetree.paletteFamily='006666';
theSitetree.keyvisualId='970';
theSitetree.keyvisualName='delphinschwimmer.jpg';
theSitetree.fontsetId='168';
theSitetree.graphicsetId='198';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'mitdnz',
  product: 'WSCSYSSSSLYTC22A'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'NewYork',
				paletteFamily: 	'006666',
				keyvisualId: 	'970',
				keyvisualName: 	'delphinschwimmer.jpg',
				fontsetId: 		'168',
				graphicsetId: 	'198',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'003333',
				b_color: 		'006666',
				c_color: 		'000000',
				d_color: 		'009999',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4598',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-19321avec10in2gz4']={
webappId:    '1002',
documentId:  '19321',
internalId:  '19321avec10in2gz4',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-2189']={
webappId:    '7008',
documentId:  '4655',
internalId:  '2189',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4598',
internalId:  '',
customField: '20090804-192045'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6330',
internalId:  '',
customField: '20110824-180055'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7084',
internalId:  '',
customField: '20110823-210706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7111',
internalId:  '',
customField: '20110530-220421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41301',
internalId:  '',
customField: '20110530-220837'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11603',
internalId:  '',
customField: '20110614-222244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6303',
internalId:  '',
customField: '20111205-210347'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68201',
internalId:  '',
customField: '20110619-190020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25501',
internalId:  '',
customField: '20090225-130409'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43101',
internalId:  '',
customField: '20110530-220957'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11841',
internalId:  '',
customField: '20110530-215554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13226',
internalId:  '',
customField: '20110829-225454'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32501',
internalId:  '',
customField: '20090821-002008'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4655',
internalId:  '',
customField: '20100829-214242'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19321',
internalId:  '',
customField: '20061106-195549'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19320',
internalId:  '',
customField: '20061106-195549'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64501',
internalId:  '',
customField: '20110209-192612'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2GZ4';
var companyName   = 'ASHBURTON+COMMUNITY+POOL';
var htmlTitle	  = 'www.ashburtoncommunitypool.co.nz';
var metaKeywords  = 'swimming%3B+water%3B+pool%3B+aqua%3B+';
var metaContents  = 'The+only+year-round+public+swimming+facility+in+the+Ashburton+District%21';
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();
};

