/* [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 theSitetree=[ 
	['PAGE','1401',jdecode('Invisalign+versus+Braces'),jdecode(''),'/1401.html','true',[],''],
	['PAGE','4101',jdecode('Benefits+of+Looking+Attractive'),jdecode(''),'/4101.html','true',[],''],
	['PAGE','5601',jdecode('Invisible+Braces+or+iBraces+'),jdecode(''),'/5601.html','true',[],''],
	['PAGE','1452',jdecode('Cosmetic+Dentistry+%26+Braces'),jdecode(''),'/1452.html','true',[],''],
	['PAGE','1473',jdecode('Early+Treatment+for+Children'),jdecode(''),'/1473.html','true',[],''],
	['PAGE','2801',jdecode('Orthodontics+for+Adults'),jdecode(''),'/2801.html','true',[],''],
	['PAGE','5622',jdecode('Braces+-+Pain+%26+Broken+Wires'),jdecode(''),'/5622.html','true',[],''],
	['PAGE','6001',jdecode('Cost+for+Braces+-+Prices'),jdecode(''),'/6001.html','true',[],''],
	['PAGE','6022',jdecode('Herbst+Appliance+%26+HeadGear'),jdecode(''),'/6022.html','true',[],''],
	['PAGE','44101',jdecode('Orthodontists+and+Dentistry'),jdecode(''),'/44101.html','true',[],''],
	['PAGE','60401',jdecode('Retreatment+%26+Relapse'),jdecode(''),'/60401.html','true',[],''],
	['PAGE','47601',jdecode('Orthodontic+Retainers'),jdecode(''),'/47601.html','true',[],''],
	['PAGE','59001',jdecode('Tooth+Whitening+%26+Bleaching'),jdecode(''),'/59001.html','true',[],''],
	['PAGE','60422',jdecode('Dental+Hygiene+%26+Prevention'),jdecode(''),'/60422.html','true',[],''],
	['PAGE','52701',jdecode('Sport+Mouth+Guards+%26+Braces'),jdecode(''),'/52701.html','true',[],''],
	['PAGE','60001',jdecode('Night+Guard+%26+Tooth+Grinding'),jdecode(''),'/60001.html','true',[],''],
	['PAGE','60801',jdecode('Braces%2C+Cold+Sores+%26+Ulcers'),jdecode(''),'/60801.html','true',[],''],
	['PAGE','60822',jdecode('Electric+Toothbrushes+-Yes%2FNo'),jdecode(''),'/60822.html','true',[],''],
	['PAGE','2822',jdecode('About+Our+Team+%26+Dr.+Supan'),jdecode(''),'/2822.html','true',[],''],
	['PAGE','57801',jdecode('Friends+of+Braces.com'),jdecode(''),'/57801.html','true',[],'']];
var siteelementCount=20;
theSitetree.topTemplateName='Nebula';
theSitetree.paletteFamily='245298';
theSitetree.keyvisualId='8790';
theSitetree.keyvisualName='kv_8790.jpg';
theSitetree.fontsetId='17191';
theSitetree.graphicsetId='12475';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='6D93CC';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Nebula',
				paletteFamily: 	'245298',
				keyvisualId: 	'8790',
				keyvisualName: 	'kv_8790.jpg',
				fontsetId: 		'17191',
				graphicsetId: 	'12475',
				contentColor: 	'000000',
				contentBGColor: '6D93CC',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1401',
internalId:  '',
customField: '20080705-115538'
};
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABRI10INVD38';
var companyName   = 'Braces.com+++++++++++++++++Information+on+Braces%2C+Invisalign%2C+Invisible+Braces%2C+%26+Clear+Braces+';
var htmlTitle	  = 'Braces%2C+Invisalign%2C+Invisible+Braces%2C+and+Clear+Braces+Information';
var metaKeywords  = 'braces++Invisalign+braces+pain+++do+braces+hurt+++braces+for+kids++braces+color++Herbst+Appliance+headgear+clear+braces+ceramic+braces+beauty+and+braces+cost+of+braces+orthodontics+Leesburg+Virginia+Board+Certified+Othodontist';
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();
};
