/* [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','52001',jdecode('Welcome'),jdecode(''), jdecode('%2F52001.html'), 'true',[],'',''],
	['ITEM','47501',jdecode('+LOCAL+BUSINESSES+'),jdecode(''), jdecode('http%3A%2F%2Fsussexviewsdirectory.co.uk%2F'), 'true',[],'','_blank'],
	['PAGE','56101',jdecode('Website+Rates'),jdecode(''), jdecode('%2F56101.html'), 'true',[],'',''],
	['PAGE','1901',jdecode('About+the+Magazine'),jdecode(''), jdecode('%2F1901.html'), 'true',[],'',''],
	['ITEM','68201',jdecode('View+Latest+Magazines'),jdecode(''), jdecode('http%3A%2F%2Fissuu.com%2Fsussexviewsmagazine%2Fdocs'), 'true',[],'','_blank'],
	['PAGE','2201',jdecode('+Magazine++Rates'),jdecode(''), jdecode('%2F2201.html'), 'true',[],'',''],
	['PAGE','39601',jdecode('Editorial+Opportunities'),jdecode(''), jdecode('%2F39601.html'), 'true',[],'',''],
	['PAGE','17601',jdecode('Testimonials'),jdecode(''), jdecode('%2F17601.html'), 'true',[],'',''],
	['PAGE','45601',jdecode('Clubs+and+Societies'),jdecode(''), jdecode('%2F45601.html'), 'true',[],'',''],
	['PAGE','46101',jdecode('Clubs+and+Societies+Part+2'),jdecode(''), jdecode('%2F46101.html'), 'true',[],'',''],
	['PAGE','46401',jdecode('Clubs+and+Societies+Part+3'),jdecode(''), jdecode('%2F46401.html'), 'true',[],'',''],
	['PAGE','55101',jdecode('Clubs+and+Societies+Part+4'),jdecode(''), jdecode('%2F55101.html'), 'true',[],'',''],
	['PAGE','46901',jdecode('Clubs+and+Societies+Search'),jdecode(''), jdecode('%2F46901.html'), 'true',[],'',''],
	['ITEM','47101',jdecode('Weather+in+West+Sussex'),jdecode(''), jdecode('http%3A%2F%2Fwww.metoffice.gov.uk%2Fweather%2Fuk%2Fse%2Fse_forecast_warnings.html'), 'true',[],'','_blank'],
	['PAGE','63201',jdecode('Walk+of+the+Month'),jdecode(''), jdecode('%2F63201.html'), 'true',[],'',''],
	['ITEM','47701',jdecode('Picturedrome+Listings'),jdecode(''), jdecode('http%3A%2F%2Fwww.picturedromebognor.com%2F'), 'true',[],'','_blank'],
	['PAGE','64301',jdecode('Bognor+Police'),jdecode(''), jdecode('%2F64301.html'), 'true',[],'',''],
	['ITEM','47201',jdecode('Pagham+Tide+Tables'),jdecode(''), jdecode('http%3A%2F%2Feasytide.ukho.gov.uk%2FEASYTIDE%2Feasytide%2FSelectPrediction.aspx%3FPortID%3D0072'), 'true',[],'','_blank'],
	['PAGE','49401',jdecode('Places+To+Visit'),jdecode(''), jdecode('%2F49401.html'), 'true',[],'',''],
	['PAGE','13601',jdecode('Community+Pages'),jdecode(''), jdecode('%2F13601.html'), 'true',[],'',''],
	['PAGE','9501',jdecode('Contact+us'),jdecode(''), jdecode('%2F9501.html'), 'true',[],'',''],
	['PAGE','48201',jdecode('Free+Ads'),jdecode(''), jdecode('%2F48201.html'), 'true',[],'',''],
	['PAGE','61501',jdecode('More+Free+Ads%21'),jdecode(''), jdecode('%2F61501.html'), 'true',[],'',''],
	['PAGE','21701',jdecode('Ways+to+Pay'),jdecode(''), jdecode('%2F21701.html'), 'true',[],'',''],
	['PAGE','68401',jdecode('Terms+%26+Conditions'),jdecode(''), jdecode('%2F68401.html'), 'true',[],'','']];
var siteelementCount=25;
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: 'WSCSYSSSSLY0XVDH'
};
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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1901',
internalId:  '',
customField: '20111206-094458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2201',
internalId:  '',
customField: '20110823-091550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45601',
internalId:  '',
customField: '20110223-141003'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '52001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9501',
internalId:  '',
customField: '20120131-092849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17601',
internalId:  '',
customField: '20110120-120019'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13601',
internalId:  '',
customField: '20111023-180432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21701',
internalId:  '',
customField: '20100822-093711'
};
webappMappings['1501']=webappMappings['1501-1501']={
webappId:    '1501',
documentId:  '52001',
internalId:  '1501',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46401',
internalId:  '',
customField: '20110507-102322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39601',
internalId:  '',
customField: '20101124-081956'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46101',
internalId:  '',
customField: '20110223-141314'
};
webappMappings['8002']=webappMappings['8002-search']={
webappId:    '8002',
documentId:  '46901',
internalId:  'search',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46901',
internalId:  '',
customField: '20110402-233430'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49401',
internalId:  '',
customField: '20110626-102138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68401',
internalId:  '',
customField: '20111103-115119'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48201',
internalId:  '',
customField: '20110909-072010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63201',
internalId:  '',
customField: '20120117-140251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52001',
internalId:  '',
customField: '20120131-092745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55101',
internalId:  '',
customField: '20120201-095147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56101',
internalId:  '',
customField: '20110523-100401'
};
webappMappings['1501']=webappMappings['1501-11405400']={
webappId:    '1501',
documentId:  '52001',
internalId:  '11405400',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61501',
internalId:  '',
customField: '20111023-180608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64301',
internalId:  '',
customField: '20110808-094208'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INE8U8';
var companyName   = 'SUSSEX+VIEWS+MAGAZINE';
var htmlTitle	  = 'sussex+views+magazine';
var metaKeywords  = 'Advertising+Pagham+Bognor+Regis+community+magazine+local+directory+barnham+west+sussex+hunston+westergate+small+business+local+po21+aldwick+rose+green+bersted+south+north+chichester+littlehampton+arundel+directory+chichester+local+business+west+sussex+reasonable+advertising+south+coast+cheap+colour+free+delivered+best.Accountants+aerials+alternate+therapies+antiques+and+collectables+ironmongers+babies+children+bathroom+beauty+builder+cafe+cake+camera+shop+carpenter+carpet+cleaning+exterior+computer+curtains+blinds+dentist+driveways+electricians+estate+agent+financial+advice+funeral+furnishings+garage+doors+garden+hairdresser+barber+health+fitness+healthcare+heating+engineer+hotel+jewellery+kitchen+music+off+licence+painter+decorater+patio+terrace+pest+control+photographer+picture+framing+plumber+property+public+houses+pub+removal+storage+roofing+solicitors+sports+leisure+stationary+ink+cartridge+tailor+vehicla+maintance+venues+for+hire+window+services+repair+';
var metaContents  = '+Local+community+magazine+and+business+directory+';
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();
};

