/* [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','1801',jdecode('Home'),jdecode(''), jdecode('%2F1801.html'), 'true',[],'',''],
	['PAGE','1852',jdecode('Paul+Hill+-+Chilli'),jdecode(''), jdecode('%2F1852.html'), 'true',[],'',''],
	['PAGE','91601',jdecode('Jon+gidlow'),jdecode(''), jdecode('%2F91601.html'), 'true',[],'',''],
	['PAGE','114101',jdecode('William+J.+Wood'),jdecode(''), jdecode('%2F114101.html'), 'true',[],'',''],
	['PAGE','1878',jdecode('Frame+Service'),jdecode(''), jdecode('%2F1878.html'), 'true',[],'',''],
	['PAGE','1904',jdecode('Gifts'),jdecode(''), jdecode('%2F1904.html'), 'true',[],'',''],
	['PAGE','1930',jdecode('More+about+us'),jdecode(''), jdecode('%2F1930%2Findex.html'), 'true',[ 
		['PAGE','1956',jdecode('Contact+Us'),jdecode(''), jdecode('%2F1930%2F1956.html'), 'true',[],'',''],
		['PAGE','1982',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F1930%2F1982.html'), 'true',[],'',''],
		['PAGE','2008',jdecode('Various+Links'),jdecode(''), jdecode('%2F1930%2F2008.html'), 'true',[],'','']
	],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Metal';
theSitetree.paletteFamily='9E9E9E';
theSitetree.keyvisualId='720';
theSitetree.keyvisualName='mixgetraenk.jpg';
theSitetree.fontsetId='144';
theSitetree.graphicsetId='155';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'GB'
};
var prodDef={
  wl_name: 'easily_co_uk',
  product: 'WSCSYSSSSLY0XVDX'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Metal',
				paletteFamily: 	'9E9E9E',
				keyvisualId: 	'720',
				keyvisualName: 	'mixgetraenk.jpg',
				fontsetId: 		'144',
				graphicsetId: 	'155',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'9E9E9E',
				b_color: 		'E8EAEE',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-4735']={
webappId:    '7008',
documentId:  '1956',
internalId:  '4735',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20120123-173542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1852',
internalId:  '',
customField: '20110818-180244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1878',
internalId:  '',
customField: '20090619-171942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1904',
internalId:  '',
customField: '20090815-075421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '114101',
internalId:  '',
customField: '20111102-112702'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1930',
internalId:  '',
customField: '20090812-221500'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1956',
internalId:  '',
customField: '20090520-163538'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1982',
internalId:  '',
customField: '20090712-105150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2008',
internalId:  '',
customField: '20091111-202752'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '91601',
internalId:  '',
customField: '20110818-180719'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN3CID';
var companyName   = 'Venue+Xpresso';
var htmlTitle	  = 'Venue+Xpresso++++Cafe++and+Art+Gallery++++++Alcester%2C+UK';
var metaKeywords  = 'coffee+art++local+talent+++gallery++food++Alcester+tourism+framing+tea+cake+gifts+cards+artists+jewellery+market+town+Whittards+';
var metaContents  = 'It%E2%80%99s+more+than+just+an+inviting+place+to+drop+in+and+linger+over+a+seriously+good+cup+of+coffee%3B+it%E2%80%99s+an+original+art+gallery+too.+Local+talent+producing+everything+from+unique+art+to+individual+jewellery.';
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();
};

