/* [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','19901',jdecode('+Home+'),jdecode(''), jdecode('%2F19901.html'), 'true',[],'',''],
	['PAGE','11201',jdecode('Happi-Nappi+Nap+Bag'),jdecode(''), jdecode('%2F11201.html'), 'true',[],'',''],
	['PAGE','11701',jdecode('Happi-Nappi+Mat+Sheet'),jdecode(''), jdecode('%2F11701.html'), 'true',[],'',''],
	['PAGE','13401',jdecode('Happi-Nappi+Cot+Sheet'),jdecode(''), jdecode('%2F13401.html'), 'true',[],'',''],
	['PAGE','14501',jdecode('Happi-Pocket+Chair+Bag'),jdecode(''), jdecode('%2F14501.html'), 'true',[],'',''],
	['PAGE','12601',jdecode('Crib+Sheets'),jdecode(''), jdecode('%2F12601.html'), 'true',[],'',''],
	['PAGE','23801',jdecode('Irregular+Merchandise+'),jdecode(''), jdecode('%2F23801.html'), 'true',[],'',''],
	['PAGE','16101',jdecode('Testimonials'),jdecode(''), jdecode('%2F16101.html'), 'true',[],'',''],
	['PAGE','15701',jdecode('About+us'),jdecode(''), jdecode('%2F15701.html'), 'true',[],'',''],
	['PAGE','39801',jdecode('Happi-Nappi+News'),jdecode(''), jdecode('%2F39801.html'), 'true',[],'',''],
	['PAGE','42501',jdecode('Teacher+Links'),jdecode(''), jdecode('%2F42501.html'), 'true',[],'',''],
	['PAGE','19101',jdecode('Conference+Dates+'),jdecode(''), jdecode('%2F19101.html'), 'true',[],'',''],
	['PAGE','15301',jdecode('Contact+Us'),jdecode(''), jdecode('%2F15301.html'), 'true',[],'',''],
	['PAGE','25901',jdecode('Mat+Sheet'),jdecode(''), jdecode('%2F25901.html'), 'false',[],'',''],
	['PAGE','26301',jdecode('Crib+Sheet+Disc.'),jdecode(''), jdecode('%2F26301.html'), 'false',[],'',''],
	['PAGE','26601',jdecode('Cot+Sheet+Disc.'),jdecode(''), jdecode('%2F26601.html'), 'false',[],'',''],
	['PAGE','27101',jdecode('Vinyl+Mat+Disc.'),jdecode(''), jdecode('%2F27101.html'), 'false',[],'',''],
	['PAGE','27501',jdecode('Chair+Bag+Disc.'),jdecode(''), jdecode('%2F27501.html'), 'false',[],'',''],
	['PAGE','25301',jdecode('Nap+Bag+Disc.'),jdecode(''), jdecode('%2F25301.html'), 'false',[],'',''],
	['PAGE','23501',jdecode('Shipping+%26+Return+'),jdecode(''), jdecode('%2F23501.html'), 'true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Hobby1';
theSitetree.paletteFamily='FFFFF1';
theSitetree.keyvisualId='10188';
theSitetree.keyvisualName='kv_10188.jpg';
theSitetree.fontsetId='21082';
theSitetree.graphicsetId='13177';
theSitetree.contentColor='DC5105';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'fatcow',
  product: 'WSCSYSSSSLY0XRN4'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Hobby1',
				paletteFamily: 	'FFFFF1',
				keyvisualId: 	'10188',
				keyvisualName: 	'kv_10188.jpg',
				fontsetId: 		'21082',
				graphicsetId: 	'13177',
				contentColor: 	'DC5105',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19901',
internalId:  '',
customField: '20111229-165403'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '19901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11201',
internalId:  '',
customField: '20110714-131713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11701',
internalId:  '',
customField: '20120117-162012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12601',
internalId:  '',
customField: '20111107-132139'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13401',
internalId:  '',
customField: '20120117-162444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39801',
internalId:  '',
customField: '20110111-135729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14501',
internalId:  '',
customField: '20111031-151013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15301',
internalId:  '',
customField: '20110302-170700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15701',
internalId:  '',
customField: '20111227-154542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16101',
internalId:  '',
customField: '20120105-161532'
};
webappMappings['7008']=webappMappings['7008-33264']={
webappId:    '7008',
documentId:  '15301',
internalId:  '33264',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19101',
internalId:  '',
customField: '20111109-131930'
};
webappMappings['1501']=webappMappings['1501-29823691']={
webappId:    '1501',
documentId:  '19901',
internalId:  '29823691',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23501',
internalId:  '',
customField: '20110214-172111'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23801',
internalId:  '',
customField: '20110922-144721'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25301',
internalId:  '',
customField: '20100514-161324'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25901',
internalId:  '',
customField: '20100514-162525'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26301',
internalId:  '',
customField: '20100514-163555'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26601',
internalId:  '',
customField: '20100514-164421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27101',
internalId:  '',
customField: '20100514-165338'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27501',
internalId:  '',
customField: '20100514-170107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42501',
internalId:  '',
customField: '20110922-144400'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INLJQP';
var companyName   = 'Happi-Nappi';
var htmlTitle	  = 'Happi+Nappi+-+Nap+Mats%2C+Mat+Sheets%2C+Mat+Sheet%2C+Mat+Covers%2C+Cot+Sheets%2C+Cot+Sheet%2C+Cot+Covers%2C+Chair+Bags';
var metaKeywords  = 'nap+mat%2C+mat+sheet%2C+mat+cover%2C+cot+sheet%2C+cot+cover%2C+Happi-Nappi%2C+Crib+sheets%2C+Port-A-Crib%2C+day+cares%2C+child+cares%2C+school+desk+chair+bag%2C+pre-schools%2C+kindergarten%2C+chair+bag%2C+mat%2C+toddler+sleeping+bag+or+nap+bag%2C+nap+mat+cover%2C+napblanket%2C+nap+sheet%2C+nap+cot+cover%2C+napbag%2C+teacher+gifts%2C+christmas+teacher+gifts';
var metaContents  = 'Happi-Nappi+products+are+mat+sheets+or+mat+covers%2C+cot+sheets+or+cot+covers%2C+nap+mats%2C+school+desk+chair+bags%2Cand+crib+sheets.+Happi-Nappis+are+used+by+day+cares+and+schools';
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();
};

