/* [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(''), jdecode('%2F5001.html'), 'true',[],'',''],
	['PAGE','5052',jdecode('Services'),jdecode(''), jdecode('%2F5052.html'), 'true',[],'',''],
	['PAGE','5078',jdecode('Products'),jdecode(''), jdecode('%2F5078.html'), 'true',[],'',''],
	['PAGE','5104',jdecode('About+Us'),jdecode(''), jdecode('%2F5104%2Findex.html'), 'true',[ 
		['PAGE','5156',jdecode('Our+Team'),jdecode(''), jdecode('%2F5104%2F5156.html'), 'true',[],'',''],
		['PAGE','5130',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F5104%2F5130.html'), 'true',[],'','']
	],'',''],
	['PAGE','13601',jdecode('Directories'),jdecode(''), jdecode('%2F13601.html'), 'true',[],'',''],
	['PAGE','5182',jdecode('Contact+Us'),jdecode(''), jdecode('%2F5182.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Corporate';
theSitetree.paletteFamily='5F8AA9';
theSitetree.keyvisualId='11070';
theSitetree.keyvisualName='kv_11070.jpg';
theSitetree.fontsetId='31953';
theSitetree.graphicsetId='13792';
theSitetree.contentColor='888D92';
theSitetree.contentBGColor='FFFFFF';
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: 			'Corporate',
				paletteFamily: 	'5F8AA9',
				keyvisualId: 	'11070',
				keyvisualName: 	'kv_11070.jpg',
				fontsetId: 		'31953',
				graphicsetId: 	'13792',
				contentColor: 	'888D92',
				contentBGColor: 'FFFFFF',
				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['7008']=webappMappings['7008-5258']={
webappId:    '7008',
documentId:  '5182',
internalId:  '5258',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20111011-123740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5052',
internalId:  '',
customField: '20111011-125008'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5078',
internalId:  '',
customField: '20110325-210639'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5104',
internalId:  '',
customField: '20111011-124140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5130',
internalId:  '',
customField: '20110325-213216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5156',
internalId:  '',
customField: '20110325-212432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5182',
internalId:  '',
customField: '20111011-124805'
};
webappMappings['1501']=webappMappings['1501-10423546']={
webappId:    '1501',
documentId:  '5001',
internalId:  '10423546',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13601',
internalId:  '',
customField: '20111011-124827'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN3046';
var companyName   = 'Wednesfield+Computing+Limited';
var htmlTitle	  = 'Wednesfield+Computing+Limited';
var metaKeywords  = 'wednesfield+computing%2Ccomputers%2Cpc+repair%2Ccomputer+repair+wolverhampton%2Cwest+midlands%2Ccomputer+repair%2Ccomputer+sales%2Ccomputer+build%2Cwebcams%2Cprinters%2Cchargers%2Claptop+chargers%2Ccables%2Cwindows%2Cmicrosft%2Cvista%2Cwindows+7%2Cbudget+computers%2Cgaming+pcs%2Cvirus+removal%2Csupport%2Cactive+directory%2Chard+drives%2Cmonitors%2Ckeyboards%2Cmice%2Cprinters%2Cserver+2003';
var metaContents  = 'Wednesfield+Computing+Limited+can+provide+all+of+your+computing++IT+needs.+Our+highly+skilled+Microsoft+Professional+can+provide+you+with+help+and+advice+at+our+offices%2C+at+your+home+or+at+your+business.+We+specialise+in+New+Computer+Builds%2C+Computer+Repairs+and+Servicing%2C+Full+Diagnostic+Reporting+and+Active+Directory+Troubleshooting.+We+can+supply+Hard+Drives%2C+Monitors%2C+Motherboards%2C+Keyboards%2C+USB+Devices%2C+Ink+Cartridges+and+all+other+Computer+Consumables.+We+also+offer+Long+Term+Support+and+Maintenance+Contracts+to+small+businesses.';
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();
};

