/* [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','32',jdecode('Welcome'),jdecode(''),'/32.html','true',[],''],
	['PAGE','53',jdecode('The+Artist'),jdecode(''),'/53.html','true',[],''],
	['PAGE','62',jdecode('Artist+Statement'),jdecode(''),'/62.html','true',[],''],
	['PAGE','5187',jdecode('Classic+Gallery'),jdecode(''),'/5187.html','true',[],''],
	['PAGE','2476',jdecode('Modern+Gallery+I'),jdecode(''),'/2476.html','true',[],''],
	['PAGE','90335',jdecode('Modern+Gallery+II'),jdecode(''),'/90335.html','true',[],''],
	['PAGE','90356',jdecode('Modern+Gallery+III'),jdecode(''),'/90356.html','true',[],''],
	['PAGE','90377',jdecode('Modern+Gallery+IV'),jdecode(''),'/90377.html','true',[],''],
	['PAGE','7083',jdecode('Past+Exhibitions'),jdecode(''),'/7083.html','true',[],''],
	['PAGE','4308',jdecode('Publications'),jdecode(''),'/4308.html','true',[],''],
	['PAGE','1117',jdecode('Guestbook'),jdecode(''),'/1117.html','true',[],''],
	['PAGE','1116',jdecode('Read+Guestbook'),jdecode(''),'/1116.html','false',[],''],
	['PAGE','3826',jdecode('Links'),jdecode(''),'/3826.html','true',[],''],
	['PAGE','5586',jdecode('Prices'),jdecode(''),'/5586.html','true',[],''],
	['PAGE','80',jdecode('Contact+Us'),jdecode(''),'/80.html','true',[],'']];
var siteelementCount=15;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='333F65';
theSitetree.keyvisualId='1819';
theSitetree.keyvisualName='kv_dummy.jpg';
theSitetree.fontsetId='290';
theSitetree.graphicsetId='355';
theSitetree.contentColor='A3AFD5';
theSitetree.contentBGColor='333F65';
var theTemplate={
				name: 			'Movement',
				paletteFamily: 	'333F65',
				keyvisualId: 	'1819',
				keyvisualName: 	'kv_dummy.jpg',
				fontsetId: 		'290',
				graphicsetId: 	'355',
				contentColor: 	'A3AFD5',
				contentBGColor: '333F65',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'333F65',
				b_color: 		'040507',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90335',
internalId:  '',
customField: '20090304-093915'
};
webappMappings['1002']=webappMappings['1002-1117AHW050IN3OXR']={
webappId:    '1002',
documentId:  '1117',
internalId:  '1117AHW050IN3OXR',
customField: 'icq=false'
};
webappMappings['7060']=webappMappings['7060-7e777163d78e05787c78db6051e9d44c']={
webappId:    '7060',
documentId:  '90356',
internalId:  '7e777163d78e05787c78db6051e9d44c',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-a531227e2bc7274768cfba6a3536c2ed']={
webappId:    '7060',
documentId:  '5187',
internalId:  'a531227e2bc7274768cfba6a3536c2ed',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-c9d81bea397be9e794b6ef41c3e65de3']={
webappId:    '7060',
documentId:  '2476',
internalId:  'c9d81bea397be9e794b6ef41c3e65de3',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-a049f8e6d62104a340f0874d9d7c71a6']={
webappId:    '7060',
documentId:  '90377',
internalId:  'a049f8e6d62104a340f0874d9d7c71a6',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20090304-093441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53',
internalId:  '',
customField: '20090304-100038'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62',
internalId:  '',
customField: '20090304-090645'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2476',
internalId:  '',
customField: '20090304-094034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5187',
internalId:  '',
customField: '20090304-102755'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7083',
internalId:  '',
customField: '20090225-105404'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4308',
internalId:  '',
customField: '20090304-104500'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1117',
internalId:  '',
customField: '20090304-092735'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1116',
internalId:  '',
customField: '20061214-024020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3826',
internalId:  '',
customField: '20090304-091005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5586',
internalId:  '',
customField: '20090304-091048'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '80',
internalId:  '',
customField: '20090304-095158'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90356',
internalId:  '',
customField: '20090304-093929'
};
webappMappings['7060']=webappMappings['7060-cd8d80e046a889108cef3e7638e7b3fb']={
webappId:    '7060',
documentId:  '90335',
internalId:  'cd8d80e046a889108cef3e7638e7b3fb',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90377',
internalId:  '',
customField: '20090304-093949'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '32',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3OXR';
var companyName   = 'Alex+Chereches+Studio';
var htmlTitle	  = 'Alex+Chereches+Studio';
var metaKeywords  = 'alexchereches%2C+chereches%2C+alexandru+chereches%2C+alexandru-chereches%2C+chereches+alexandru%2C+mihai+chereches%2C+mike+chereches%2C+chereches+mike%2C+mikechereches%2C+picasso%2C+alex-chereches%2C+alex+chereches%2C+www.alex-chereches.com%2C+modern+art%2C+art%2C+painting%2C+ink%2C+naive%2C+chereches%2C+alex%2C+contemporary%2C+fine+art%2C+fine%2C+rat';
var metaContents  = 'The+work+of+the+best+artist+of+todays+day+and+age.+Alex+Chereches.+Experience+his+unique+style+of+art.+';
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();
};
