/* [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','6401',jdecode('Home'),jdecode(''),'/6401.html','true',[],''],
	['PAGE','23701',jdecode('SPECIAL+EVENTS'),jdecode(''),'/23701.html','true',[],''],
	['PAGE','6452',jdecode('Current+Show'),jdecode(''),'/6452.html','true',[],''],
	['PAGE','6473',jdecode('2010+Exhibits'),jdecode(''),'/6473.html','true',[],''],
	['PAGE','29501',jdecode('Calendar'),jdecode(''),'/29501.html','true',[],''],
	['PAGE','27801',jdecode('ART+CLASSES'),jdecode(''),'/27801.html','true',[],''],
	['PAGE','9801',jdecode('Artist+Registry'),jdecode(''),'/9801/index.html','true',[ 
		['PAGE','34301',jdecode('Barbara+Carter'),jdecode(''),'/9801/34301.html','false',[],''],
		['PAGE','21601',jdecode('Kathy+Hawk'),jdecode(''),'/9801/21601.html','false',[],''],
		['PAGE','21622',jdecode('April+Jordan'),jdecode(''),'/9801/21622.html','false',[],''],
		['PAGE','21643',jdecode('Byron+Kindig'),jdecode(''),'/9801/21643.html','false',[],''],
		['PAGE','21664',jdecode('Steven+Reeves'),jdecode(''),'/9801/21664.html','false',[],''],
		['PAGE','21685',jdecode('Wes+Venable'),jdecode(''),'/9801/21685.html','false',[],''],
		['PAGE','21706',jdecode('Kitty+Williams'),jdecode(''),'/9801/21706.html','false',[],''],
		['PAGE','48901',jdecode('Margaret+Helvey'),jdecode(''),'/9801/48901.html','false',[],''],
		['PAGE','56601',jdecode('Tony+Henson'),jdecode(''),'/9801/56601.html','false',[],'']
	],''],
	['PAGE','6578',jdecode('Join+KAG'),jdecode(''),'/6578.html','true',[],''],
	['PAGE','36501',jdecode('Links'),jdecode(''),'/36501.html','true',[],''],
	['PAGE','6536',jdecode('Paint+In'),jdecode(''),'/6536.html','true',[],''],
	['PAGE','8301',jdecode('WORKSHOPS'),jdecode(''),'/8301.html','true',[],''],
	['PAGE','50601',jdecode('Gallery+Proposals'),jdecode(''),'/50601.html','true',[],''],
	['PAGE','6557',jdecode('About+KAG'),jdecode(''),'/6557.html','true',[],''],
	['PAGE','6599',jdecode('Contact'),jdecode(''),'/6599.html','true',[],''],
	['PAGE','47001',jdecode('More+Information'),jdecode(''),'/47001.html','true',[],'']];
var siteelementCount=24;
theSitetree.topTemplateName='Akropolis';
theSitetree.paletteFamily='5E5E5E';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10553';
theSitetree.graphicsetId='10448';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='5e5e5e';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Akropolis',
				paletteFamily: 	'5E5E5E',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10553',
				graphicsetId: 	'10448',
				contentColor: 	'FFFFFF',
				contentBGColor: '5e5e5e',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'5E5E5E',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6401',
internalId:  '',
customField: '20100308-140447'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6452',
internalId:  '',
customField: '20100308-135649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6473',
internalId:  '',
customField: '20100305-155324'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9801',
internalId:  '',
customField: '20100304-151404'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36501',
internalId:  '',
customField: '20100221-145931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6536',
internalId:  '',
customField: '20100204-151755'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8301',
internalId:  '',
customField: '20100305-155059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6557',
internalId:  '',
customField: '20100204-151034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6578',
internalId:  '',
customField: '20090416-125103'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6599',
internalId:  '',
customField: '20100103-152818'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21601',
internalId:  '',
customField: '20090414-142428'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21706',
internalId:  '',
customField: '20090414-144818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21643',
internalId:  '',
customField: '20090414-151841'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21622',
internalId:  '',
customField: '20090414-151120'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21685',
internalId:  '',
customField: '20090414-150853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21664',
internalId:  '',
customField: '20090414-151713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23701',
internalId:  '',
customField: '20100304-154012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34301',
internalId:  '',
customField: '20090814-115327'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27801',
internalId:  '',
customField: '20100222-142949'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29501',
internalId:  '',
customField: '20100305-154732'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48901',
internalId:  '',
customField: '20091222-153658'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47001',
internalId:  '',
customField: '20091208-163852'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50601',
internalId:  '',
customField: '20100304-162310'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56601',
internalId:  '',
customField: '20100304-151144'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN3DL5';
var companyName   = 'Kingsport+Art+Guild';
var htmlTitle	  = 'Kingsport+Art+Guild';
var metaKeywords  = 'gallery+art+artists+painting+drawing+art+classes+exhibitions';
var metaContents  = 'kingsportartguild.org+arts+artists+galleries+gallery+art+exhibition+art+shows';
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();
};
