/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','4501',jdecode('about+memoraBEALEia'),jdecode(''),'/4501.html','true',[],''],
	['PAGE','9622',jdecode('memoraBEALEia+contents'),jdecode(''),'/9622.html','true',[],''],
	['PAGE','17701',jdecode('contributors'),jdecode(''),'/17701.html','true',[],''],
	['PAGE','12001',jdecode('pictures%2Fnotes'),jdecode(''),'/12001.html','true',[],''],
	['PAGE','17743',jdecode('art'),jdecode(''),'/17743.html','true',[],''],
	['PAGE','34784',jdecode('Letters+of+Little+Edie+-Coming+2009'),jdecode(''),'/34784.html','true',[],''],
	['PAGE','35517',jdecode('Art+from+Letters+of+Little+Edie'),jdecode(''),'/35517.html','true',[],''],
	['PAGE','31701',jdecode('praise+from+gg+creative+team+'),jdecode(''),'/31701.html','true',[],''],
	['PAGE','22601',jdecode('what+people+are+saying'),jdecode(''),'/22601.html','true',[],''],
	['PAGE','26901',jdecode('memoraBEALEia+press'),jdecode(''),'/26901.html','true',[],''],
	['PAGE','22622',jdecode('memorabilia'),jdecode(''),'/22622.html','true',[],''],
	['PAGE','23601',jdecode('about+the+author'),jdecode(''),'/23601.html','true',[],''],
	['PAGE','35248',jdecode('Holiday+Cards'),jdecode(''),'/35248.html','true',[],''],
	['PAGE','3006',jdecode('guestbook%2Fe-mail+list'),jdecode(''),'/3006/index.html','true',[ 
		['PAGE','3001',jdecode('Read+Guestbook'),jdecode(''),'/3006/3001.html','false',[],'']
	],'']];
var siteelementCount=16;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='555454';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10555';
theSitetree.graphicsetId='10892';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Alpha',
				paletteFamily: 	'555454',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10555',
				graphicsetId: 	'10892',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'555454',
				e_color: 		'555454',
				f_color: 		'555454',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4501',
internalId:  '',
customField: '20080327-145153'
};
webappMappings['1002']=webappMappings['1002-3006AHW050INX3MH']={
webappId:    '1002',
documentId:  '3006',
internalId:  '3006AHW050INX3MH',
customField: 'icq=false'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20091230-113649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9622',
internalId:  '',
customField: '20080222-184323'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17701',
internalId:  '',
customField: '20080422-123936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12001',
internalId:  '',
customField: '20080327-140012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17743',
internalId:  '',
customField: '20080327-150144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31701',
internalId:  '',
customField: '20081009-100823'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22601',
internalId:  '',
customField: '20091019-091458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26901',
internalId:  '',
customField: '20091230-115855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22622',
internalId:  '',
customField: '20080611-170207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23601',
internalId:  '',
customField: '20090813-173207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3006',
internalId:  '',
customField: '20080220-132706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3001',
internalId:  '',
customField: '20080220-132706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34784',
internalId:  '',
customField: '20090813-184739'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35248',
internalId:  '',
customField: '20091229-182154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35517',
internalId:  '',
customField: '20090917-143959'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INX3MH';
var companyName   = 'memoraBEALEia';
var htmlTitle	  = 'memoraBEALEia';
var metaKeywords  = 'Grey+Gardens+Edie+Beale+Walter+Newkirk+memorabealeia+bouvier+bruce+lennon+maria+manhattan+pat+loud+ron+galella+olympia+dukakis+jeff+holtzman+maysles';
var metaContents  = 'grey+gardens+walter+newkirk+little+edie+big+edie+beale+memorabealeia+bruce+lennon+maria+manhattan+pat+loud+bouvier+olympia+dukakis+jeff+holtzman+maysles';
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();
};
