/* [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','3401',jdecode('Home'),jdecode(''),'/3401.html','true',[],'',''],
	['PAGE','3452',jdecode('Golf+Accommodation'),jdecode(''),'/3452.html','true',[],'',''],
	['PAGE','4264',jdecode('Contact+Us'),jdecode(''),'/4264.html','true',[],'',''],
	['PAGE','4285',jdecode('Development'),jdecode(''),'/4285.html','true',[],'',''],
	['PAGE','4327',jdecode('Advertise'),jdecode(''),'/4327.html','true',[],'',''],
	['ITEM','12321',jdecode('Southern+Africa'),jdecode(''),'http://sareservations.com/venues/Venues_search.php','true',[],'','_blank'],
	['ITEM','12322',jdecode('Breede+River+Travel'),jdecode(''),'http://breederivertravel.co.za','true',[],'','_blank'],
	['ITEM','12323',jdecode('Photography'),jdecode(''),'http://misasphotography.co.za','true',[],'','_blank'],
	['ITEM','12324',jdecode('Quad+Trails'),jdecode(''),'http://saquadtrails.co.za','true',[],'','_blank'],
	['ITEM','12325',jdecode('Fifa+World+Cup'),jdecode(''),'http://travelsa2010soccer.co.za','true',[],'','_blank'],
	['PAGE','12621',jdecode('Blog'),jdecode(''),'/12621.html','true',[],'',''],
	['PAGE','4501',jdecode('Almondbury+Guest+Farm'),jdecode(''),'/4501.html','false',[],'',''],
	['PAGE','20821',jdecode('Ballinderry+Guest+House'),jdecode(''),'/20821.html','false',[],'',''],
	['PAGE','4522',jdecode('Olive+Garden+Country+Lodge'),jdecode(''),'/4522.html','false',[],'',''],
	['PAGE','4543',jdecode('Route+62+Guest+House'),jdecode(''),'/4543.html','false',[],'',''],
	['PAGE','10711',jdecode('Majors+Rest+'),jdecode(''),'/10711.html','false',[],'',''],
	['PAGE','7811',jdecode('German+contact'),jdecode(''),'/7811.html','false',[],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Blog';
theSitetree.paletteFamily='649B30';
theSitetree.keyvisualId='11522';
theSitetree.keyvisualName='kv_11522.jpg';
theSitetree.fontsetId='32865';
theSitetree.graphicsetId='13949';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='989696';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Blog',
				paletteFamily: 	'649B30',
				keyvisualId: 	'11522',
				keyvisualName: 	'kv_11522.jpg',
				fontsetId: 		'32865',
				graphicsetId: 	'13949',
				contentColor: 	'FFFFFF',
				contentBGColor: '989696',
				a_color: 		'FFB434',
				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:  '3401',
internalId:  '',
customField: '20090321-081021'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4264',
internalId:  '',
customField: '20090220-005208'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3452',
internalId:  '',
customField: '20090516-115110'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4285',
internalId:  '',
customField: '20090220-005541'
};
webappMappings['7050']=webappMappings['7050-381']={
webappId:    '7050',
documentId:  '12621',
internalId:  '381',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4327',
internalId:  '',
customField: '20090220-010042'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7811',
internalId:  '',
customField: '20090220-010715'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4501',
internalId:  '',
customField: '20090220-015729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4522',
internalId:  '',
customField: '20090220-020545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4543',
internalId:  '',
customField: '20090220-021919'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10711',
internalId:  '',
customField: '20090227-063857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12621',
internalId:  '',
customField: '20090317-163929'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20821',
internalId:  '',
customField: '20090516-145925'
};
var canonHostname = 'sitebuilder1.jnb2.host-h.net';
var accountId     = 'AHTZ10IN2COU';
var companyName   = 'Robertson+Golf+%40+Silwerstrand+-+Breede+River+Valley';
var htmlTitle	  = '';
var metaKeywords  = 'Robertson+Golf+Course%2C+Breede+River+Valley%2C+golf+western+cape%2C+18+hole+golf%2C+Silwerstrand';
var metaContents  = 'Robertson+Golf+Course+-+Breede+River+Valley+-+Silwerstrand';
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();
};

