/* [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','6901',jdecode('About+Babybliss'),jdecode(''), jdecode('%2F6901.html'), 'true',[],'',''],
	['PAGE','6952',jdecode('Baby+%26+Child+Swimming'),jdecode(''), jdecode('%2F6952.html'), 'true',[],'',''],
	['PAGE','6978',jdecode('Infant+Massage'),jdecode(''), jdecode('%2F6978.html'), 'true',[],'',''],
	['PAGE','7004',jdecode('Baby+%26+Toddler+Yoga'),jdecode(''), jdecode('%2F7004.html'), 'true',[],'',''],
	['PAGE','17101',jdecode('Toddler+Drama'),jdecode(''), jdecode('%2F17101.html'), 'true',[],'',''],
	['PAGE','15001',jdecode('Signing+with+song'),jdecode(''), jdecode('%2F15001.html'), 'true',[],'',''],
	['PAGE','10527',jdecode('Pregnancy+Massage+and+Yoga'),jdecode(''), jdecode('%2F10527.html'), 'true',[],'',''],
	['PAGE','11653',jdecode('Aquacise+%28+%26+pregnancy+aquacise%29'),jdecode(''), jdecode('%2F11653.html'), 'true',[],'',''],
	['PAGE','7030',jdecode('Emergency+Skills+Workshops'),jdecode(''), jdecode('%2F7030.html'), 'true',[],'',''],
	['PAGE','12101',jdecode('Timetable+%26+Costs'),jdecode(''), jdecode('%2F12101.html'), 'true',[],'',''],
	['PAGE','28401',jdecode('TBA'),jdecode(''), jdecode('%2F28401.html'), 'true',[],'',''],
	['PAGE','11601',jdecode('Babybliss+Shop'),jdecode(''), jdecode('%2F11601.html'), 'true',[],'',''],
	['PAGE','7056',jdecode('Events'),jdecode(''), jdecode('%2F7056.html'), 'true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Capri';
theSitetree.paletteFamily='794E9B';
theSitetree.keyvisualId='7245';
theSitetree.keyvisualName='kv_7245.jpg';
theSitetree.fontsetId='16413';
theSitetree.graphicsetId='12139';
theSitetree.contentColor='43215E';
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: 			'Capri',
				paletteFamily: 	'794E9B',
				keyvisualId: 	'7245',
				keyvisualName: 	'kv_7245.jpg',
				fontsetId: 		'16413',
				graphicsetId: 	'12139',
				contentColor: 	'43215E',
				contentBGColor: 'FFFFFF',
				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:  '6901',
internalId:  '',
customField: '20111209-214408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6952',
internalId:  '',
customField: '20110608-204406'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6978',
internalId:  '',
customField: '20110608-225852'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7004',
internalId:  '',
customField: '20110608-191714'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7030',
internalId:  '',
customField: '20110406-001503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7056',
internalId:  '',
customField: '20110907-115219'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10527',
internalId:  '',
customField: '20110608-230034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28401',
internalId:  '',
customField: '20110907-114221'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11601',
internalId:  '',
customField: '20101202-114519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12101',
internalId:  '',
customField: '20111209-215051'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11653',
internalId:  '',
customField: '20110621-080640'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17101',
internalId:  '',
customField: '20110608-183237'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15001',
internalId:  '',
customField: '20111130-121514'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT30IN3OJP';
var companyName   = 'Babybliss';
var htmlTitle	  = '';
var metaKeywords  = '';
var metaContents  = '';
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();
};

