/* [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','601',jdecode('Home'),jdecode(''),'/601.html','true',[],''],
	['PAGE','652',jdecode('About+the+Artist'),jdecode(''),'/652.html','true',[],''],
	['PAGE','15301',jdecode('Artwork'),jdecode(''),'/15301/index.html','true',[ 
		['PAGE','7301',jdecode('Landscapes'),jdecode(''),'/15301/7301.html','true',[],''],
		['PAGE','6501',jdecode('Still-lifes'),jdecode(''),'/15301/6501.html','true',[],''],
		['PAGE','7401',jdecode('Portraits'),jdecode(''),'/15301/7401.html','true',[],'']
	],''],
	['PAGE','11401',jdecode('Galleries'),jdecode(''),'/11401.html','true',[],''],
	['PAGE','12501',jdecode('Exhibitions'),jdecode(''),'/12501.html','true',[],''],
	['PAGE','6406',jdecode('Guestbook'),jdecode(''),'/6406/index.html','true',[ 
		['PAGE','6401',jdecode('Read+Guestbook'),jdecode(''),'/6406/6401.html','false',[],'']
	],''],
	['PAGE','18101',jdecode('Links'),jdecode(''),'/18101.html','true',[],''],
	['PAGE','757',jdecode('Contact'),jdecode(''),'/757.html','true',[],'']];
var siteelementCount=12;
theSitetree.topTemplateName='Capri';
theSitetree.paletteFamily='947333';
theSitetree.keyvisualId='7203';
theSitetree.keyvisualName='kv_7203.jpg';
theSitetree.fontsetId='16409';
theSitetree.graphicsetId='12136';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Capri',
				paletteFamily: 	'947333',
				keyvisualId: 	'7203',
				keyvisualName: 	'kv_7203.jpg',
				fontsetId: 		'16409',
				graphicsetId: 	'12136',
				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: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-6406AHW050INE2V7']={
webappId:    '1002',
documentId:  '6406',
internalId:  '6406AHW050INE2V7',
customField: 'icq=false'
};
webappMappings['7060']=webappMappings['7060-bedb215dd5f9dc9338f23393f38409cc']={
webappId:    '7060',
documentId:  '7401',
internalId:  'bedb215dd5f9dc9338f23393f38409cc',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-4f0075124b36fcc5fd7e6efb8b54c1a8']={
webappId:    '7060',
documentId:  '7301',
internalId:  '4f0075124b36fcc5fd7e6efb8b54c1a8',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-2cfbbe4a95057f8f489ccf3018909613']={
webappId:    '7060',
documentId:  '6501',
internalId:  '2cfbbe4a95057f8f489ccf3018909613',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-71d2af2bfbf9195c9b5458fecb071ef1']={
webappId:    '7060',
documentId:  '7301',
internalId:  '71d2af2bfbf9195c9b5458fecb071ef1',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-3533b51973fb58557f75ff90e4926572']={
webappId:    '7060',
documentId:  '7401',
internalId:  '3533b51973fb58557f75ff90e4926572',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20091122-100408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '652',
internalId:  '',
customField: '20091027-181532'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15301',
internalId:  '',
customField: '20080106-174307'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6501',
internalId:  '',
customField: '20080106-174424'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7301',
internalId:  '',
customField: '20080106-174457'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7401',
internalId:  '',
customField: '20080106-174529'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11401',
internalId:  '',
customField: '20090913-143338'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12501',
internalId:  '',
customField: '20090913-142815'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6406',
internalId:  '',
customField: '20080106-174700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6401',
internalId:  '',
customField: '20071216-183808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18101',
internalId:  '',
customField: '20090913-143609'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '757',
internalId:  '',
customField: '20080204-100451'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INE2V7';
var companyName   = 'Portraits%2C+Landscapes+and+Still-lifes';
var htmlTitle	  = 'R.+Patterson+Boyd';
var metaKeywords  = 'Oil+Paintings+Portraits+Artwork+Landscapes+Stillifes+Still-lifes+Stillife+Acrylic+Acrylics+R.+Patterson+Boyd+Robbie+Patterson+Boyd';
var metaContents  = 'Still+life%2C+portrait+and+lanscapes+in+oil%2C+acrylic+and+pastel%2C+Robbie+Patterson+Boyd%2C+R.+Patterson+Boyd';
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();
};
