/* [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','5901',jdecode('Home'),jdecode(''), jdecode('%2F5901.html'), 'true',[],'',''],
	['PAGE','6056',jdecode('About+Us'),jdecode(''), jdecode('%2F6056%2Findex.html'), 'true',[ 
		['PAGE','56601',jdecode('The+Principal'),jdecode(''), jdecode('%2F6056%2F56601.html'), 'true',[],'','']
	],'',''],
	['PAGE','5978',jdecode('News'),jdecode(''), jdecode('%2F5978.html'), 'true',[],'',''],
	['PAGE','5952',jdecode('Services'),jdecode(''), jdecode('%2F5952%2Findex.html'), 'true',[ 
		['PAGE','30801',jdecode('Ecological+Surveys+'),jdecode(''), jdecode('%2F5952%2F30801.html'), 'true',[],'',''],
		['PAGE','43501',jdecode('Ecological+Impact+Assessment'),jdecode(''), jdecode('%2F5952%2F43501.html'), 'true',[],'',''],
		['PAGE','80001',jdecode('Expert+Witness'),jdecode(''), jdecode('%2F5952%2F80001.html'), 'true',[],'',''],
		['PAGE','43527',jdecode('Habitat+Management+Plans'),jdecode(''), jdecode('%2F5952%2F43527.html'), 'true',[],'',''],
		['PAGE','76801',jdecode('Habitat+%26+Species+Monitoring'),jdecode(''), jdecode('%2F5952%2F76801.html'), 'true',[],'',''],
		['PAGE','43553',jdecode('Research+and+Education'),jdecode(''), jdecode('%2F5952%2F43553.html'), 'true',[],'',''],
		['PAGE','43579',jdecode('Ecological+Clerk+of+Works'),jdecode(''), jdecode('%2F5952%2F43579.html'), 'true',[],'','']
	],'',''],
	['PAGE','95001',jdecode('Clients'),jdecode(''), jdecode('%2F95001.html'), 'true',[],'',''],
	['PAGE','6004',jdecode('Contact+Details'),jdecode(''), jdecode('%2F6004.html'), 'true',[],'',''],
	['PAGE','43605',jdecode('Publications'),jdecode(''), jdecode('%2F43605.html'), 'true',[],'',''],
	['PAGE','43001',jdecode('Photographs'),jdecode(''), jdecode('%2F43001.html'), 'true',[],'',''],
	['PAGE','6030',jdecode('Blog'),jdecode(''), jdecode('%2F6030.html'), 'true',[],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Padma';
theSitetree.paletteFamily='507979';
theSitetree.keyvisualId='1021';
theSitetree.keyvisualName='seerose.jpg';
theSitetree.fontsetId='178';
theSitetree.graphicsetId='215';
theSitetree.contentColor='003333';
theSitetree.contentBGColor='B2B285';
var localeDef={
  language: 'en',
  country: 'GB'
};
var prodDef={
  wl_name: 'easily_co_uk',
  product: 'WSCSYSSSSLY0XVDH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Padma',
				paletteFamily: 	'507979',
				keyvisualId: 	'1021',
				keyvisualName: 	'seerose.jpg',
				fontsetId: 		'178',
				graphicsetId: 	'215',
				contentColor: 	'003333',
				contentBGColor: 'B2B285',
				a_color: 		'507979',
				b_color: 		'003333',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7050']=webappMappings['7050-1342']={
webappId:    '7050',
documentId:  '6030',
internalId:  '1342',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5901',
internalId:  '',
customField: '20110329-155116'
};
webappMappings['7060']=webappMappings['7060-e5fb98e9045c231a4fe621467f6a9d3d']={
webappId:    '7060',
documentId:  '43001',
internalId:  'e5fb98e9045c231a4fe621467f6a9d3d',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6056',
internalId:  '',
customField: '20110519-123244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5978',
internalId:  '',
customField: '20110519-123929'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5952',
internalId:  '',
customField: '20110516-170107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30801',
internalId:  '',
customField: '20081125-125012'
};
webappMappings['7008']=webappMappings['7008-2925']={
webappId:    '7008',
documentId:  '6004',
internalId:  '2925',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6004',
internalId:  '',
customField: '20110516-170157'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43001',
internalId:  '',
customField: '20110516-170932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6030',
internalId:  '',
customField: '20090701-110419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43605',
internalId:  '',
customField: '20110519-125145'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56601',
internalId:  '',
customField: '20110519-123435'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43501',
internalId:  '',
customField: '20081124-155005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43527',
internalId:  '',
customField: '20110519-124306'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43553',
internalId:  '',
customField: '20110519-124731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43579',
internalId:  '',
customField: '20110519-124849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '76801',
internalId:  '',
customField: '20110519-124611'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '80001',
internalId:  '',
customField: '20090626-171834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95001',
internalId:  '',
customField: '20110516-165301'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INEDEU';
var companyName   = 'Natural+Resource+Consultancy';
var htmlTitle	  = 'Natural+Resource+Consultancy';
var metaKeywords  = 'Ecological+Impact+Assessment%2C+Ecological+Surveys%2C+Bryophytes+of+Ancient+Woods%2C+Phase+1+Habitat+Survey%2C+NVC%2C+National+Vegetation+Classification%2C+Woodland+Surveys%2C+Habitat+Management+Plans%2C+Ecological+Monitoring%2C+Ancient+Woodland+Indicator+Plants%2C++Ecological+Clerk+of+Works%2C+Expert+Witness%0D%0A%0D%0ACo-ordination%2C+Project+management%2C+Ecological+Publications+and+Education+';
var metaContents  = 'Ecological+Services+in+Scotland';
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();
};

