/* [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 POS_TARGET=8;
var theSitetree=[ 
	['PAGE','701',jdecode('Home'),jdecode(''),'/701.html','true',[],'',''],
	['PAGE','5101',jdecode('About+Me'),jdecode(''),'/5101.html','true',[],'',''],
	['PAGE','29301',jdecode('Galleries%2C+Museums%2C+Publisher+'),jdecode(''),'/29301.html','true',[],'',''],
	['PAGE','5122',jdecode('Paintings'),jdecode(''),'/5122/index.html','true',[ 
		['PAGE','5143',jdecode('First+Page'),jdecode(''),'/5122/5143.html','true',[],'',''],
		['PAGE','5185',jdecode('Second+Page'),jdecode(''),'/5122/5185.html','true',[],'',''],
		['PAGE','5164',jdecode('Third+Page'),jdecode(''),'/5122/5164.html','true',[],'','']
	],'',''],
	['PAGE','21801',jdecode('%22STUDIES%22%2C+Sketches%2C+Projects'),jdecode(''),'/21801.html','true',[],'',''],
	['PAGE','5206',jdecode('New+work+in+progress%21'),jdecode(''),'/5206.html','true',[],'',''],
	['PAGE','43969',jdecode('Daily+BLOG'),jdecode(''),'/43969.html','true',[],'',''],
	['PAGE','5227',jdecode('My+PLACE+In+TUSCANY'),jdecode(''),'/5227/index.html','true',[ 
		['PAGE','40601',jdecode('RECONSTRUCTION'),jdecode(''),'/5227/40601.html','true',[],'','']
	],'',''],
	['PAGE','47022',jdecode('Stay+in+Florence%2C+Italy%21'),jdecode(''),'/47022.html','true',[],'',''],
	['PAGE','5269',jdecode('EMAIL+JUNE'),jdecode(''),'/5269.html','true',[],'',''],
	['PAGE','18506',jdecode('SIGN+Guestbook+PLEASE%21'),jdecode(''),'/18506/index.html','true',[ 
		['PAGE','18501',jdecode('READ+GUESTBOOK'),jdecode(''),'/18506/18501.html','false',[],'','']
	],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Draft';
theSitetree.paletteFamily='2D50A1';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10399';
theSitetree.graphicsetId='10611';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='2D50A1';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Draft',
				paletteFamily: 	'2D50A1',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10399',
				graphicsetId: 	'10611',
				contentColor: 	'FFFFFF',
				contentBGColor: '2D50A1',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'D09868',
				e_color: 		'9E9E9F',
				f_color: 		'051E56',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20100107-222633'
};
webappMappings['1002']=webappMappings['1002-18506AHW050INE7E6']={
webappId:    '1002',
documentId:  '18506',
internalId:  '18506AHW050INE7E6',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '701',
internalId:  '',
customField: '20100107-222100'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29301',
internalId:  '',
customField: '20091216-230652'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5122',
internalId:  '',
customField: '20091216-232850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5143',
internalId:  '',
customField: '20090615-015027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5185',
internalId:  '',
customField: '20070405-193753'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5164',
internalId:  '',
customField: '20070405-193753'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21801',
internalId:  '',
customField: '20070411-043921'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5206',
internalId:  '',
customField: '20090612-001319'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5227',
internalId:  '',
customField: '20090612-002044'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40601',
internalId:  '',
customField: '20080414-213902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5269',
internalId:  '',
customField: '20071019-145622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18506',
internalId:  '',
customField: '20071121-003740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18501',
internalId:  '',
customField: '20071121-003654'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43969',
internalId:  '',
customField: '20090615-015252'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47022',
internalId:  '',
customField: '20100730-201740'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INE7E6';
var companyName   = '+The+Art+of+June+Carey+++';
var htmlTitle	  = 'Junecareyarts';
var metaKeywords  = '+June+Carey++autry+western+Tuscany+Italy+++galleries+museums+artist++art%2C+paintings+works+california+wine%2C+vineyards%2C+Italy%2C+Tuscany%2C++studies+oil+paintings%2C+landscapes%2C+seascapes%2C+alba+june+carey+thimgan+official+cary+landscape+sea+mare+italiano+greenwich+workshop+original+site+maritime+coast+coastal+mendocino+sonoma+arezzo+toscana+commission+direct+arezzo+vitiano+artist+rental+video+kerry+carry+new+masters+gallery';
var metaContents  = 'art+artist+reproduction++painting++June+Carey+originals+studies+prints+limited+edition+cary++Thimgan+California+Wine+Vineyards+wine+country+landscapes+autry+gallery+giclee+prints+original++Tuscany++italy+canvas+linen+paint+scene+italia+images+trailside+western+museum+vines+trailside+mystic+maritime+seascapes+eucalyptus+oil+personal+vines+sonoma+greenwich+workshop+shows+exhibition+photos+process+winecountry';
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();
};
