/* [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','2601',jdecode('Home'),jdecode(''),'/2601.html','true',[],''],
	['PAGE','3401',jdecode('About+us'),jdecode(''),'/3401.html','true',[],''],
	['PAGE','2673',jdecode('Bowls'),jdecode(''),'/2673.html','true',[],''],
	['PAGE','2694',jdecode('Vases'),jdecode(''),'/2694.html','true',[],''],
	['PAGE','2715',jdecode('Bottlestoppers'),jdecode(''),'/2715.html','true',[],''],
	['PAGE','7101',jdecode('Misc+Items'),jdecode(''),'/7101.html','true',[],''],
	['PAGE','2736',jdecode('Contact+%2F+Orders'),jdecode(''),'/2736.html','true',[],''],
	['PAGE','15101',jdecode('Up+Coming+Shows'),jdecode(''),'/15101.html','true',[],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Workflow';
theSitetree.paletteFamily='C0D7D0';
theSitetree.keyvisualId='7835';
theSitetree.keyvisualName='kv_7835.jpg';
theSitetree.fontsetId='16843';
theSitetree.graphicsetId='12290';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Workflow',
				paletteFamily: 	'C0D7D0',
				keyvisualId: 	'7835',
				keyvisualName: 	'kv_7835.jpg',
				fontsetId: 		'16843',
				graphicsetId: 	'12290',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'90B3A9',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'90B3A9',
				e_color: 		'979696',
				f_color: 		'707070',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2601',
internalId:  '',
customField: '20090516-162317'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2673',
internalId:  '',
customField: '20090516-162401'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2736',
internalId:  '',
customField: '20090516-162504'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3401',
internalId:  '',
customField: '20090516-162203'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2694',
internalId:  '',
customField: '20090516-162415'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2715',
internalId:  '',
customField: '20090516-162436'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7101',
internalId:  '',
customField: '20090516-162453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15101',
internalId:  '',
customField: '20080817-163507'
};
webappMappings['7008']=webappMappings['7008-7505']={
webappId:    '7008',
documentId:  '2736',
internalId:  '7505',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN23SF';
var companyName   = 'ROLLING+HILLS+WOODWORKS';
var htmlTitle	  = 'Rolling+Hills+Woodworks';
var metaKeywords  = 'rollinghillswoodworks%2Cwoodturning%2Cturning%2Cwoodworking+projects%2Cwood+creations%2Caffordable%2Cbowls%2Cwood%2Ccrafts%2Choliday+gifts%2Cmichigan%2Cturning%2Clathe%2Cvases%2Cbottlestoppers%2Cwalnut%2Ccherry%2Cexotic%2Ccocobolo%2Cmahogany%2Cmarblewood%2Coak%2Cambrosia%2Cblack%2Cebony%2Ckingwood%2Cturned+wood+bowls%2C+turned+wood+vases%2Cbud+vases%2Cweed+pots%2Cmushrooms%2Cpotpourri%2Cring+holders%2Cjewelry+dishes%2Cnatural%2Coiled%2Cwaxed%2Cart';
var metaContents  = 'Affordable+Turned+Wooden+Bowls%2CVases%2CBottlestoppers...%2C+One+Of+A+Kind+Creations+Made+From+Native+Michigan+Wood+And+Exotic+Wood+From+Around+The+World.We+Use+Black+Walnut%2C+Mahogany%2C+Cherry%2C+Cocobolo+And+Many+Other+Woods';
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();
};
