/* [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','2001',jdecode('Home'),jdecode(''),'/Home.html','true',[],''],
	['PAGE','2073',jdecode('Tea+From+China'),jdecode(''),'/ChinaTea.html','true',[],''],
	['PAGE','2094',jdecode('Tea+From+Japan'),jdecode(''),'/JapanTea.html','true',[],''],
	['PAGE','2115',jdecode('Tea+From+Taiwan'),jdecode(''),'/TaiwanTea.html','true',[],''],
	['PAGE','2136',jdecode('Flower+%26+Blooming+Tea'),jdecode(''),'/BloomingFlowerTea.html','true',[],''],
	['PAGE','15001',jdecode('Herb%2C+Health%2C+%26+Fitness'),jdecode(''),'/HerbalTeas.html','true',[],''],
	['PAGE','14022',jdecode('Wedding+Teas%2C+%26+Gifts'),jdecode(''),'/WeddingFavors&Gifts.html','true',[],''],
	['PAGE','14001',jdecode('Gift+Baskets'),jdecode(''),'/TeaGiftBaskets&Sets.html','true',[],''],
	['PAGE','2052',jdecode('Contact'),jdecode(''),'/Contact.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Sense';
theSitetree.paletteFamily='5D8047';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10498';
theSitetree.graphicsetId='11110';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Sense',
				paletteFamily: 	'5D8047',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10498',
				graphicsetId: 	'11110',
				contentColor: 	'000000',
				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: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2001',
internalId:  '',
customField: '20090727-110018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14001',
internalId:  '',
customField: '20090727-123150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2052',
internalId:  '',
customField: '20080613-160929'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2073',
internalId:  '',
customField: '20090727-103652'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2094',
internalId:  '',
customField: '20090725-214826'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2115',
internalId:  '',
customField: '20090725-214501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2136',
internalId:  '',
customField: '20090727-104923'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2001',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14022',
internalId:  '',
customField: '20090727-112118'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15001',
internalId:  '',
customField: '20090727-113948'
};
webappMappings['7008']=webappMappings['7008-5014']={
webappId:    '7008',
documentId:  '2052',
internalId:  '5014',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2073',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2094',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2115',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '14001',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2136',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2052',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '15001',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '14022',
internalId:  '',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2X8Y';
var companyName   = '+++++++++++++++TEA+NEEDS++++++++++++++++++++++++++++++++++++1-877-832-8289';
var htmlTitle	  = 'www.TeaNeeds.com';
var metaKeywords  = 'Tea%2C+Teas%2C++teashop%2C+tea+shop%2C+teastore%2C+china%2C+chinese%2C+++japan%2C+japanese%2C+taiwan%2C+Tea+needs%2C+discount+organic+tea%2C+taiwanese%2Casia%2C+oriental%2C+discount+tea%2C+sale%2C+cup%2C+bag%2C+pot%2C+teapot%2C++organic%2C+tamaryokucha%2C+sencha%2C+sincha%2C+gyokuro%2C+green+tea%2C+greentea%2C+black%2C+white%2C+yellow%2C+oolong%2C+shin+cha%2C+slimming%2C+beauty%2C+cold+clearing%2C+diet%2C+dieter%2C+fasting%2C+cleansing%2C+hypertension%2C+kidney%2C+tea+bag%2C+heat%2C+heat+reducing%2C+flowering%2C+anxi+oolong%2C+ginseng%2C+peony+king%2C+matcha%2C++powder%2C++fanning%2C+chaoquing%2C+cheap%2C+wholesale%2C+green%2C+oriental%2C+fruit%2C+teaneeds%2C+leaf%2C+loose%2C+bulk%2C++sale%2C+wholesale%2C+time%2C+pot%2C+tray%2C+quality%2C+good%2C+great%2C+wonderful%2C+healthy%2C+health%2C+good+health%2C+jasmine%2C+jade%2C+teiguanyin%2C+tei+guan+yin%2C+dragonwell%2C+longjing%2C+organic+lychee%2C+four+seasons%2C+winter%2C+spring%2C+summer%2C+Gyokuro%2C++Sencha%2C+TamaRyokuCha%2C+Sin+Cha%2C+GreenTea%2C+Tama+Ryo+Cha%2C++Genmai+Cha+Tea%2C+UJI%2C+High+Mountain+Oolong%2C+Alishan%2C+lishan+Hehuanshan%2C+ShanLinXi%2C+Yushan%2C+Dayuling%2C+fushoushan%2C+wuling%2C+formosa%2C+Four+Seasons%2C+Green%2C++Black%2C+Yellow%2C+White%2C++Blooming%2C++Artisan%2C+Flower%2C+GABA%2C+Wu-Yi%2C+wulong%2C+gift%2C+gifts%2C+gift+set%2C+basket%2C+giftbasket%2C+affiliate%2C+glass+teapot%2C+flowering+teaset%2C+brew%2C+brewer.+teabag.';
var metaContents  = 'Tea+Needs+-+Discount+Organic+Tea++Gift+Shop%21+The+Finest+Tea+From+China%2C+Japan%2C+and+Taiwan.+FREE+Tea+Samples%2C+and+Free+Shipping%21+1-877-TEA-U-BUY';
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();
};
