/* [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','1801',jdecode('Home'),jdecode(''), jdecode('%2F1801.html'), 'true',[],'',''],
	['PAGE','3601',jdecode('About+me'),jdecode(''), jdecode('%2F3601.html'), 'true',[],'',''],
	['PAGE','9101',jdecode('Piano'),jdecode(''), jdecode('%2F9101%2Findex.html'), 'true',[ 
		['PAGE','9122',jdecode('How+to+teach'),jdecode(''), jdecode('%2F9101%2F9122.html'), 'true',[],'',''],
		['PAGE','9143',jdecode('How+to+solve+the+problem'),jdecode(''), jdecode('%2F9101%2F9143.html'), 'true',[],'','']
	],'',''],
	['PAGE','10001',jdecode('Horn'),jdecode(''), jdecode('%2F10001%2Findex.html'), 'true',[ 
		['PAGE','10022',jdecode('Infomation'),jdecode(''), jdecode('%2F10001%2F10022.html'), 'true',[],'',''],
		['PAGE','10043',jdecode('Tips'),jdecode(''), jdecode('%2F10001%2F10043.html'), 'true',[],'','']
	],'',''],
	['PAGE','2201',jdecode('Contact'),jdecode(''), jdecode('%2F2201.html'), 'true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Leaves';
theSitetree.paletteFamily='174121';
theSitetree.keyvisualId='11681';
theSitetree.keyvisualName='kv_11681.jpg';
theSitetree.fontsetId='32974';
theSitetree.graphicsetId='14001';
theSitetree.contentColor='174121';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp19-dulles',
  product: 'WSCSYSSSSLYTCPII'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Leaves',
				paletteFamily: 	'174121',
				keyvisualId: 	'11681',
				keyvisualName: 	'kv_11681.jpg',
				fontsetId: 		'32974',
				graphicsetId: 	'14001',
				contentColor: 	'174121',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20111009-231333'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1801',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-13800994']={
webappId:    '1501',
documentId:  '1801',
internalId:  '13800994',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2201',
internalId:  '',
customField: '20110504-205027'
};
webappMappings['7008']=webappMappings['7008-24285']={
webappId:    '7008',
documentId:  '2201',
internalId:  '24285',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3601',
internalId:  '',
customField: '20111022-222900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9101',
internalId:  '',
customField: '20110522-052338'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10001',
internalId:  '',
customField: '20110430-224007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9143',
internalId:  '',
customField: '20110430-214044'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9122',
internalId:  '',
customField: '20110504-212240'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10022',
internalId:  '',
customField: '20110430-224007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10043',
internalId:  '',
customField: '20110430-224007'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I7K82Z';
var companyName   = 'Limetimes';
var htmlTitle	  = '%E5%A4%A7%E6%B3%89%E5%AD%A6%E5%9C%92%E3%80%80%E3%83%94%E3%82%A2%E3%83%8E%E3%80%81%E3%83%9B%E3%83%AB%E3%83%B3%E3%81%AE%E5%85%88%E7%94%9F%E3%80%80';
var metaKeywords  = '%E5%A4%A7%E6%B3%89%E5%AD%A6%E5%9C%92%E3%83%94%E3%82%A2%E3%83%8E%E6%95%99%E5%AE%A4%E3%80%80%E7%B7%B4%E9%A6%AC%E5%8C%BA%E3%83%94%E3%82%A2%E3%83%8E%E6%95%99%E5%AE%A4%E3%80%80%E3%83%94%E3%82%A2%E3%83%8E%E3%81%8C%E4%B8%8A%E6%89%8B%E3%81%AB%E3%81%AA%E3%82%8B%E3%80%80%E3%83%94%E3%82%A2%E3%83%8E%E3%81%AE%E5%85%88%E7%94%9F%E3%80%80%E3%83%9B%E3%83%AB%E3%83%B3%E3%81%AE%E5%85%88%E7%94%9F%E3%80%80%E3%83%9B%E3%83%AB%E3%83%B3%E3%81%8C%E4%B8%8A%E6%89%8B%E3%81%AB%E3%81%AA%E3%82%8B';
var metaContents  = '%E7%B7%B4%E9%A6%AC%E5%8C%BA%E5%A4%A7%E6%B3%89%E5%AD%A6%E5%9C%92%E7%94%BA%E3%81%A7%E3%83%94%E3%82%A2%E3%83%8E%E3%80%81%E3%83%9B%E3%83%AB%E3%83%B3%E3%82%92%E6%95%99%E3%81%88%E3%81%A6%E3%81%8A%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%E3%83%94%E3%82%A2%E3%83%8E%E3%83%BB%E3%83%9B%E3%83%AB%E3%83%B3%E3%81%8C%E4%B8%8A%E6%89%8B%E3%81%8F%E3%81%AA%E3%82%8A%E3%81%9F%E3%81%84%E4%BA%BA%E3%81%AE%E9%A1%98%E3%81%84%E3%82%92%E3%81%8B%E3%81%AA%E3%81%88%E3%81%BE%E3%81%99%E3%80%82';
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();
};

