/* [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','1701',jdecode('HOME+PAGE'),jdecode(''),'/1701.html','true',[],'',''],
	['PAGE','1815',jdecode('Properties+Available'),jdecode(''),'/1815/index.html','true',[ 
		['PAGE','7222',jdecode('Christchurch'),jdecode(''),'/1815/7222.html','true',[],'',''],
		['PAGE','7201',jdecode('Hanmer+Springs'),jdecode(''),'/1815/7201.html','true',[],'',''],
		['PAGE','1836',jdecode('Lake+Tekapo'),jdecode(''),'/1815/1836.html','true',[],'','']
	],'',''],
	['PAGE','9901',jdecode('Pricing%3A'),jdecode(''),'/9901.html','true',[],'',''],
	['PAGE','9943',jdecode('Booking+Enquiries'),jdecode(''),'/9943.html','true',[],'',''],
	['PAGE','19101',jdecode('About+Us'),jdecode(''),'/19101.html','true',[],'',''],
	['PAGE','19201',jdecode('Guestbook'),jdecode(''),'/19201.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Office';
theSitetree.paletteFamily='B85454';
theSitetree.keyvisualId='11160';
theSitetree.keyvisualName='kv_11160.jpg';
theSitetree.fontsetId='32062';
theSitetree.graphicsetId='13878';
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: 	'B85454',
				keyvisualId: 	'11160',
				keyvisualName: 	'kv_11160.jpg',
				fontsetId: 		'32062',
				graphicsetId: 	'13878',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1701',
internalId:  '',
customField: '20100801-030122'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9943',
internalId:  '',
customField: '20091215-202527'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9901',
internalId:  '',
customField: '20100801-013101'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19201',
internalId:  '',
customField: '20100618-021316'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1815',
internalId:  '',
customField: '20100801-021220'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1836',
internalId:  '',
customField: '20100724-000409'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7201',
internalId:  '',
customField: '20091124-023818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7222',
internalId:  '',
customField: '20100825-165737'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19101',
internalId:  '',
customField: '20100130-050859'
};
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INHF8C';
var companyName   = 'KIWIHOLIDAYHOUSES.CO.NZ+%28Kiwi+Investment+Properties+Chch+Limited%29';
var htmlTitle	  = 'kiwiholidayhouses.co.nz';
var metaKeywords  = 'Kiwi+Holiday+Houses%2C+New+Zealand%2C+Holiday%2C+Homes%2C+Accommodation%2C+Bach%2C+Rental%2C+Holiday+Homes%2C+Tekapo%2C+Hanmer+Springs%2C+Christchurch%2C+Hanmer+holiday+homes%2C+Tekapo+holiday+homes%2C+fully+furnished%2C+bookabach%2C+kiwi+holiday+homes%2C+travel%2C+thermal+pools%2C+skiing%2C+boating%2C+crib%2Choliday%2C+kiwigetaway%2CLake+tekapo+accommodation%2CHanmer+accommodation%2Ctakeabreak%2Cgetaway%2Cnz.com%2C+new+zealand+tourism%2C+New+Zealand%2C+pet+vacations%2C+pets+on+holiday%2C+pets+friendly%2C+pets+accommodation%2C+pet+friendly+holiday+houses%2C+nztourism%2C+vacation%2C+holiday+break%2C+takeabreak%2C+hotels%2C+motels%2C+holiday+parks%2C+New+Zealand+holiday+homes%2C+New+Zealand+holiday+houses%2Choliday%2C+bed+%26+breakfast%2C+resort%2C+bookabach%2Ctakeabreak%2Cbachcare%2Cnzholidayhomes%2Ckiwiholidayhomes%2Crental%2Capartment%2C+christchurc%2C+canterbury%2C+lake+tekapo%2C+hanmer+springs%2Crugby+world+cup+2011%2C+rugby+world+cup+accommodation%2CRugby+world+cup+new+zealand';
var metaContents  = 'Kiwi+Holiday+Houses+-+Holiday+Rental+Accommodation+within+New+Zealand+%28Christchurch%2C+Hanmer+Springs+and+Lake+Tekapo%29';
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();
};
