/* [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','1301',jdecode('Home'),jdecode(''),'/1301.html','true',[],''],
	['PAGE','1352',jdecode('About+us'),jdecode(''),'/1352/index.html','true',[ 
		['PAGE','1373',jdecode('The+team'),jdecode(''),'/1352/1373.html','false',[],'']
	],''],
	['PAGE','1394',jdecode('PRODUCTS'),jdecode(''),'/1394/index.html','true',[ 
		['PAGE','1415',jdecode('SURFBOARDS'),jdecode(''),'/1394/1415.html','true',[],''],
		['PAGE','1436',jdecode('SKATEBOARDS'),jdecode(''),'/1394/1436.html','true',[],''],
		['PAGE','1457',jdecode('APPAREL'),jdecode(''),'/1394/1457.html','true',[],'']
	],''],
	['PAGE','1520',jdecode('CONTACT'),jdecode(''),'/1520/index.html','true',[ 
		['PAGE','1562',jdecode('ORDER+FORM'),jdecode(''),'/1520/1562.html','true',[],'']
	],''],
	['PAGE','1583',jdecode('Pictures'),jdecode(''),'/1583.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Capri';
theSitetree.paletteFamily='385CA9';
theSitetree.keyvisualId='7174';
theSitetree.keyvisualName='kv_7174.jpg';
theSitetree.fontsetId='16409';
theSitetree.graphicsetId='12134';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Capri',
				paletteFamily: 	'385CA9',
				keyvisualId: 	'7174',
				keyvisualName: 	'kv_7174.jpg',
				fontsetId: 		'16409',
				graphicsetId: 	'12134',
				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: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1301',
internalId:  '',
customField: '20081201-212636'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1352',
internalId:  '',
customField: '20081204-222729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1373',
internalId:  '',
customField: '20090817-124620'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1583',
internalId:  '',
customField: '20081201-223126'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1394',
internalId:  '',
customField: '20081130-195802'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1415',
internalId:  '',
customField: '20090814-155317'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1436',
internalId:  '',
customField: '20081201-213220'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1457',
internalId:  '',
customField: '20090814-154313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1520',
internalId:  '',
customField: '20090814-154415'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1562',
internalId:  '',
customField: '20080222-111446'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INX3L3';
var companyName   = 'JEFF+HO+Surfboards+and+Zephyr+Productions';
var htmlTitle	  = 'JEFF+HO+SURFBOARDS+and+Zephyr+Productions%3A+THE+ONLINE+ZEPHYR+SHOP';
var metaKeywords  = '+THE+ZEPHYR+SHOP%2C+CUSTOM+HANDCRAFTED+SURFBOARDS%2C+++JEFF+HO+SURFBOARDS%2C+jeffhozephyr%2C+jeff+ho%2C+ZEPHYR+SHOP%2C++ZEPHYR+SURFBOARDS%2C+custom%2C++ZEPHYR+skateboards%2C+dogtown%2C+MAIN+and+bay%2C+venice%2C+bicknell+hill%2C+VENICE+breakwater%2C+HECHO+IN+VENICE%2C++surf%2C+surfing%2C+surfers+journal%2C+surfer%2C+shaper%2C+SURFBOARD+shaping%2C+SURFBOARD+SHAPER%2C++horizons+west%2C++anderson+SURFBOARDS%2C+channel+islands+SURFBOARDS%2C+AL++merrick%2C++kane+garden++robert+milner%2C+roberts+SURFBOARDS%2C++original';
var metaContents  = 'THIS+IS+THE+ONLINE+ZEPHYR+SHOP+%2C+surfing+lifestyle+related+products.+we+carry+jeff+ho+surfboards+%2C+zephyr+surfboards+%2C+jeff+ho+skateboards+%2C+zephyr+skateboards+%2C+original+zephyr+t-shirts+and+clothing';
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();
};

