/* [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','8901',jdecode('Home'),jdecode(''), jdecode('%2F8901.html'), 'true',[],'',''],
	['PAGE','8952',jdecode('Why+Us'),jdecode(''), jdecode('%2F8952.html'), 'true',[],'',''],
	['PAGE','8994',jdecode('Services'),jdecode(''), jdecode('%2F8994%2Findex.html'), 'true',[ 
		['PAGE','9015',jdecode('Corporate+Hospitality'),jdecode(''), jdecode('%2F8994%2F9015.html'), 'true',[],'',''],
		['PAGE','9036',jdecode('Meeting+Facilitation'),jdecode(''), jdecode('%2F8994%2F9036.html'), 'true',[],'',''],
		['PAGE','9057',jdecode('Health+%26+Wellness+Programmes'),jdecode(''), jdecode('%2F8994%2F9057.html'), 'true',[],'',''],
		['PAGE','27823',jdecode('Medical+Tourism'),jdecode(''), jdecode('%2F8994%2F27823.html'), 'true',[],'',''],
		['PAGE','9078',jdecode('Teaching+Conversational+English'),jdecode(''), jdecode('%2F8994%2F9078.html'), 'true',[],'',''],
		['PAGE','9099',jdecode('Accommodation'),jdecode(''), jdecode('%2F8994%2F9099.html'), 'true',[],'',''],
		['PAGE','9120',jdecode('Sight-seeing+Excursions'),jdecode(''), jdecode('%2F8994%2F9120.html'), 'true',[],'',''],
		['PAGE','9141',jdecode('Magical+Montagu+Moments'),jdecode(''), jdecode('%2F8994%2F9141.html'), 'true',[],'',''],
		['PAGE','9162',jdecode('General+Visitors+Information'),jdecode(''), jdecode('%2F8994%2F9162.html'), 'false',[],'','']
	],'',''],
	['PAGE','9183',jdecode('Blog'),jdecode(''), jdecode('%2F9183.html'), 'true',[],'',''],
	['PAGE','9204',jdecode('Contact'),jdecode(''), jdecode('%2F9204.html'), 'true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Valiant';
theSitetree.paletteFamily='D43F3F';
theSitetree.keyvisualId='9815';
theSitetree.keyvisualName='kv_9815.jpg';
theSitetree.fontsetId='17626';
theSitetree.graphicsetId='13031';
theSitetree.contentColor='646464';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hetzner',
  product: 'WSCSYSSSSLY0XKDS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Valiant',
				paletteFamily: 	'D43F3F',
				keyvisualId: 	'9815',
				keyvisualName: 	'kv_9815.jpg',
				fontsetId: 		'17626',
				graphicsetId: 	'13031',
				contentColor: 	'646464',
				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['7050']=webappMappings['7050-68']={
webappId:    '7050',
documentId:  '9183',
internalId:  '68',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '8901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8901',
internalId:  '',
customField: '20110718-160717'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8952',
internalId:  '',
customField: '20110718-180934'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8994',
internalId:  '',
customField: '20111022-164238'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9036',
internalId:  '',
customField: '20110820-113724'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9120',
internalId:  '',
customField: '20110816-140026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9162',
internalId:  '',
customField: '20110718-113403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9141',
internalId:  '',
customField: '20110810-212654'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9099',
internalId:  '',
customField: '20110718-204942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9015',
internalId:  '',
customField: '20110718-111451'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9057',
internalId:  '',
customField: '20111104-103213'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9078',
internalId:  '',
customField: '20110718-161427'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9204',
internalId:  '',
customField: '20110717-224718'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9183',
internalId:  '',
customField: '20110818-155205'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27823',
internalId:  '',
customField: '20111022-163944'
};
var webAppHostname = 'sitebuilder.nur4.host-h.net:80';
var canonHostname = 'sitebuilder2.nur4.host-h.net';
var accountId     = 'AHZGE0INX2KW';
var companyName   = 'Cape+Courtesy';
var htmlTitle	  = 'Cape+Courtesy';
var metaKeywords  = 'business+travel%2C+cape+courtesy%2C+specialist+travel+company%2C+health+%26+wellness+packages%2C+magical+montagu+moments%2C+montagu%2C+travel+services%2C+specialised+travel+services%2C+meeting+arrangements%2C+customised+travel+requirements%2C+meeting+faciliation%2C+private+travel%2C+executive+travelling%2C+love+my+heart%2C+defy+age%2C+cancer+concerns%2C+life+in+balance%2C+manage+my+weight%2C+';
var metaContents  = 'Cape+Courtesy+a+specialist+business+travel+company+focussing+on+business+travellers%2C+health+%26+wellness+packages+and+any+customised+travel+requirements';
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();
};

