/* [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','4812',jdecode('Home'),jdecode(''), jdecode('%2F4812.html'), 'true',[],'',''],
	['PAGE','20834',jdecode('Teas'),jdecode(''), jdecode('%2F20834.html'), 'true',[],'',''],
	['PAGE','20876',jdecode('Tisanes'),jdecode(''), jdecode('%2F20876.html'), 'true',[],'',''],
	['PAGE','20855',jdecode('Blossoming+Teas'),jdecode(''), jdecode('%2F20855.html'), 'true',[],'',''],
	['PAGE','108128',jdecode('Tea+Acccessories'),jdecode(''), jdecode('%2F108128.html'), 'true',[],'',''],
	['PAGE','108149',jdecode('Monthly+Feature'),jdecode(''), jdecode('%2F108149.html'), 'true',[],'',''],
	['PAGE','82017',jdecode('Tea+Tastings'),jdecode(''), jdecode('%2F82017.html'), 'false',[],'',''],
	['PAGE','20897',jdecode('Gifting'),jdecode(''), jdecode('%2F20897.html'), 'true',[],'',''],
	['PAGE','4947',jdecode('Tea+Talk'),jdecode(''), jdecode('%2F4947.html'), 'false',[],'',''],
	['PAGE','104928',jdecode('Online+Survey'),jdecode(''), jdecode('%2F104928.html'), 'false',[],'',''],
	['PAGE','24752',jdecode('Tea+Parties'),jdecode(''), jdecode('%2F24752.html'), 'false',[],'',''],
	['PAGE','20939',jdecode('Why+Kizmi+Tea%3F'),jdecode(''), jdecode('%2F20939.html'), 'false',[],'',''],
	['PAGE','7112',jdecode('The+Kizmi+Story'),jdecode(''), jdecode('%2F7112.html'), 'false',[],'',''],
	['PAGE','7196',jdecode('Contact+Us'),jdecode(''), jdecode('%2F7196.html'), 'false',[],'',''],
	['PAGE','86628',jdecode('Subscribe'),jdecode(''), jdecode('%2F86628.html'), 'false',[],'',''],
	['PAGE','7133',jdecode('Customer+Service'),jdecode(''), jdecode('%2F7133.html'), 'false',[],'',''],
	['PAGE','7175',jdecode('Terms+and+Conditions'),jdecode(''), jdecode('%2F7175.html'), 'false',[],'',''],
	['PAGE','7154',jdecode('Privacy+Policy'),jdecode(''), jdecode('%2F7154.html'), 'false',[],'','']];
var siteelementCount=18;
theSitetree.topTemplateName='Elegant';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='32906';
theSitetree.graphicsetId='13971';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'wl_enom',
  product: 'WSCENOSSSLYTC210'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Elegant',
				paletteFamily: 	'000000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'32906',
				graphicsetId: 	'13971',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				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:  '24752',
internalId:  '',
customField: '20110126-234622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4812',
internalId:  '',
customField: '20110316-161439'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20855',
internalId:  '',
customField: '20110126-232015'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20876',
internalId:  '',
customField: '20110126-230617'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4947',
internalId:  '',
customField: '20100701-080204'
};
webappMappings['7050']=webappMappings['7050-200']={
webappId:    '7050',
documentId:  '4947',
internalId:  '200',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20939',
internalId:  '',
customField: '20100403-131837'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20897',
internalId:  '',
customField: '20110126-234547'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20834',
internalId:  '',
customField: '20110316-132616'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7112',
internalId:  '',
customField: '20110126-235000'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7133',
internalId:  '',
customField: '20100403-132154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7154',
internalId:  '',
customField: '20100403-132258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7175',
internalId:  '',
customField: '20100403-132228'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7196',
internalId:  '',
customField: '20100403-131956'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4812',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '82017',
internalId:  '',
customField: '20110518-131204'
};
webappMappings['7008']=webappMappings['7008-2646']={
webappId:    '7008',
documentId:  '7196',
internalId:  '2646',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-4064']={
webappId:    '7008',
documentId:  '104928',
internalId:  '4064',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-2963']={
webappId:    '7008',
documentId:  '86628',
internalId:  '2963',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '86628',
internalId:  '',
customField: '20100403-132026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104928',
internalId:  '',
customField: '20101027-204833'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '108128',
internalId:  '',
customField: '20110126-235445'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '108149',
internalId:  '',
customField: '20110518-130805'
};
var webAppHostname = 'wsc.ehost-services.com:80';
var canonHostname = 'wscwrk01.ehost-services.com';
var accountId     = 'AEN330INFQ5O';
var companyName   = '';
var htmlTitle	  = 'Kizmi+Tea+%3A+Specialty+teas+and+tisanes+for+the+stylish+and+sophisticated';
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();
};

