/* [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','3101',jdecode('Home'),jdecode(''),'/3101/index.html','true',[ 
		['PAGE','3301',jdecode('Wedding+Gowns'),jdecode(''),'/3101/3301.html','true',[],''],
		['PAGE','3322',jdecode('Bride%26%23x27%3Bs+Maids'),jdecode(''),'/3101/3322.html','true',[],''],
		['PAGE','3343',jdecode('Flower+Girls'),jdecode(''),'/3101/3343.html','true',[],''],
		['PAGE','3364',jdecode('Mothers'),jdecode(''),'/3101/3364.html','true',[],''],
		['PAGE','3385',jdecode('Tuxedos+%26+Accessories'),jdecode(''),'/3101/3385.html','true',[],'']
	],''],
	['PAGE','3601',jdecode('Contact+Bella+Brides'),jdecode(''),'/3601.html','true',[],''],
	['PAGE','4701',jdecode('Online+Orders'),jdecode(''),'/4701.html','true',[],''],
	['PAGE','4722',jdecode('Events+%26+Links'),jdecode(''),'/4722.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Vita02';
theSitetree.paletteFamily='F0DCB8';
theSitetree.keyvisualId='11349';
theSitetree.keyvisualName='kv_11349.jpg';
theSitetree.fontsetId='32120';
theSitetree.graphicsetId='13934';
theSitetree.contentColor='644227';
theSitetree.contentBGColor='F6FBFE';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Vita02',
				paletteFamily: 	'F0DCB8',
				keyvisualId: 	'11349',
				keyvisualName: 	'kv_11349.jpg',
				fontsetId: 		'32120',
				graphicsetId: 	'13934',
				contentColor: 	'644227',
				contentBGColor: 'F6FBFE',
				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:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3101',
internalId:  '',
customField: '20100122-152446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3322',
internalId:  '',
customField: '20090617-002838'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4722',
internalId:  '',
customField: '20090705-134138'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '3601',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3601',
internalId:  '',
customField: '20090705-133127'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4701',
internalId:  '',
customField: '20090616-225735'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3301',
internalId:  '',
customField: '20090705-133321'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3343',
internalId:  '',
customField: '20090616-232832'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3364',
internalId:  '',
customField: '20090616-233059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3385',
internalId:  '',
customField: '20091008-154125'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INELDE';
var companyName   = 'Bella+Brides%2C+Bend%2C+Oregon';
var htmlTitle	  = 'Bella+Brides%2C+Downtown+Bend%2C+Oregon';
var metaKeywords  = 'Bella+brides%2C+bridal%2C+boutique%2C+shop%2C+wedding%2C+formal%2C+wear%2C+attire%2C+central%2C+oregon%2C+maggie+sottero%2C+gown%2C+bend%2C+redmond%2C+sisters%2C+la+pine%2C+prineville%2C+madras%2C+portland%2C+eugene%2C+salem%2C+medford%2C+kalamath+falls%2C+lincoln+city.';
var metaContents  = 'Bella+Brides%2C+Bends+premier+bridal+boutique+with+an+extensive+selection+of+designer+gowns.+Serving+the+Pacific+Northwest+from+Downtown+Bend%2C+Oregon.+Wedding+gowns%2C+bridesmaid+dresses%2C+flower+girl+dresses%2C+mother+of+the+bride%2Fgroom%2C+shoes%2C+tiaras%2C+veils%2C+jewelry%2C+accessories.+';
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();
};
