/* [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','10101',jdecode('Home'),jdecode(''),'/10101.html','true',[],'',''],
	['PAGE','10178',jdecode('Sculpture+Gallery'),jdecode(''),'/10178/index.html','true',[ 
		['PAGE','45286',jdecode('Sculpture+Gallery+2'),jdecode(''),'/10178/45286.html','true',[],'','']
	],'',''],
	['PAGE','31857',jdecode('Canvas+Gallery'),jdecode(''),'/31857/index.html','true',[ 
		['PAGE','37951',jdecode('Canvas+Gallery+2'),jdecode(''),'/31857/37951.html','true',[],'',''],
		['PAGE','59990',jdecode('Canvas+Gallery+3'),jdecode(''),'/31857/59990.html','true',[],'','']
	],'',''],
	['PAGE','10204',jdecode('Zimbo+Surfboards'),jdecode(''),'/10204.html','true',[],'',''],
	['PAGE','10230',jdecode('Enquiries'),jdecode(''),'/10230.html','true',[],'',''],
	['PAGE','10256',jdecode('contact'),jdecode(''),'/10256.html','true',[],'',''],
	['PAGE','81352',jdecode('Guestbook'),jdecode(''),'/81352.html','true',[],'',''],
	['PAGE','81552',jdecode('Blog'),jdecode(''),'/81552.html','true',[],'',''],
	['PAGE','70368',jdecode('Links'),jdecode(''),'/70368.html','true',[],'',''],
	['PAGE','78752',jdecode('How+to+find+us'),jdecode(''),'/78752.html','true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='333F65';
theSitetree.keyvisualId='1819';
theSitetree.keyvisualName='kv_dummy.jpg';
theSitetree.fontsetId='292';
theSitetree.graphicsetId='355';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='333F65';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Movement',
				paletteFamily: 	'333F65',
				keyvisualId: 	'1819',
				keyvisualName: 	'kv_dummy.jpg',
				fontsetId: 		'292',
				graphicsetId: 	'355',
				contentColor: 	'FFFFFF',
				contentBGColor: '333F65',
				a_color: 		'333F65',
				b_color: 		'040507',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-3099']={
webappId:    '7008',
documentId:  '10230',
internalId:  '3099',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10101',
internalId:  '',
customField: '20100622-110857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10256',
internalId:  '',
customField: '20090701-104940'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10230',
internalId:  '',
customField: '20090426-114244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10204',
internalId:  '',
customField: '20100330-105329'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '10101',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-8062696']={
webappId:    '1501',
documentId:  '10101',
internalId:  '8062696',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10178',
internalId:  '',
customField: '20100709-110627'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59990',
internalId:  '',
customField: '20100222-124421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37951',
internalId:  '',
customField: '20100610-112505'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31857',
internalId:  '',
customField: '20100709-110956'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45286',
internalId:  '',
customField: '20100709-110822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '70368',
internalId:  '',
customField: '20090928-154110'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '78752',
internalId:  '',
customField: '20100704-145604'
};
webappMappings['7050']=webappMappings['7050-4120']={
webappId:    '7050',
documentId:  '81552',
internalId:  '4120',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '81352',
internalId:  '',
customField: '20100728-120842'
};
webappMappings['1002']=webappMappings['1002-81352anbt20inenm3']={
webappId:    '1002',
documentId:  '81352',
internalId:  '81352anbt20inenm3',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '81552',
internalId:  '',
customField: '20100728-120430'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INENM3';
var companyName   = 'Zimbo++3+Lower+Wharf++Bude++Cornwall++EX23+8LG++++++01288+355448++++++www.zimb0.co.uk';
var htmlTitle	  = 'www.zimb0.co.uk';
var metaKeywords  = 'bude%2Ccornwall%2Csurfboards%2Carts%2Ccrafts%2Cpaint%2Clarge%2Cformat%2Ccanvass%2Cdesign%2Csculpture%2Chandmade%2C+workshop%2Cwharf%2Ccanal%2Cornaments%2Cdisplay%2Cgarden%2Cconservatory%2Chome%2Cfurnishings%2Cmodern%2C+decorative%2Cartistic%2Cgraphics%2Cart%2Cpicture%2Cprints%2Czimbo%2Czimb0%2Cclock%2Cwall%2CfishMETA+name%3Dkeywords+content%3Dart+galleries+cornwall%2Ccontemporary+art+in+cornwall%2Clarge+canvas+artwork%2Ccornwall+art%2Cbuy+modern+art+sculptures%2Cmodern+art+sculptures%2Ccontemporary+abstract+sculpture%2Ccornwall+sculpture%2Ccontemporary+art+and+sculpture%2Ccanvas+art+printing%2Ccanvas+printing+service+uk%2Ccanvas+photo+printing%2Clarge+canvas+prints%2Cart+printers+cornwall%2Ccontemporary+art+print+cornwall%2Clarge+format+printing+canvas%2Cphoto+printing+canvas+uk%2Cmodern+garden+sculpture%2Cgarden+art+uk%2Cgarden+ornaments+cornwall%2Ccontemporary+garden+sculptures%2Cgarden+art%2Cgarden+sculpture+uk%2Csurfboard+design%2Cunusual+surfboard+design%2Csurfboards+cornwall+uk%2C+www.zimb0.co.uk';
var metaContents  = 'Zimbo+sculptures%2C+gallery+and+surfboards+in+Bude+Cornwall.+Wall+clocks+fish+design%2C+flower+vase%2C+interior+and+exterior.+handmade+and+designed+by+us+right+here+in+our+little+workshop..';
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();
};
