/* [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','2022',jdecode('HOME'),jdecode(''),'/2022.html','true',[],'',''],
	['PAGE','2073',jdecode('HISTORY'),jdecode(''),'/2073.html','true',[],'',''],
	['PAGE','2094',jdecode('DESIGN'),jdecode(''),'/2094.html','true',[],'',''],
	['PAGE','2115',jdecode('CONSTRUCTION'),jdecode(''),'/2115.html','true',[],'',''],
	['PAGE','14901',jdecode('PRICING'),jdecode(''),'/14901.html','true',[],'',''],
	['PAGE','2157',jdecode('GALLERY'),jdecode(''),'/2157.html','true',[],'',''],
	['PAGE','2178',jdecode('TESTIMONIALS'),jdecode(''),'/2178.html','true',[],'',''],
	['PAGE','32101',jdecode('MOST+RECENT'),jdecode(''),'/32101.html','true',[],'',''],
	['PAGE','38601',jdecode('FAQ'),jdecode(''),'/38601.html','true',[],'',''],
	['PAGE','3001',jdecode('CONTACT+US'),jdecode(''),'/3001.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Handout';
theSitetree.paletteFamily='848485';
theSitetree.keyvisualId='11650';
theSitetree.keyvisualName='kv_11650.jpg';
theSitetree.fontsetId='32945';
theSitetree.graphicsetId='13993';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='848485';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Handout',
				paletteFamily: 	'848485',
				keyvisualId: 	'11650',
				keyvisualName: 	'kv_11650.jpg',
				fontsetId: 		'32945',
				graphicsetId: 	'13993',
				contentColor: 	'000000',
				contentBGColor: '848485',
				a_color: 		'FFFFFF',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2022',
internalId:  '',
customField: '20091019-213637'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2073',
internalId:  '',
customField: '20091019-212917'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2094',
internalId:  '',
customField: '20090429-072416'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2115',
internalId:  '',
customField: '20090324-200935'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2157',
internalId:  '',
customField: '20090317-192246'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3001',
internalId:  '',
customField: '20091030-202236'
};
webappMappings['7008']=webappMappings['7008-4849']={
webappId:    '7008',
documentId:  '3001',
internalId:  '4849',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2178',
internalId:  '',
customField: '20090429-061016'
};
webappMappings['7060']=webappMappings['7060-e983931abe3944c020add1875483a3fd']={
webappId:    '7060',
documentId:  '2094',
internalId:  'e983931abe3944c020add1875483a3fd',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14901',
internalId:  '',
customField: '20090405-213417'
};
webappMappings['7060']=webappMappings['7060-f8f5597032a2c4f56af98f46458d66b1']={
webappId:    '7060',
documentId:  '2115',
internalId:  'f8f5597032a2c4f56af98f46458d66b1',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-956bebc5b9975f0c16074a3fee9eb8cd']={
webappId:    '7060',
documentId:  '2157',
internalId:  '956bebc5b9975f0c16074a3fee9eb8cd',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32101',
internalId:  '',
customField: '20091017-213938'
};
webappMappings['7060']=webappMappings['7060-9ec27f9db5ef5e14b786847ff536434b']={
webappId:    '7060',
documentId:  '32101',
internalId:  '9ec27f9db5ef5e14b786847ff536434b',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38601',
internalId:  '',
customField: '20091019-212659'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INH1DE';
var companyName   = 'Timeless+Beauty+in+a+LOGHOME+Lifestyle';
var htmlTitle	  = 'New+Zealand+LOGHOMES';
var metaKeywords  = 'LOGHOMES%2C+LOGHOUSE%2C+NATURAL+TIMBER+LOGS%2C+LOGS%2C+HANDCRAFTED+LOGHOMES%2C+NZ+LOGHOMES%2CHANDBUILT%2C+WOODEN%2C+LOGHOMES+NZ%2C+RUSTIC%2C+LOG+CABINS%2C+TIMBER%2C+SOLID+TIMBER%2C+TIMELESS+BEAUTY%2C+UNIQUE%2C+NEW+ZEALAND+HOMES%2C+ROTORUA%2C+HANDPEELED%2C+LOG+HOME+INTO+REALITY%2C+POST+AND+BEAM+HOMES%2C+EXPERIENCED+CARPENTERS%2C+LOG+CRAFTSMEN%2C+SKILLED+CRAFTSMEN%2C+SAWN+CEDAR+SHINGLES%2C+SPLIT+SHAKES%2C+LARGE+OPEN+FIREPLACE%2C+LOG+CONSTRUCTION%2C+DOUGLAS+FIR+OR+LAWSON+CYPRESS%2C+LOGWORK+PREPARATION%2C+LOG+PROTECTION+PLAN%2C+PRICE+OF+YOU+NEW+ZEALAND+LOG+HOME%2C+STUNNING+RESULTS+OF+SOME%2C+LOG+CABIN%2C+LOG+BUILDING%2C+PRE-BUILT+HOME%2C+LOG+SHELL%2C';
var metaContents  = 'We+specialize+in+building+exceptional+handcrafted+LOGHOMES.each+crafted+from+the+highest+quality+timber%2C+all+architecturally+designed+and+individually+unique.';
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();
};
