/* [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','2401',jdecode('Home'),jdecode(''),'/2401/index.html','true',[ 
		['PAGE','11301',jdecode('Do+you+experience+any+of+the+following+symptoms%3F'),jdecode(''),'/2401/11301.html','true',[],'',''],
		['PAGE','11322',jdecode('What+is+sleep+apnea%3F'),jdecode(''),'/2401/11322.html','true',[],'',''],
		['PAGE','11343',jdecode('Why+should+sleep+apnea+be+treated%3F'),jdecode(''),'/2401/11343.html','true',[],'',''],
		['PAGE','11364',jdecode('How+is+this+diagnosis+made%3F'),jdecode(''),'/2401/11364.html','true',[],'',''],
		['PAGE','11385',jdecode('What+is+involved+and+who+performs+the+sleep+study%3F'),jdecode(''),'/2401/11385.html','true',[],'',''],
		['PAGE','11406',jdecode('How+is+obstructive+sleep+apnea+treated%3F'),jdecode(''),'/2401/11406.html','true',[],'',''],
		['PAGE','11427',jdecode('How+do+I+make+an+appointment+for+a+sleep+study'),jdecode(''),'/2401/11427.html','true',[],'','']
	],'',''],
	['PAGE','2473',jdecode('Contact+Us'),jdecode(''),'/2473/index.html','true',[ 
		['PAGE','6122',jdecode('Guestbook'),jdecode(''),'/2473/6122.html','true',[],'','']
	],'',''],
	['PAGE','6101',jdecode('News'),jdecode(''),'/6101/index.html','true',[ 
		['PAGE','7801',jdecode('Medical+News+Today+Rss+Feed'),jdecode(''),'/6101/7801.html','true',[],'',''],
		['PAGE','10101',jdecode('Video+Wall'),jdecode(''),'/6101/10101.html','true',[],'','']
	],'',''],
	['PAGE','7601',jdecode('Forum'),jdecode(''),'/7601.html','true',[],'',''],
	['PAGE','2452',jdecode('Documents+Download'),jdecode(''),'/2452/index.html','false',[ 
		['PAGE','8801',jdecode('Voting+Poll'),jdecode(''),'/2452/8801.html','true',[],'','']
	],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Chaste';
theSitetree.paletteFamily='90BFFA';
theSitetree.keyvisualId='11544';
theSitetree.keyvisualName='kv_11544.jpg';
theSitetree.fontsetId='32877';
theSitetree.graphicsetId='13962';
theSitetree.contentColor='33619c';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Chaste',
				paletteFamily: 	'90BFFA',
				keyvisualId: 	'11544',
				keyvisualName: 	'kv_11544.jpg',
				fontsetId: 		'32877',
				graphicsetId: 	'13962',
				contentColor: 	'33619c',
				contentBGColor: 'FFFFFF',
				a_color: 		'90BFFA',
				b_color: 		'5183C3',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2401',
internalId:  '',
customField: '20100314-173741'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2452',
internalId:  '',
customField: '20100125-212355'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2473',
internalId:  '',
customField: '20100324-124456'
};
webappMappings['7008']=webappMappings['7008-3006']={
webappId:    '7008',
documentId:  '2473',
internalId:  '3006',
customField: 'language:en;country:US;'
};
webappMappings['1002']=webappMappings['1002-6122ahtz10in24yc']={
webappId:    '1002',
documentId:  '6122',
internalId:  '6122ahtz10in24yc',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6122',
internalId:  '',
customField: '20100201-210630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6101',
internalId:  '',
customField: '20100324-120943'
};
webappMappings['1501']=webappMappings['1501-8738026']={
webappId:    '1501',
documentId:  '2401',
internalId:  '8738026',
customField: '1501'
};
webappMappings['1003']=webappMappings['1003-ahtz10in24yc126705f190c']={
webappId:    '1003',
documentId:  '7601',
internalId:  'ahtz10in24yc126705f190c',
customField: 'en:US'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7601',
internalId:  '',
customField: '20100201-211701'
};
webappMappings['7090']=webappMappings['7090-31']={
webappId:    '7090',
documentId:  '7801',
internalId:  '31',
customField: 'language:en;country:US;name:;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20100127-180159'
};
webappMappings['7005']=webappMappings['7005-238']={
webappId:    '7005',
documentId:  '8801',
internalId:  '238',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8801',
internalId:  '',
customField: '20100127-185225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10101',
internalId:  '',
customField: '20100323-123312'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11301',
internalId:  '',
customField: '20100201-213735'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11322',
internalId:  '',
customField: '20100202-124950'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11343',
internalId:  '',
customField: '20100201-213911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11364',
internalId:  '',
customField: '20100201-213931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11385',
internalId:  '',
customField: '20100201-214016'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11406',
internalId:  '',
customField: '20100202-125121'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11427',
internalId:  '',
customField: '20100201-214106'
};
var canonHostname = 'sitebuilder1.jnb2.host-h.net';
var accountId     = 'AHTZ10IN24YC';
var companyName   = '++Fourie+and+Associates.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++The+Clinical+Technology+Group';
var htmlTitle	  = 'Sleep+Clinics+and+Diagnostic+Testing+for+Sleep+Disordered+Breathing';
var metaKeywords  = 'SleepSleep+Apnea+CPAP+Sleep+Studies+Titrations+Sleep+disorders+Sleep+disordered+Breathing+Night+Concentration+Sleepy+Tied+Lazy+Lungs+Pulmonary';
var metaContents  = 'Sleep+Disorders';
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();
};

