/* [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','118',jdecode('HOME+%E4%B8%BB%E9%A1%B5'),jdecode(''),'/118.html','true',[],''],
	['PAGE','139',jdecode('ABOUT+THE+ARTIST+%E7%AE%80%E5%8E%86'),jdecode(''),'/139.html','true',[],''],
	['PAGE','148',jdecode('ARTWORK+%E4%BD%9C%E5%93%81'),jdecode(''),'/148/index.html','true',[ 
		['PAGE','3259',jdecode('LANDSCAPES+%E5%B1%B1%E6%B0%B4%E7%94%BB'),jdecode(''),'/148/3259.html','true',[],''],
		['PAGE','3332',jdecode('BUDDHIST+SUBJECTS+%E4%BD%9B%E6%95%99%E8%89%BA%E6%9C%AF'),jdecode(''),'/148/3332.html','true',[],''],
		['PAGE','18301',jdecode('BOTANNICAL+SUBJECTS+%E6%A4%8D%E7%89%A9%E9%A2%98%E6%9D%90'),jdecode(''),'/148/18301.html','true',[],''],
		['PAGE','2246',jdecode('MIXED+TECHNIQUES+%E6%B7%B7%E5%90%88%E6%8A%80%E6%B3%95'),jdecode(''),'/148/2246.html','true',[],''],
		['PAGE','2880',jdecode('CALLIGRAPHY+%E4%B9%A6%E6%B3%95'),jdecode(''),'/148/2880.html','true',[],''],
		['PAGE','7106',jdecode('SKETCHES+%E9%80%9F%E5%86%99%E8%8D%89%E7%A8%BF'),jdecode(''),'/148/7106.html','true',[],''],
		['PAGE','7897',jdecode('HUDSON+RIVER+IMAGES+%E8%B4%BA%E5%BE%97%E6%A3%AE%E6%B2%B3%E7%94%BB%E9%A2%98'),jdecode(''),'/148/7897.html','true',[],'']
	],''],
	['PAGE','5694',jdecode('COLLECTIONS+%E6%94%B6%E8%97%8F'),jdecode(''),'/5694/index.html','true',[ 
		['PAGE','5966',jdecode('ARTIST%26%23x27%3BS+COLLECTION+%E8%87%AA%E8%97%8F%E5%93%81'),jdecode(''),'/5694/5966.html','true',[],'']
	],''],
	['PAGE','3181',jdecode('EXHIBITIONS+%E5%B1%95%E8%A7%88'),jdecode(''),'/3181.html','true',[],''],
	['PAGE','8118',jdecode('NEWS+AND+EVENTS+%E7%AE%80%E8%AE%AF'),jdecode(''),'/8118.html','true',[],''],
	['PAGE','9753',jdecode('ESSAYS+%E9%9A%8F%E7%AC%94'),jdecode(''),'/9753/index.html','true',[ 
		['PAGE','2648',jdecode('IN+CHINESE+%E4%B8%AD%E6%96%87%E9%9A%8F%E7%AC%94+'),jdecode(''),'/9753/2648.html','true',[],'']
	],''],
	['PAGE','184',jdecode('CONTACT+INFORMATION+%E8%81%94%E7%B3%BB'),jdecode(''),'/184.html','true',[],'']];
var siteelementCount=17;
theSitetree.topTemplateName='Basic';
theSitetree.paletteFamily='36566E';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10829';
theSitetree.graphicsetId='11283';
theSitetree.contentColor='36566E';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Basic',
				paletteFamily: 	'36566E',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10829',
				graphicsetId: 	'11283',
				contentColor: 	'36566E',
				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:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '118',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '118',
internalId:  '',
customField: '20100421-070640'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '139',
internalId:  '',
customField: '20100421-070922'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '148',
internalId:  '',
customField: '20100421-082914'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2246',
internalId:  '',
customField: '20100421-081436'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9753',
internalId:  '',
customField: '20091216-083711'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2648',
internalId:  '',
customField: '20100128-092748'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3259',
internalId:  '',
customField: '20100421-083327'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3332',
internalId:  '',
customField: '20100106-101337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18301',
internalId:  '',
customField: '20100122-082512'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5694',
internalId:  '',
customField: '20080305-143127'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5966',
internalId:  '',
customField: '20100128-102805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8118',
internalId:  '',
customField: '20100412-103703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2880',
internalId:  '',
customField: '20100206-114018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7106',
internalId:  '',
customField: '20070203-032405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7897',
internalId:  '',
customField: '20090323-100849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3181',
internalId:  '',
customField: '20071118-172626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '184',
internalId:  '',
customField: '20100109-171458'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3N5H';
var companyName   = 'MANSHENG+WANG+';
var htmlTitle	  = '';
var metaKeywords  = '';
var metaContents  = '';
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();
};
