/* [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','1001',jdecode('Home'),jdecode(''), jdecode('%2F1001.html'), 'true',[],'',''],
	['PAGE','1052',jdecode('About+us'),jdecode(''), jdecode('%2F1052%2Findex.html'), 'true',[ 
		['PAGE','1073',jdecode('The+team'),jdecode(''), jdecode('%2F1052%2F1073.html'), 'true',[],'',''],
		['PAGE','36823',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F1052%2F36823.html'), 'false',[],'','']
	],'',''],
	['PAGE','1220',jdecode('Contact+Info'),jdecode(''), jdecode('%2F1220%2Findex.html'), 'true',[ 
		['PAGE','1241',jdecode('Phone+%26+E-mail+Details'),jdecode(''), jdecode('%2F1220%2F1241.html'), 'true',[],'','']
	],'',''],
	['PAGE','37223',jdecode('Bike+Fit+Studio'),jdecode(''), jdecode('%2F37223.html'), 'true',[],'',''],
	['PAGE','37244',jdecode('Testing+Lab'),jdecode(''), jdecode('%2F37244.html'), 'true',[],'',''],
	['PAGE','1094',jdecode('Programes'),jdecode(''), jdecode('%2F1094%2Findex.html'), 'true',[ 
		['PAGE','1115',jdecode('Pro+Package'),jdecode(''), jdecode('%2F1094%2F1115.html'), 'true',[],'',''],
		['PAGE','1136',jdecode('Standard+Package'),jdecode(''), jdecode('%2F1094%2F1136.html'), 'true',[],'',''],
		['PAGE','1157',jdecode('Budget+Package'),jdecode(''), jdecode('%2F1094%2F1157.html'), 'true',[],'',''],
		['PAGE','9501',jdecode('Custom+Package'),jdecode(''), jdecode('%2F1094%2F9501.html'), 'true',[],'','']
	],'',''],
	['PAGE','1178',jdecode('Other+Services'),jdecode(''), jdecode('%2F1178.html'), 'true',[],'',''],
	['PAGE','1283',jdecode('Tips+%26+Tricks'),jdecode(''), jdecode('%2F1283.html'), 'true',[],'',''],
	['PAGE','23201',jdecode('Photos+'),jdecode(''), jdecode('%2F23201.html'), 'false',[],'',''],
	['PAGE','39323',jdecode('Special+offer'),jdecode(''), jdecode('%2F39323.html'), 'false',[],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Valiant';
theSitetree.paletteFamily='D43F3F';
theSitetree.keyvisualId='9814';
theSitetree.keyvisualName='kv_9814.jpg';
theSitetree.fontsetId='17626';
theSitetree.graphicsetId='13031';
theSitetree.contentColor='646464';
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: 			'Valiant',
				paletteFamily: 	'D43F3F',
				keyvisualId: 	'9814',
				keyvisualName: 	'kv_9814.jpg',
				fontsetId: 		'17626',
				graphicsetId: 	'13031',
				contentColor: 	'646464',
				contentBGColor: 'FFFFFF',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['1501']=webappMappings['1501-3870555']={
webappId:    '1501',
documentId:  '1001',
internalId:  '3870555',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1001',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-81d87d189a60f9165f41e916ac20bd74']={
webappId:    '7060',
documentId:  '23201',
internalId:  '81d87d189a60f9165f41e916ac20bd74',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1001',
internalId:  '',
customField: '20120110-001929'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37223',
internalId:  '',
customField: '20111223-175031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1052',
internalId:  '',
customField: '20120110-002405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1220',
internalId:  '',
customField: '20111223-174715'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1241',
internalId:  '',
customField: '20111223-174858'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1073',
internalId:  '',
customField: '20110208-004853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1094',
internalId:  '',
customField: '20111223-175303'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1115',
internalId:  '',
customField: '20111223-175530'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1136',
internalId:  '',
customField: '20111223-175802'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1157',
internalId:  '',
customField: '20111223-175907'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9501',
internalId:  '',
customField: '20111223-180008'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1178',
internalId:  '',
customField: '20111223-180231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36823',
internalId:  '',
customField: '20110207-203352'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1283',
internalId:  '',
customField: '20110208-043217'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23201',
internalId:  '',
customField: '20110208-043247'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37244',
internalId:  '',
customField: '20111223-175207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39323',
internalId:  '',
customField: '20110208-043453'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN3U4S';
var companyName   = 'WWW.PROTRAIN.CO.NZ';
var htmlTitle	  = 'PROTRAIN+-+Professional+Training%2C+Bike+Fit+Studio%2C+Testing+Lab.+%28Professional+Personal+Cycling+Coaching%29';
var metaKeywords  = 'Protrain%2C+Coach%2C+Bike+coach%2C+Personal+trainer%2C+Professional+training%2C+cycling%2C+New+Zealand%2C+Christchurch%2C+Training%2C+coaching%2C+riding%2C+bike+skills%2C+bike+wash%2C+racing+coach%2C+road%2C+track%2C+mountain+bike%2C+triathalon%2C+multi-sport%2C+bike+setup%2C+massage%2C+Steve%2C+Elden%2C+Steven%2C+Stephen+Elden%2C+Le+Race%2C+brunner%2C+Wellington%2C+Festival+of+cycling%2C+taupo+training%2C+lactate%2C+vo2+max%2C+Cycling%2C+bike+race%2C+pro%2C+train%2C+manager%2C+Bike+NZ%2C+hills%2C+sprint%2C+power%2C+power+meter%2C+fast%2C+news%2C+info%2C+Le+Race%2C+foc%2C+Festival+of+Cycling%2C+Around+Brunner%2C+Taupo+Challenge%2C+fun+ride%2C+pro+train%2C+pro-train%2C+cyclist%2C+Akaroa%2C+Auckland%2C+NZ%2C+Training+Schedual%2C+km%2C+100km%2C+160km%2C+80km%2C+want+personalized+training+programs...%3F%2C+weekly+programs%2C+seminars%2C+training+camps%2C+testing%2C+0274778673%2C+PT%2C+video%2C+power%2C+rehab%2C+Bike+fit%2C+body%2C+assessment%2C+studio%2C+lactate+and+power+testing%2C+lab%2C+Wellington.+Book+now%2C+Elden%2C+Mico-Revolution+Racing%2C+bike+set+up%2C+ISAK%2C+Exercise+Science%2C+bike+fit+New+Zealand%2C';
var metaContents  = 'Professional+expert+cycling+coach.+Bike+Fit+Studio+and+Lactate+Testing+Lab+in+Wellington%2C+covering+all+over+New+Zealand.+View+our+site+and+get+your+custom+training+program+and+riding+skills+for+you+next+big+cycling+event.+Protrain+includes+Training+programs+for+cycling+events.+';
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();
};

