/* [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','28712',jdecode('Home+page'),jdecode(''), jdecode('%2F28712.html'), 'true',[],'',''],
	['PAGE','51312',jdecode('Truffles+and+Confections'),jdecode(''), jdecode('%2F51312%2Findex.html'), 'true',[ 
		['PAGE','50712',jdecode('What%26%23x27%3Bs+inside%21'),jdecode(''), jdecode('%2F51312%2F50712.html'), 'true',[],'','']
	],'',''],
	['PAGE','69634',jdecode('Seasonal+Selections'),jdecode(''), jdecode('%2F69634.html'), 'true',[],'',''],
	['PAGE','16301',jdecode('Special+Occasions'),jdecode(''), jdecode('%2F16301.html'), 'true',[],'',''],
	['PAGE','16322',jdecode('Custom+Logos'),jdecode(''), jdecode('%2F16322.html'), 'true',[],'',''],
	['PAGE','26912',jdecode('Order+Form'),jdecode(''), jdecode('%2F26912.html'), 'false',[],'',''],
	['PAGE','66434',jdecode('Where+to+buy+chocolates'),jdecode(''), jdecode('%2F66434.html'), 'true',[],'',''],
	['PAGE','16343',jdecode('Shipping'),jdecode(''), jdecode('%2F16343.html'), 'true',[],'',''],
	['PAGE','16364',jdecode('Events%2FClasses%2FTastings'),jdecode(''), jdecode('%2F16364.html'), 'true',[],'',''],
	['PAGE','3215',jdecode('About+My+Company'),jdecode(''), jdecode('%2F3215.html'), 'true',[],'',''],
	['PAGE','28733',jdecode('Contact+Wellington'),jdecode(''), jdecode('%2F28733.html'), 'true',[],'',''],
	['PAGE','33012',jdecode('Thank+You'),jdecode(''), jdecode('%2F33012.html'), 'false',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Antique';
theSitetree.paletteFamily='D12727';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='11061';
theSitetree.graphicsetId='11835';
theSitetree.contentColor='D1C3A6';
theSitetree.contentBGColor='856A3B';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'valueweb',
  product: 'WSCSYSSSSLYTCR7V'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Antique',
				paletteFamily: 	'D12727',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'11061',
				graphicsetId: 	'11835',
				contentColor: 	'D1C3A6',
				contentBGColor: '856A3B',
				a_color: 		'664F23',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28733',
internalId:  '',
customField: '20110205-101128'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16301',
internalId:  '',
customField: '20111127-003324'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33012',
internalId:  '',
customField: '20100111-204320'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3215',
internalId:  '',
customField: '20110615-124938'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50712',
internalId:  '',
customField: '20120126-120624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26912',
internalId:  '',
customField: '20110205-095218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16322',
internalId:  '',
customField: '20110131-012801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66434',
internalId:  '',
customField: '20120126-115932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16343',
internalId:  '',
customField: '20110402-013122'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16364',
internalId:  '',
customField: '20120126-121105'
};
webappMappings['7008']=webappMappings['7008-6193']={
webappId:    '7008',
documentId:  '28733',
internalId:  '6193',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28712',
internalId:  '',
customField: '20120121-104319'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51312',
internalId:  '',
customField: '20120123-171054'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '69634',
internalId:  '',
customField: '20120123-171636'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INLOX6';
var companyName   = 'Wellington+Chocolates+LLC';
var htmlTitle	  = 'Wellington+Chocolates';
var metaKeywords  = 'Woodinville+Seattle+artisan+shoe+Bellevue+wine+high-heel+shoe+local';
var metaContents  = 'Local+artisan+chocolates+in+Woodinville';
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();
};

