/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','573',jdecode('Getting+a+Motorcycle+Licence'),jdecode(''),'/573/index.html','true',[ 
		['PAGE','56236',jdecode('Completing+your+Licence'),jdecode(''),'/573/56236.html','true',[],'','']
	],'',''],
	['PAGE','594',jdecode('Training+Courses'),jdecode(''),'/594.html','true',[],'',''],
	['PAGE','70805',jdecode('Course+Dates'),jdecode(''),'/70805.html','true',[],'',''],
	['PAGE','52901',jdecode('F.+A.+Q.+%26%23x27%3Bs'),jdecode(''),'/52901.html','true',[],'',''],
	['PAGE','678',jdecode('Links'),jdecode(''),'/678.html','true',[],'',''],
	['PAGE','699',jdecode('Bookings+%2F+About+us'),jdecode(''),'/699.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Office';
theSitetree.paletteFamily='727D9C';
theSitetree.keyvisualId='11153';
theSitetree.keyvisualName='kv_11153.jpg';
theSitetree.fontsetId='32065';
theSitetree.graphicsetId='13879';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Office',
				paletteFamily: 	'727D9C',
				keyvisualId: 	'11153',
				keyvisualName: 	'kv_11153.jpg',
				fontsetId: 		'32065',
				graphicsetId: 	'13879',
				contentColor: 	'000000',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-11555116']={
webappId:    '1501',
documentId:  '501',
internalId:  '11555116',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20100828-181014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20100319-210556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20100717-004511'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52901',
internalId:  '',
customField: '20100319-224416'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '70805',
internalId:  '',
customField: '20100828-181221'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '678',
internalId:  '',
customField: '20100724-040005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56236',
internalId:  '',
customField: '20100119-003441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '699',
internalId:  '',
customField: '20100728-022637'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INPJER';
var companyName   = 'RIDER+TRAINING+%28NZ%29';
var htmlTitle	  = 'Rider+Training+NZ+-+Motorcycle+Basic+Handling+Skills+Training+and+Testing';
var metaKeywords  = 'motorcycle%2C+motorbike%2C+motorcycle+lessons%2C+motorcycle+learner%2C+learn+to+ride%2C+Basic+Handling+Course%2C+Learn+to+ride+a+motorcycle%2C+motorbike%2C+class+6%2C+motorcycle+licence%2C+motorbike+licence%2C+motorbike+lessons%2C+learner%2C+dirt+bike%2C+road+bike%2C+BHS%2C+motorcycle+test%2C+licence+test%2C+motorcycle+drivers+licence%2C+motorbike+training%2C+rider+training%2C+Motorbike+North+Shore%2C+motorcycle+north+shore%2C+bike+licence+auckland%2C+licence+albany%2C+motorcycle+licence+auckland%2C+motorcycle+licence+north+shore%2C+motorbike+bhs+auckland%2C+motorbike+kearner%2C+ride+a+motorbike%2C+motorbike+lessons%2C+motorbike+licence%2C+motorbike+license%2C+motorcycle+albany%2C+NZTA%2C+LTNZ%2C+LTSA.';
var metaContents  = 'Learn+to+ride+a+Motorcycle.++Basic+Handling+Skills+Test.++Patient+Female+NZTA+approved+Motorcycle+Instructor+based+on+the+North+Shore+in+Albany%2C+Auckland.++';
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();
};
