/* [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(''),'/4598.html','true',[],'',''],
	['PAGE','4682',jdecode('Contact'),jdecode(''),'/4682/index.html','true',[ 
		['PAGE','10304',jdecode('Contact+%28follow+up+page%29'),jdecode(''),'/4682/10304.html','false',[],'','']
	],'',''],
	['PAGE','4790',jdecode('Child+Guards'),jdecode(''),'/4790/index.html','true',[ 
		['PAGE','12984',jdecode('Contemporary+Guards'),jdecode(''),'/4790/12984.html','true',[],'',''],
		['PAGE','6700',jdecode('Spark+Guards'),jdecode(''),'/4790/6700.html','true',[],'','']
	],'',''],
	['PAGE','4817',jdecode('Fire+Grates'),jdecode(''),'/4817/index.html','true',[ 
		['PAGE','9239',jdecode('Ashpans'),jdecode(''),'/4817/9239.html','true',[],'',''],
		['PAGE','6808',jdecode('Accessories'),jdecode(''),'/4817/6808.html','true',[],'','']
	],'',''],
	['PAGE','4844',jdecode('Wood+Fires'),jdecode(''),'/4844/index.html','true',[ 
		['PAGE','19201',jdecode('Metrofires'),jdecode(''),'/4844/19201.html','true',[],'',''],
		['PAGE','4871',jdecode('Radiant'),jdecode(''),'/4844/4871.html','true',[],'',''],
		['PAGE','4898',jdecode('Traditional'),jdecode(''),'/4844/4898.html','true',[],'',''],
		['PAGE','4925',jdecode('Pedistal'),jdecode(''),'/4844/4925.html','true',[],'',''],
		['PAGE','4952',jdecode('Insert'),jdecode(''),'/4844/4952.html','true',[],'',''],
		['PAGE','21601',jdecode('Built-In'),jdecode(''),'/4844/21601.html','true',[],'',''],
		['PAGE','4979',jdecode('Other+Brands'),jdecode(''),'/4844/4979.html','true',[],'','']
	],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='AC2323';
theSitetree.keyvisualId='1819';
theSitetree.keyvisualName='kv_dummy.jpg';
theSitetree.fontsetId='289';
theSitetree.graphicsetId='356';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='AC2323';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Movement',
				paletteFamily: 	'AC2323',
				keyvisualId: 	'1819',
				keyvisualName: 	'kv_dummy.jpg',
				fontsetId: 		'289',
				graphicsetId: 	'356',
				contentColor: 	'FFFFFF',
				contentBGColor: 'AC2323',
				a_color: 		'AC2323',
				b_color: 		'480F0F',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4598',
internalId:  '',
customField: '20091122-212510'
};
webappMappings['1501']=webappMappings['1501-683783']={
webappId:    '1501',
documentId:  '4598',
internalId:  '683783',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-4386']={
webappId:    '7008',
documentId:  '4682',
internalId:  '4386',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4598',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4682',
internalId:  '',
customField: '20091122-213902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10304',
internalId:  '',
customField: '20050531-194457'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4790',
internalId:  '',
customField: '20091122-221928'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12984',
internalId:  '',
customField: '20091123-001440'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6700',
internalId:  '',
customField: '20091122-232414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4817',
internalId:  '',
customField: '20091122-235255'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9239',
internalId:  '',
customField: '20061113-185218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6808',
internalId:  '',
customField: '20090901-234738'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4844',
internalId:  '',
customField: '20090907-173053'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4871',
internalId:  '',
customField: '20091123-215207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4898',
internalId:  '',
customField: '20091123-215458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4925',
internalId:  '',
customField: '20091123-220531'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4952',
internalId:  '',
customField: '20091123-220955'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4979',
internalId:  '',
customField: '20091123-223707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19201',
internalId:  '',
customField: '20091123-213937'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21601',
internalId:  '',
customField: '20091123-221110'
};
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2G6H';
var companyName   = '%22Your+Online+Fire+Shop%22';
var htmlTitle	  = 'www.thegrateplace.co.nz';
var metaKeywords  = 'ash+pans%2C+child+guards%2C+child+proof+guards%2C+child+safety+guards%2C+chimney%2C+convection%2C+door+rope+gasket%2C+fire+grates%2C+firegrates%2C+fireplaces%2C+fireplace+accessories%2C+fireplaces+accessories%2C+fireplace+wood+burning%2C+fires%2C+flue+kits%2C+flues%2C+free+standing+fires%2C+free+standing+wood+burners%2C+grates%2C+heaters%2C+heater+parts%2C+heater+spares%2C+inbuilt+fires%2C+inbuilt+wood+burners%2C+inbuilt+woodburners%2C+inbuilt+wood+fires%2C+inbuilt+woodfires%2C+insert+fires%2C+insert+wood+burners%2C+insert+woodburners%2C+insert+wood+fires%2C+insert+woodfires%2C+log+fires%2C+maintenance%2C+open+fires%2C+outdoor%2C+radiant%2C+radiation%2C+repairs%2C+safety+guards%2C+safety+screens%2C+spark+guards%2C+spark+sceens%2C+solid+fuel+fires%2C+solid+fuel+heaters%2C+solid+fuel+heating%2C+stoves%2C+wood+burners%2C+woodburners%2C+wood+burner+fires%2C+wellington%2C+national%2C+nz%2C+new+zealand%2C+nzhha%2C+new+zealand+home+heating+association%2C+fisher+fires%2C+gillies+fires%2C+jayline+fires%2C+magnum+fires%2C+masport+fires%2C+metro+fires%2C+metro+eco%2C+metro+ped%2C++metro+rad%2C+metro+trad%2C+metro+trend%2C+wagener+fairburn%2C+wagener+fires%2C+wagener+stoves%2C+warmington+fires%2C+warmington+stoves%2C+studio+stoves%2C+';
var metaContents  = 'Suppliers+of%2C+Child+Proof+Guards+for+woodfire+and+gas+heaters%2C+Fire+Grates+for+open+fires+-+outdoor+fireplaces+-+multifuel+heaters%2C+Fireplace+Accessories%2C+Heater+Parts%2C+Wood+Burning+Fires%2C+Installation+Service.';
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();
};
