/* [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','7801',jdecode('CONTACT+US'),jdecode(''),'/7801.html','true',[],'',''],
	['PAGE','7822',jdecode('ABOUT+US'),jdecode(''),'/7822.html','true',[],'',''],
	['PAGE','7885',jdecode('THE+STORE'),jdecode(''),'/7885/index.html','true',[ 
		['PAGE','31661',jdecode('BICYCLES'),jdecode(''),'/7885/31661.html','true',[],'',''],
		['PAGE','31682',jdecode('ACCESSORIES'),jdecode(''),'/7885/31682.html','true',[],'','']
	],'',''],
	['PAGE','7949',jdecode('TEAM+DURA+CYCLES'),jdecode(''),'/7949.html','true',[],'',''],
	['PAGE','31261',jdecode('ROAD+CYCLING'),jdecode(''),'/31261/index.html','true',[ 
		['PAGE','68715',jdecode('Events'),jdecode(''),'/31261/68715.html','true',[],'','']
	],'',''],
	['PAGE','39185',jdecode('RESULTS'),jdecode(''),'/39185.html','true',[],'',''],
	['PAGE','7928',jdecode('CYCLING+CALENDARS'),jdecode(''),'/7928.html','true',[],'',''],
	['PAGE','7907',jdecode('BLOG+SPOT'),jdecode(''),'/7907.html','true',[],'',''],
	['PAGE','7970',jdecode('GALLERY'),jdecode(''),'/7970.html','true',[],'',''],
	['ITEM','42415',jdecode('WEATHER'),jdecode(''),'http://www.weathersa.co.za/web/Home.asp?ib=1&f=68591&z=Ctry&v=7&g=MeteoT&m=Strm&anim=aStr&av=AvWarn&fav=v0&dam=&graph=temp&uid=&p=&dbug=&h=0&mw=w','true',[],'','_blank'],
	['ITEM','42416',jdecode('FACE+BOOK'),jdecode(''),'http://www.facebook.com/home.php?#!/group.php?gid=209895595350&ref=ts','true',[],'','_blank'],
	['ITEM','42417',jdecode('TWITTER'),jdecode(''),'http://twitter.com/DURACYCLES','true',[],'','_blank'],
	['PAGE','24211',jdecode('LINKS'),jdecode(''),'/24211.html','true',[],'',''],
	['PAGE','52315',jdecode('Feedback+Sardine+Classic'),jdecode(''),'/52315.html','true',[],'',''],
	['PAGE','67315',jdecode('Pro+Deo+Cycle+Tour'),jdecode(''),'/67315.html','true',[],'','']];
var siteelementCount=19;
theSitetree.topTemplateName='Fellow';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10416';
theSitetree.graphicsetId='10695';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Fellow',
				paletteFamily: 	'000000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10416',
				graphicsetId: 	'10695',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31682',
internalId:  '',
customField: '20100701-114235'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31261',
internalId:  '',
customField: '20100730-080512'
};
webappMappings['7050']=webappMappings['7050-710']={
webappId:    '7050',
documentId:  '7907',
internalId:  '710',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-5c9295cd7f91cd70a13ab78413fe09ca']={
webappId:    '7060',
documentId:  '7970',
internalId:  '5c9295cd7f91cd70a13ab78413fe09ca',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39185',
internalId:  '',
customField: '20100730-080438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3401',
internalId:  '',
customField: '20100824-105745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24211',
internalId:  '',
customField: '20100820-143757'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7970',
internalId:  '',
customField: '20100824-104138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31661',
internalId:  '',
customField: '20100701-114135'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20100630-111048'
};
webappMappings['7008']=webappMappings['7008-3594']={
webappId:    '7008',
documentId:  '52315',
internalId:  '3594',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-3447']={
webappId:    '7008',
documentId:  '7801',
internalId:  '3447',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7822',
internalId:  '',
customField: '20100513-153247'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7885',
internalId:  '',
customField: '20100610-074905'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7907',
internalId:  '',
customField: '20100701-114545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7928',
internalId:  '',
customField: '20100730-080405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7949',
internalId:  '',
customField: '20100708-123950'
};
webappMappings['1501']=webappMappings['1501-9547217']={
webappId:    '1501',
documentId:  '3401',
internalId:  '9547217',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52315',
internalId:  '',
customField: '20100708-123408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67315',
internalId:  '',
customField: '20100811-114557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68715',
internalId:  '',
customField: '20100819-072557'
};
var canonHostname = 'sitebuilder1.jnb2.host-h.net';
var accountId     = 'AHTZ10IN2J0Z';
var companyName   = 'D++U++R++A++++C++Y++C++L++E++S';
var htmlTitle	  = 'Dura+Cycles';
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();
};
