/* [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','601',jdecode('Home'),jdecode(''),'/601.html','true',[],''],
	['PAGE','652',jdecode('General+Art+Collection'),jdecode(''),'/652.html','true',[],''],
	['PAGE','4001',jdecode('General+Girl+Scout+Catalog'),jdecode(''),'/4001.html','true',[],''],
	['PAGE','4022',jdecode('Camp+Catalog+'),jdecode(''),'/4022.html','true',[],''],
	['PAGE','17112',jdecode('Spring+General+Girl+Scout+Catalog'),jdecode(''),'/17112.html','true',[],''],
	['PAGE','757',jdecode('Current+Specials'),jdecode(''),'/757.html','true',[],''],
	['PAGE','799',jdecode('Order'),jdecode(''),'/799.html','true',[],''],
	['PAGE','841',jdecode('Contact'),jdecode(''),'/841.html','true',[],''],
	['PAGE','862',jdecode('About+us'),jdecode(''),'/862/index.html','true',[ 
		['PAGE','904',jdecode('Our+team'),jdecode(''),'/862/904.html','true',[],'']
	],''],
	['PAGE','925',jdecode('Imprint'),jdecode(''),'/925.html','true',[],''],
	['PAGE','2501',jdecode('Map'),jdecode(''),'/2501.html','true',[],'']];
var siteelementCount=12;
theSitetree.topTemplateName='Kingston';
theSitetree.paletteFamily='042287';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='11150';
theSitetree.graphicsetId='11955';
theSitetree.contentColor='321F8F';
theSitetree.contentBGColor='88BAEE';
var theTemplate={
				name: 			'Kingston',
				paletteFamily: 	'042287',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'11150',
				graphicsetId: 	'11955',
				contentColor: 	'321F8F',
				contentBGColor: '88BAEE',
				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: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '652',
internalId:  '',
customField: '20091007-122620'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '2501',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20091016-131343'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4001',
internalId:  '',
customField: '20091016-130311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4022',
internalId:  '',
customField: '20100210-100248'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '757',
internalId:  '',
customField: '20091006-111102'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '799',
internalId:  '',
customField: '20091016-130722'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '841',
internalId:  '',
customField: '20091014-151114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '862',
internalId:  '',
customField: '20091016-131036'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '904',
internalId:  '',
customField: '20091016-131259'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '925',
internalId:  '',
customField: '20091016-131418'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17112',
internalId:  '',
customField: '20100305-111009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2501',
internalId:  '',
customField: '20070131-182834'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INEJ4F';
var companyName   = 'Geri%27s+Screenprinting%2C+LLC';
var htmlTitle	  = 'Geris+Screenprinting%2C+LLC+%28800%29+537-4290';
var metaKeywords  = 'Screen+Printing';
var metaContents  = 'Screen+Printing';
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();
};
