/* [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 theSitetree=[ 
	['PAGE','1674',jdecode('Home'),jdecode(''),'/1674.html','true',[],''],
	['PAGE','1695',jdecode('About+CASPSCo'),jdecode(''),'/1695/index.html','true',[ 
		['PAGE','24301',jdecode('How+we+work+for+you'),jdecode(''),'/1695/24301.html','true',[],'']
	],''],
	['PAGE','4401',jdecode('Cheshire+and+Staffordshire'),jdecode(''),'/4401.html','true',[],''],
	['PAGE','23401',jdecode('Our+areas'),jdecode(''),'/23401.html','false',[],''],
	['PAGE','25401',jdecode('Rentals'),jdecode(''),'/25401.html','false',[],''],
	['PAGE','26427',jdecode('Workforce+Solutions'),jdecode(''),'/26427.html','false',[],''],
	['PAGE','10301',jdecode('What+does+it+cost%3F'),jdecode(''),'/10301.html','true',[],''],
	['PAGE','37701',jdecode('Business+Costs'),jdecode(''),'/37701.html','true',[],''],
	['PAGE','26401',jdecode('Student+Property'),jdecode(''),'/26401.html','true',[],''],
	['PAGE','24401',jdecode('Properties+we+have+found'),jdecode(''),'/24401.html','false',[],''],
	['PAGE','36401',jdecode('Selling+your+property%3F'),jdecode(''),'/36401.html','true',[],''],
	['PAGE','23801',jdecode('Privacy%2C+T%26C%26%23x27%3Bs'),jdecode(''),'/23801.html','true',[],''],
	['PAGE','1769',jdecode('Contact+CASPSCo'),jdecode(''),'/1769.html','true',[],'']];
var siteelementCount=14;
theSitetree.topTemplateName='Basic';
theSitetree.paletteFamily='36566E';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10828';
theSitetree.graphicsetId='11283';
theSitetree.contentColor='36566E';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				name: 			'Basic',
				paletteFamily: 	'36566E',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10828',
				graphicsetId: 	'11283',
				contentColor: 	'36566E',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23401',
internalId:  '',
customField: '20090906-220749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23801',
internalId:  '',
customField: '20091125-131420'
};
webappMappings['1501']=webappMappings['1501-8982500']={
webappId:    '1501',
documentId:  '1674',
internalId:  '8982500',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-3875']={
webappId:    '7008',
documentId:  '1769',
internalId:  '3875',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1674',
internalId:  '',
customField: '20091125-130947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1695',
internalId:  '',
customField: '20090906-214159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10301',
internalId:  '',
customField: '20091125-131121'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25401',
internalId:  '',
customField: '20090904-114245'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24401',
internalId:  '',
customField: '20090713-223300'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1769',
internalId:  '',
customField: '20091125-130801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26401',
internalId:  '',
customField: '20090906-221136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24301',
internalId:  '',
customField: '20090906-215334'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1674',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4401',
internalId:  '',
customField: '20090906-212328'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26427',
internalId:  '',
customField: '20090904-135141'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36401',
internalId:  '',
customField: '20090906-210805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37701',
internalId:  '',
customField: '20090906-214033'
};
webappMappings['7060']=webappMappings['7060-fea6d406e82c8dafe6dbdad65999d373']={
webappId:    '7060',
documentId:  '24401',
internalId:  'fea6d406e82c8dafe6dbdad65999d373',
customField: 'language:en;country:GB;'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INEGZA';
var companyName   = 'The+Cheshire+%26+Staffordshire+Property+Search+Company+Ltd++';
var htmlTitle	  = 'The+Cheshire+and+Staffordshire+Property+Search+Company+';
var metaKeywords  = 'find%2C+property%2C+in+staffordshire%2Cfind+property%2C+property+to+rent+staffordshire%2Cproperty+consultants+cheshire%2Cproperty+to+buy+stafford%2Cproperty+to+buy+staffordshire%2Cproperty+in+staffordshire%2Cproperty+consultants+cheshire+uk%2Cproperty+to+let+in+cheshire%2Cproperty+lets+cheshire%2Creal+estate+cheshire+uk%2Cproperty+finders+cheshire%2Cproperty+search+consultant%2Cluxury+apartment+search%2Cproperty+rental+search%2Cinvestment+flat+property+search%2Cluxury%2C+property+finder%2C+property%2C+finding+services%2Cuk+property+finder%2Cuk+property+finding%2Cproperty+finding+consultancy%2Cfind+a+rental+property%2Chouses+for+sale+cheshire%2Chouse+search+uk%2Chouses+to+buy+stafford%2Ccheshire+homes+for+sale%2C+www.caspsco.co.uk%2Ccheshirerelocation%2C+CheshireStaffordshirehousehomeproperty%2C+search%2C+estate+agents%2C+new+build%2C+detatched%2C+relocation%2C+leek%2C+stafford%2C+stoke%2C+crewe%2C+wilmslow%2C+nantwich%2C+holmes+chapel%2C+alderley+edge%2C+warrington%2C+lichfield%2C+cannock%2C+newcastle+under+lyme%2C+alsager%2C+northwich%2C+middlewich%2C+student%2C+tamworth%2C+alton%2C+kidsgrove%2C+macclesfield%2C+congleton%2C+cheadle%2C+hulme';
var metaContents  = 'Searching+for+houses+in+Staffordshire+and+Cheshire%3F+Looking+for+building+land%3F++Wanting+a+home+or+property+to+rent%3F++An+independant+and+professional+search+company+that+puts+you+first.';
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();
};
