/* [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','5001',jdecode('Home'),jdecode(''),'/5001.html','true',[],'',''],
	['PAGE','5078',jdecode('Fixed+Fee+Services'),jdecode(''),'/5078.html','true',[],'',''],
	['PAGE','5130',jdecode('Expatriate+Services'),jdecode(''),'/5130.html','true',[],'',''],
	['PAGE','11101',jdecode('FREE+Tax+Check'),jdecode(''),'/11101.html','true',[],'',''],
	['PAGE','5104',jdecode('Company+Profile'),jdecode(''),'/5104.html','true',[],'',''],
	['PAGE','5156',jdecode('Clients+say+........'),jdecode(''),'/5156.html','true',[],'',''],
	['PAGE','11701',jdecode('Details+for+Tax+Return'),jdecode(''),'/11701.html','true',[],'',''],
	['PAGE','5182',jdecode('Contact+us'),jdecode(''),'/5182.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Ragtime';
theSitetree.paletteFamily='DD8C85';
theSitetree.keyvisualId='3597';
theSitetree.keyvisualName='kv_3597.jpg';
theSitetree.fontsetId='10737';
theSitetree.graphicsetId='10851';
theSitetree.contentColor='72564C';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Ragtime',
				paletteFamily: 	'DD8C85',
				keyvisualId: 	'3597',
				keyvisualName: 	'kv_3597.jpg',
				fontsetId: 		'10737',
				graphicsetId: 	'10851',
				contentColor: 	'72564C',
				contentBGColor: 'FFFFFF',
				a_color: 		'DD8C85',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'7D7E7D',
				e_color: 		'AB6A65',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20110411-152141'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5182',
internalId:  '',
customField: '20100408-181804'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5078',
internalId:  '',
customField: '20110411-152251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5130',
internalId:  '',
customField: '20110411-152339'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5104',
internalId:  '',
customField: '20110411-152502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5156',
internalId:  '',
customField: '20110411-152542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11101',
internalId:  '',
customField: '20110411-152415'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11701',
internalId:  '',
customField: '20110411-152852'
};
webappMappings['7008']=webappMappings['7008-7142']={
webappId:    '7008',
documentId:  '5182',
internalId:  '7142',
customField: 'language:en;country:GB;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT30IN3G1K';
var companyName   = 'TAX+EXPRESS+-+your+tax+made+easier%21';
var htmlTitle	  = 'TAX+EXPRESS+for+Fixed+Fee+Self+Assessment+tax+returns.++Your+tax+made+easier%21';
var metaKeywords  = 'self+assessment%2C+self-assessment%2C+self%2C+assessment%2C+assessments%2C+income%2C+tax%2C+income+tax%2C+capital+gains+tax%2C+capital+gain%2C+inheritance+tax%2C+inheritance%2C+Inland+Revenue%2C+inland%2C+revenue%2C+Inspector+of+Taxes%2C+tax+inspector%2C+tax+penalty%2C+tax+surcharge%2C+surcharge%2C+overseas+tax%2C+expatriate+tax%2C+expatriate%2C+schedule+A%2C+schedule+D%2C+tax+return%2C+tax+returns%2C+returns%2C+self%2C+assessment%2C+self-assessment%2C+self%2C+assessment%2C+assessments%2C+UK+tax%2C+tax+help%2C+tax+consultant%2C+tax+consultants%2C+consultant%2C+accountant%2C+tax+accountant%2C+tax+accountants%2C+chartered+accountant%2C+chartered+accountants%2C+tax+service%2C+tax+services%2C+fixed+fee+tax+service%2C+fixed+fee+tax+services%2C+PAYE%2C+business%2C+business+tax%2C+self+assessment%2C+self-assessment%2C+self%2C+assessment%2C+assessments%2C+tax+agent%2C+tax+agents%2C+agent%2C+agents%2C+BUsiness+tax%2C+Tax+Help%2C+tax+help%2C+help+your+self+tax%2C+Tax+Consultants%2C+Counsultants+Tax%2C+Accountant+and+tax%2C+Tax+Accountant%2C+Income+Tax%2C+Self+Assesment%2C+Self-Assesment%2C+Self-assesment+tax%2C+self+assesment+tax+forms%2C+fixed+fee';
var metaContents  = 'The+simple%2C+quick%2C+no+frills+Self+Assessment+tax+return+service.++Fixed+Fees+from+just+%C2%A339+with+our+Earlybird+special+offer.++Your+tax+made+easier%21';
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();
};

