/* [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','1446',jdecode('Home'),jdecode(''),'/1446.html','true',[],'',''],
	['PAGE','1467',jdecode('The+Begining'),jdecode(''),'/1467.html','true',[],'',''],
	['PAGE','1701',jdecode('About+The+Business'),jdecode(''),'/1701.html','true',[],'',''],
	['PAGE','1520',jdecode('Guestbook'),jdecode(''),'/1520.html','false',[],'',''],
	['PAGE','1727',jdecode('Website+%26+Clients'),jdecode(''),'/1727.html','true',[],'',''],
	['PAGE','1488',jdecode('Gallery'),jdecode(''),'/1488.html','false',[],'',''],
	['PAGE','3501',jdecode('Gallery'),jdecode(''),'/3501.html','true',[],'',''],
	['PAGE','1541',jdecode('Contact'),jdecode(''),'/1541.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Application';
theSitetree.paletteFamily='8C3333';
theSitetree.keyvisualId='10314';
theSitetree.keyvisualName='kv_10314.jpg';
theSitetree.fontsetId='21212';
theSitetree.graphicsetId='13308';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='A9C7D0';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Application',
				paletteFamily: 	'8C3333',
				keyvisualId: 	'10314',
				keyvisualName: 	'kv_10314.jpg',
				fontsetId: 		'21212',
				graphicsetId: 	'13308',
				contentColor: 	'000000',
				contentBGColor: 'A9C7D0',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-4e2b72f0e60c43761bf9166c2daaa33e']={
webappId:    '7060',
documentId:  '1488',
internalId:  '4e2b72f0e60c43761bf9166c2daaa33e',
customField: 'language:en;country:GB;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1446',
internalId:  '1006',
customField: '1006'
};
webappMappings['7002']=webappMappings['7002-3829']={
webappId:    '7002',
documentId:  '1520',
internalId:  '3829',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-7641']={
webappId:    '7008',
documentId:  '1541',
internalId:  '7641',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1446',
internalId:  '',
customField: '20100802-110638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1467',
internalId:  '',
customField: '20100812-112024'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1488',
internalId:  '',
customField: '20100802-110845'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3501',
internalId:  '',
customField: '20100812-111759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1520',
internalId:  '',
customField: '20100728-120926'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1541',
internalId:  '',
customField: '20100802-110748'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1701',
internalId:  '',
customField: '20100812-114037'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1727',
internalId:  '',
customField: '20100802-110709'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT30IN3I0N';
var companyName   = 'The+Furniture+Store';
var htmlTitle	  = 'The+Furniture+Store';
var metaKeywords  = 'furniture+store+shop+for+sale+4+sale+costa+calida+murcia+spain+profitable+business+for+sale+going+concern+business+for+sale+in+spain+business+4+sale+in+spain';
var metaContents  = 'furniture+store+shop+for+sale+4+sale+costa+calida+murcia+spain+profitable+business+for+sale+going+concern+business+for+sale+in+spain+business+4+sale+in+spain';
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();
};
