/* [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','1501',jdecode('Home'),jdecode(''),'/1501.html','true',[],'',''],
	['PAGE','6001',jdecode('David+and+Linda'),jdecode(''),'/6001.html','true',[],'',''],
	['PAGE','6022',jdecode('Justin+and+Mandy'),jdecode(''),'/6022.html','true',[],'',''],
	['PAGE','6043',jdecode('Keith'),jdecode(''),'/6043.html','true',[],'',''],
	['PAGE','6064',jdecode('Tim+and+Caroline'),jdecode(''),'/6064.html','true',[],'',''],
	['PAGE','6085',jdecode('Computer+services'),jdecode(''),'/6085.html','true',[],'',''],
	['PAGE','6106',jdecode('Services+offered'),jdecode(''),'/6106.html','true',[],'',''],
	['PAGE','6148',jdecode('News'),jdecode(''),'/6148.html','true',[],'',''],
	['PAGE','6169',jdecode('Developments'),jdecode(''),'/6169.html','true',[],'',''],
	['PAGE','6127',jdecode('Blogs'),jdecode(''),'/6127.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Finance';
theSitetree.paletteFamily='F3EBF5';
theSitetree.keyvisualId='2732';
theSitetree.keyvisualName='computer.jpg';
theSitetree.fontsetId='10412';
theSitetree.graphicsetId='10673';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Finance',
				paletteFamily: 	'F3EBF5',
				keyvisualId: 	'2732',
				keyvisualName: 	'computer.jpg',
				fontsetId: 		'10412',
				graphicsetId: 	'10673',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'F3EBF5',
				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:  '1501',
internalId:  '',
customField: '20100808-174145'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6001',
internalId:  '',
customField: '20100820-172443'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6022',
internalId:  '',
customField: '20100820-172523'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6043',
internalId:  '',
customField: '20100820-172623'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6064',
internalId:  '',
customField: '20100808-173605'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6085',
internalId:  '',
customField: '20080126-122127'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6106',
internalId:  '',
customField: '20100820-220059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6127',
internalId:  '',
customField: '20090918-211644'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6148',
internalId:  '',
customField: '20100502-152859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6169',
internalId:  '',
customField: '20100622-080047'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1501',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN2WII';
var companyName   = 'The+Parsons+Family+Website';
var htmlTitle	  = 'Parsons+Family+Website';
var metaKeywords  = 'Invention%2C+Inventions%2C+Parsons+Family%2C+Parsons+Family+website%2C+Multi+Light%2C+All+computer+repairs+Seaford+Tel.+01323+896917+David+Parsons+4+PCs%2C+Patent%2C+Rev+David+Parsons%2C+Linda+Parsons%2C+All+computer+repairs+in+Gillingham%2C+Computer+services+in+Gillingham%2C+Computer+repairs%2C+Computer+services%2C+Tim+Parsons%2C+Tim+Parsons+Computer+Services%2C+David+Parsons+4+PCs%2C+All+computer+repairs+seaford%2C+All+computer+services+seaford%2C+All+computer+maintenance+seaford%2C+All+computer+repairs+and+services+seaford%2C+All+PC+repairs+seaford%2C+All+PC+services+seaford%2C+Seaford+computer+services%2C+PC+maintenance+Seaford%2C+Computer+repairs+Seaford+Tel.+01323+896917+David+Parsons+4+PCs';
var metaContents  = 'All+computer+repairs+Seaford+Tel.+01323+896917+David+Parsons+4+PCs%2C+Invention%2C+Parsons+family%2C+Parsons+Family+website%2C+Multi+Light%2C+Patent%2C+All+computer+services%2C+All+computer+repairs%2C+Tim+Parsons%2C+David+Parsons+4+PCs%2C+All+computer+repairs+seaford%2C+All+computer+services+seaford%2C+All+computer+maintenance+seaford%2C+All+computer+repairs+and+services+seaford%2C+All+PC+repairs+seaford%2C+All+PC+services+seaford%2C+All+Seaford+computer+services%2C+All+PC+maintenance+Seaford%2C+Computer+repairs+Seaford+Tel.+01323+896917+David+Parsons+4+PCs';
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();
};
