/* [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','14101',jdecode('About+DanceBrazil'),jdecode(''),'/14101.html','true',[],'',''],
	['PAGE','18401',jdecode('Classes'),jdecode(''),'/18401.html','true',[],'',''],
	['PAGE','18453',jdecode('Forr%C3%B3'),jdecode(''),'/18453.html','true',[],'',''],
	['PAGE','18479',jdecode('Samba'),jdecode(''),'/18479.html','true',[],'',''],
	['PAGE','42712',jdecode('Schools'),jdecode(''),'/42712.html','true',[],'',''],
	['PAGE','49412',jdecode('News%2FEvents'),jdecode(''),'/49412.html','true',[],'',''],
	['PAGE','21901',jdecode('Contact'),jdecode(''),'/21901.html','true',[],'',''],
	['PAGE','21927',jdecode('Gallery'),jdecode(''),'/21927.html','true',[],'',''],
	['PAGE','27501',jdecode('Standards'),jdecode(''),'/27501.html','true',[],'',''],
	['PAGE','24301',jdecode('Links'),jdecode(''),'/24301.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Travel';
theSitetree.paletteFamily='508457';
theSitetree.keyvisualId='6957';
theSitetree.keyvisualName='kv_6957.jpg';
theSitetree.fontsetId='13645';
theSitetree.graphicsetId='12076';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='508457';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Travel',
				paletteFamily: 	'508457',
				keyvisualId: 	'6957',
				keyvisualName: 	'kv_6957.jpg',
				fontsetId: 		'13645',
				graphicsetId: 	'12076',
				contentColor: 	'FFFFFF',
				contentBGColor: '508457',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'BDBFBD',
				e_color: 		'BDBFBD',
				f_color: 		'BDBFBD',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14101',
internalId:  '',
customField: '20100216-180027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18401',
internalId:  '',
customField: '20100514-123029'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18453',
internalId:  '',
customField: '20100219-113312'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18479',
internalId:  '',
customField: '20090909-235406'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21901',
internalId:  '',
customField: '20091007-140509'
};
webappMappings['7008']=webappMappings['7008-5557']={
webappId:    '7008',
documentId:  '21901',
internalId:  '5557',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21927',
internalId:  '',
customField: '20100430-112812'
};
webappMappings['7060']=webappMappings['7060-c0247224600d5195be63956278f0bd31']={
webappId:    '7060',
documentId:  '21927',
internalId:  'c0247224600d5195be63956278f0bd31',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24301',
internalId:  '',
customField: '20100216-123457'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42712',
internalId:  '',
customField: '20100216-123030'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '14101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27501',
internalId:  '',
customField: '20100430-113329'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '14101',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '18401',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '18453',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '18479',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '42712',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49412',
internalId:  '',
customField: '20100617-100500'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '21901',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '21927',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '27501',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '24301',
internalId:  '',
customField: 'language:en;country:GB;'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN3CKI';
var companyName   = 'DanceBrazil';
var htmlTitle	  = 'DanceBrazil';
var metaKeywords  = 'Dance+classes+Midlands%2CDance+lessons+Midlands%2CActivities+Midlands%2CDance+Schools+Midlands%2CDance+classes+Nottingham%2CDance+lessons+Nottingham%2CAerobics+classes+Nottingham%2CActivities+Nottingham%2CDance+schools+Nottingham%2CBrazilian+dancer%2CBrazilian+dancing%2CBrazilian+samba+dancing%2CSamba+online%2CSamba+video+clips%2CSamba+schools+education%2CLearn+to+samba%2CSamba+carnivals%2CTeam+building+activity+days%2CTeam+building+midlands%2CTeam+building+events+midlandsTeam+building+ideas%2CEmployee+team+building%2CKey+stage+2+resources%2CSchool+activity+day%2CTeaching+activity+sheets%2CPrimary+school+activities%2CLesson+plans+key+stage+2%2CLesson+plans+key+stage+3%2C';
var metaContents  = 'Brazilian+Dance+School+in+Nottingham%2C+England%2C+UK.+Samba%2C+Forro%2C+YMCA%2C+Nottingham+School+of+Samba%2C+Cordao+de+Ouro+Capoeira+Nottingham.+Nottingham+city+centre.+Leisure+activities+Nottingham.+';
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();
};
