/* [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','1152',jdecode('Home'),jdecode(''),'/1152.html','true',[],'',''],
	['PAGE','1209',jdecode('Accommodation+++++++++++++++++'),jdecode(''),'/1209.html','true',[],'',''],
	['PAGE','2928',jdecode('Gallery+++++++++++++++++++++++++++'),jdecode(''),'/2928.html','true',[],'',''],
	['PAGE','2955',jdecode('What+to+do+in+Port+Elizabeth'),jdecode(''),'/2955.html','true',[],'',''],
	['PAGE','2982',jdecode('Directions%2FMap+to+B%26B'),jdecode(''),'/2982.html','true',[],'',''],
	['PAGE','2901',jdecode('Rates%2FContact+us+At+Sta-Plus'),jdecode(''),'/2901.html','true',[],'',''],
	['PAGE','4577',jdecode('Wir+sprechen+Deutsch++++++++++++++Unterkunft'),jdecode(''),'/4577.html','true',[],'',''],
	['PAGE','8177',jdecode('Links%2FBed+and+Breakfasts'),jdecode(''),'/8177.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='C96363';
theSitetree.keyvisualId='6879';
theSitetree.keyvisualName='kv_6879.jpg';
theSitetree.fontsetId='11212';
theSitetree.graphicsetId='12035';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='E07979';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Angkor',
				paletteFamily: 	'C96363',
				keyvisualId: 	'6879',
				keyvisualName: 	'kv_6879.jpg',
				fontsetId: 		'11212',
				graphicsetId: 	'12035',
				contentColor: 	'FFFFFF',
				contentBGColor: 'E07979',
				a_color: 		'E07979',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1152',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1152',
internalId:  '',
customField: '20100720-210142'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1209',
internalId:  '',
customField: '20090928-122805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2928',
internalId:  '',
customField: '20070711-110946'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2955',
internalId:  '',
customField: '20070711-111035'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2982',
internalId:  '',
customField: '20091007-133900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2901',
internalId:  '',
customField: '20100720-153056'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4577',
internalId:  '',
customField: '20090621-221930'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8177',
internalId:  '',
customField: '20100720-211135'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1152',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1209',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2928',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2955',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2982',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2901',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4577',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '8177',
internalId:  '',
customField: 'language:de;country:CH;'
};
var canonHostname = 'webomat01.hostpoint.ch';
var accountId     = 'Ahp010INERID';
var companyName   = 'At+Sta-Plus+Bed+and+Breakfast+GuestHouse+Accommodation+Fr%C3%BChst%C3%BCckspension+G%C3%A4stehaus+Unterkunft+Port+Elizabeth';
var htmlTitle	  = 'Bed+and+Breakfast+Beachfront+GuestHouse+Accommodation+Unterkunft+self+catering+Port+Elizabeth';
var metaKeywords  = 'Bed+and+Breakfast+Port+Elizabeth%2CBeachfront+Accommodation%2C+Port+Elizabeth%2CSelf+Catering%2CGuestHouse%2CBB%2CUniversity%2CBandB%2CBusiness%2C+Soccor2010%2CSouth+Africa%2CFr%C3%BChst%C3%BCckspension%2CG%C3%A4stehaus%2CUnterkunft%2CFremdenzimmer%2CGolf+course%2CIronman%2CStudent+Accommodation';
var metaContents  = 'At+Sta-Plus+Bed+and+Breakfast+Port+Elizabeth%2CGuesthouse%2CBeachfront%2Cself+catering%2C+Accommodation+Port+Elizabeth%2CSouth+Africa%2CBeach%2CFr%C3%BChst%C3%BCckspension%2CUnterkunft%2CG%C3%A4stehaus%2C+Fremdenzimmer%2CG%C3%A4stezimmer%2CPort+Elizabeth%2CGolf+Course%2CBeach%2C';
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();
};
