/* [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','801',jdecode('HOME+%E9%A6%96%E9%A0%81'),jdecode(''),'/801/index.html','true',[ 
		['PAGE','16001',jdecode('Biographical+Sketch+%E8%87%AA%E5%82%B3'),jdecode(''),'/801/16001.html','true',[],''],
		['PAGE','16022',jdecode('Contact+Information+%E8%81%AF%E7%B5%A1%E6%96%B9%E6%B3%95'),jdecode(''),'/801/16022.html','true',[],'']
	],''],
	['PAGE','852',jdecode('RESEARCH+%E7%A0%94%E7%A9%B6'),jdecode(''),'/852/index.html','true',[ 
		['PAGE','873',jdecode('Publications+%E8%91%97%E4%BD%9C'),jdecode(''),'/852/873.html','true',[],''],
		['PAGE','894',jdecode('Presentations+%E6%BC%94%E8%AC%9B'),jdecode(''),'/852/894.html','true',[],''],
		['PAGE','11201',jdecode('Awards+%26+Honors+%E5%BE%97%E7%8D%8E'),jdecode(''),'/852/11201.html','true',[],''],
		['PAGE','34701',jdecode('Syllabi+%E8%AA%B2%E7%A8%8B%E5%A4%A7%E7%B6%B1'),jdecode(''),'/852/34701.html','true',[],'']
	],''],
	['PAGE','915',jdecode('MUSIC+%E9%9F%B3%E6%A8%82'),jdecode(''),'/915/index.html','true',[ 
		['PAGE','28701',jdecode('Experience++%E7%B6%93%E9%A9%97'),jdecode(''),'/915/28701.html','true',[],''],
		['PAGE','936',jdecode('Compositions+%E5%89%B5%E4%BD%9C'),jdecode(''),'/915/936.html','true',[],''],
		['PAGE','957',jdecode('Recommendations+%E6%8E%A8%E8%96%A6'),jdecode(''),'/915/957.html','true',[],''],
		['PAGE','13601',jdecode('Collections+%E6%94%B6%E9%9B%86'),jdecode(''),'/915/13601.html','true',[],'']
	],''],
	['PAGE','978',jdecode('LITERATURE+%E6%96%87%E5%AD%B8'),jdecode(''),'/978/index.html','true',[ 
		['PAGE','7401',jdecode('Compositions+%E5%89%B5%E4%BD%9C'),jdecode(''),'/978/7401.html','true',[],''],
		['PAGE','7422',jdecode('Recommendations+%E6%8E%A8%E8%96%A6'),jdecode(''),'/978/7422.html','true',[],''],
		['PAGE','13622',jdecode('Collections+%E6%94%B6%E9%9B%86'),jdecode(''),'/978/13622.html','true',[],'']
	],''],
	['PAGE','999',jdecode('ETC.+%E5%85%B6%E4%BB%96'),jdecode(''),'/999/index.html','true',[ 
		['PAGE','7443',jdecode('Favorite+Movies+%E6%9C%80%E6%84%9B%E7%9A%84%E9%9B%BB%E5%BD%B1'),jdecode(''),'/999/7443.html','true',[],''],
		['PAGE','9401',jdecode('Performing+Arts+%E6%9C%80%E6%84%9B%E7%9A%84%E8%A1%A8%E6%BC%94%E8%97%9D%E8%A1%93'),jdecode(''),'/999/9401.html','true',[],''],
		['PAGE','9443',jdecode('Travel+%E6%97%85%E9%81%8A'),jdecode(''),'/999/9443.html','true',[],''],
		['PAGE','15201',jdecode('Links+%E9%80%A3%E7%B5%90'),jdecode(''),'/999/15201.html','true',[],'']
	],'']];
var siteelementCount=22;
theSitetree.topTemplateName='Esoteric';
theSitetree.paletteFamily='C2AF63';
theSitetree.keyvisualId='5878';
theSitetree.keyvisualName='kv_5878.jpg';
theSitetree.fontsetId='11102';
theSitetree.graphicsetId='11879';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='EDE7D0';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Esoteric',
				paletteFamily: 	'C2AF63',
				keyvisualId: 	'5878',
				keyvisualName: 	'kv_5878.jpg',
				fontsetId: 		'11102',
				graphicsetId: 	'11879',
				contentColor: 	'000000',
				contentBGColor: 'EDE7D0',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'DBDBDB',
				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:  '801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9443',
internalId:  '',
customField: '20100111-191754'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '999',
internalId:  '',
customField: '20070905-173409'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '801',
internalId:  '',
customField: '20100225-025726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '852',
internalId:  '',
customField: '20100225-030723'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '873',
internalId:  '',
customField: '20100201-012917'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '894',
internalId:  '',
customField: '20100225-031007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16001',
internalId:  '',
customField: '20091114-074229'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16022',
internalId:  '',
customField: '20070115-171958'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11201',
internalId:  '',
customField: '20100225-031048'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34701',
internalId:  '',
customField: '20091012-055939'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '915',
internalId:  '',
customField: '20090504-080926'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28701',
internalId:  '',
customField: '20070115-191209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '936',
internalId:  '',
customField: '20070901-193112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '957',
internalId:  '',
customField: '20080327-075847'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13601',
internalId:  '',
customField: '20070116-165237'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '978',
internalId:  '',
customField: '20080828-085712'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7401',
internalId:  '',
customField: '20080828-085656'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7422',
internalId:  '',
customField: '20070116-081301'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13622',
internalId:  '',
customField: '20070116-080947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7443',
internalId:  '',
customField: '20090504-081052'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9401',
internalId:  '',
customField: '20070113-193552'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15201',
internalId:  '',
customField: '20090526-192315'
};
var canonHostname = 'cm4all.aplus.net';
var accountId     = 'AAPLU0IN3ZQ1';
var companyName   = 'HOWARD+HSUEH-HAO+CHIANG';
var htmlTitle	  = 'Howard+Chiang';
var metaKeywords  = 'Howard+Chiang';
var metaContents  = 'Howard+Chiang';
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();
};
