/* [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','3201',jdecode('home'),jdecode(''),'/3201.html','true',[],''],
	['PAGE','3252',jdecode('sculpture%2Finstallation'),jdecode(''),'/3252/index.html','true',[ 
		['PAGE','6095',jdecode('building%2C+dwelling%2C+sinking...'),jdecode(''),'/3252/6095.html','true',[],''],
		['PAGE','11695',jdecode('building%2C+dwelling...+Catwalk'),jdecode(''),'/3252/11695.html','true',[],''],
		['PAGE','6595',jdecode('butterhenge'),jdecode(''),'/3252/6595.html','true',[],''],
		['PAGE','11716',jdecode('cycle+of+dwelling'),jdecode(''),'/3252/11716.html','true',[],''],
		['PAGE','11842',jdecode('infinite+regress'),jdecode(''),'/3252/11842.html','true',[],''],
		['PAGE','22821',jdecode('orange+grove'),jdecode(''),'/3252/22821.html','true',[],''],
		['PAGE','11863',jdecode('ceramics'),jdecode(''),'/3252/11863.html','true',[],'']
	],''],
	['PAGE','40377',jdecode('public+projects'),jdecode(''),'/40377/index.html','true',[ 
		['PAGE','33577',jdecode('spin%2C+spin...'),jdecode(''),'/40377/33577.html','true',[],''],
		['PAGE','11779',jdecode('waiting'),jdecode(''),'/40377/11779.html','true',[],''],
		['PAGE','11737',jdecode('nesting'),jdecode(''),'/40377/11737.html','true',[],''],
		['PAGE','9195',jdecode('promotion'),jdecode(''),'/40377/9195.html','true',[],''],
		['PAGE','25121',jdecode('everything+must+go'),jdecode(''),'/40377/25121.html','true',[],'']
	],''],
	['PAGE','11295',jdecode('video'),jdecode(''),'/11295/index.html','true',[ 
		['PAGE','10595',jdecode('building%2C+dwelling...'),jdecode(''),'/11295/10595.html','true',[],''],
		['PAGE','11800',jdecode('about+23+seconds...'),jdecode(''),'/11295/11800.html','true',[],''],
		['PAGE','11821',jdecode('futiltity+vehicle'),jdecode(''),'/11295/11821.html','true',[],'']
	],''],
	['PAGE','31549',jdecode('contact'),jdecode(''),'/31549.html','true',[],''],
	['PAGE','3315',jdecode('bio%2Fcv%2Fstatement'),jdecode(''),'/3315.html','true',[],''],
	['PAGE','3294',jdecode('links'),jdecode(''),'/3294.html','true',[],'']];
var siteelementCount=22;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='555454';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10461';
theSitetree.graphicsetId='10892';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Alpha',
				paletteFamily: 	'555454',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10461',
				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:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3201',
internalId:  '',
customField: '20090304-024958'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3252',
internalId:  '',
customField: '20090304-030554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6095',
internalId:  '',
customField: '20090226-024247'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31549',
internalId:  '',
customField: '20090216-184629'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3294',
internalId:  '',
customField: '20090304-024715'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3315',
internalId:  '',
customField: '20090226-025559'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6595',
internalId:  '',
customField: '20090312-191217'
};
webappMappings['7008']=webappMappings['7008-13131']={
webappId:    '7008',
documentId:  '31549',
internalId:  '13131',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9195',
internalId:  '',
customField: '20090216-231215'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11295',
internalId:  '',
customField: '20090211-182944'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10595',
internalId:  '',
customField: '20090216-152905'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11695',
internalId:  '',
customField: '20081223-200737'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11716',
internalId:  '',
customField: '20090217-000734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11737',
internalId:  '',
customField: '20090216-233948'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22821',
internalId:  '',
customField: '20090304-030228'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11779',
internalId:  '',
customField: '20090210-150854'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11800',
internalId:  '',
customField: '20081202-203002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11821',
internalId:  '',
customField: '20081202-203737'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11842',
internalId:  '',
customField: '20081205-000721'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11863',
internalId:  '',
customField: '20090226-023526'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25121',
internalId:  '',
customField: '20090210-145430'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33577',
internalId:  '',
customField: '20090216-232444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40377',
internalId:  '',
customField: '20090222-123247'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INEI46';
var companyName   = 'david+prince';
var htmlTitle	  = 'david+prince';
var metaKeywords  = 'david+prince+artist+installation+sculpture+ceramics+brooklyn+pasadena+los+angeles+westridge+ice+raft+butterhenge+theory+history+interactive+new+media+action+gesture+building+dwelling+sinking+ephemeral+impermanent+hero+heroism+art+video';
var metaContents  = 'david+prince+-+artist%2C+lives%2Fworks+brooklyn%2C+ny+and+los+angeles%2C+ca.++sculpture%2Finstallation%2Fvideo+works%3A+everything+must+go+2008+-+building%2C+dwelling%2C+sinking+2006+ice+raft+-+butterhenge+2005+-+about+23+seconds+before+the+big+bang+2000...';
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();
};
