/* [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','3801',jdecode('Home'),jdecode(''),'/3801.html','true',[],'',''],
	['PAGE','3852',jdecode('Arrival'),jdecode(''),'/3852.html','true',[],'',''],
	['PAGE','3873',jdecode('Accommodation'),jdecode(''),'/3873/index.html','true',[ 
		['PAGE','3894',jdecode('Chalets'),jdecode(''),'/3873/3894.html','true',[],'',''],
		['PAGE','3915',jdecode('Cabins'),jdecode(''),'/3873/3915.html','true',[],'',''],
		['PAGE','3957',jdecode('Rent+a+Tent'),jdecode(''),'/3873/3957.html','true',[],'','']
	],'',''],
	['PAGE','8112',jdecode('Gallery'),jdecode(''),'/8112.html','true',[],'',''],
	['PAGE','3978',jdecode('Prices'),jdecode(''),'/3978.html','true',[],'',''],
	['PAGE','5001',jdecode('Map'),jdecode(''),'/5001.html','true',[],'',''],
	['PAGE','10012',jdecode('Surroundings'),jdecode(''),'/10012.html','true',[],'',''],
	['PAGE','4020',jdecode('Reservation'),jdecode(''),'/4020.html','true',[],'',''],
	['PAGE','4062',jdecode('About+us'),jdecode(''),'/4062.html','true',[],'',''],
	['PAGE','4041',jdecode('Contact+Us'),jdecode(''),'/4041.html','true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Plainly';
theSitetree.paletteFamily='ABC600';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='32114';
theSitetree.graphicsetId='13925';
theSitetree.contentColor='6e6e6d';
theSitetree.contentBGColor='fbfae8';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Plainly',
				paletteFamily: 	'ABC600',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'32114',
				graphicsetId: 	'13925',
				contentColor: 	'6e6e6d',
				contentBGColor: 'fbfae8',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3801',
internalId:  '',
customField: '20100104-130456'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3852',
internalId:  '',
customField: '20091124-174211'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3873',
internalId:  '',
customField: '20091124-174247'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3894',
internalId:  '',
customField: '20091124-174449'
};
webappMappings['1501']=webappMappings['1501-7827147']={
webappId:    '1501',
documentId:  '3801',
internalId:  '7827147',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4020',
internalId:  '',
customField: '20091012-112107'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '5001',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['7008']=webappMappings['7008-2615']={
webappId:    '7008',
documentId:  '4020',
internalId:  '2615',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3915',
internalId:  '',
customField: '20091124-174718'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8112',
internalId:  '',
customField: '20091013-115825'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3957',
internalId:  '',
customField: '20091117-180022'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3978',
internalId:  '',
customField: '20091124-174859'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20100106-144410'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4041',
internalId:  '',
customField: '20100106-143521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4062',
internalId:  '',
customField: '20100106-143306'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10012',
internalId:  '',
customField: '20100106-143753'
};
var canonHostname = 'sitebuilder1.jnb2.host-h.net';
var accountId     = 'AHTZ10IN2W63';
var companyName   = 'Ingwe+Park';
var htmlTitle	  = 'Phalaborwa+Accommodation';
var metaKeywords  = 'accommodation%2C+phalaborwa%2C+affordable%2C+holiday%2C+South+Africa%2C+Limpopo%2C+valley+of+the+elephants%2C+kruger+national+park%2C+lowveld%2C+africa%2C+backpackers%2C+acomodatin%2C+accomodation%2C+self+catering%2C+tents%2C+tenting%2C+camping%2C+sun%2C+swimmingpool%2C+beauty%2C+african%2C+adventures%2C+2010%2C+footbal%2C+soccer%2C+over+night%2C+knp%2C+river%2C+mozambique+border%2C+double+beds%2C+linen%2C+towels%2C+safe+parking%2C+';
var metaContents  = 'African+bush+accommodation';
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();
};
