/* [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','42',jdecode('Welcome'),jdecode(''),'/42.html','true',[],''],
	['PAGE','1940',jdecode('flow+parties'),jdecode(''),'/1940.html','true',[],''],
	['PAGE','1913',jdecode('Wine+catering'),jdecode(''),'/1913/index.html','true',[ 
		['PAGE','1922',jdecode('Sample+wine+list'),jdecode(''),'/1913/1922.html','true',[],''],
		['PAGE','1931',jdecode('Scenarios'),jdecode(''),'/1913/1931.html','true',[],'']
	],''],
	['PAGE','1387',jdecode('About'),jdecode(''),'/1387/index.html','true',[ 
		['PAGE','1396',jdecode('Vision+and+mission'),jdecode(''),'/1387/1396.html','true',[],''],
		['PAGE','1414',jdecode('About+Heidi+McLain'),jdecode(''),'/1387/1414.html','true',[],''],
		['PAGE','2811',jdecode('Giving+back'),jdecode(''),'/1387/2811.html','true',[],'']
	],''],
	['PAGE','1432',jdecode('Testimonials'),jdecode(''),'/1432.html','true',[],''],
	['PAGE','2019',jdecode('Hire%2Fwork+for+flow'),jdecode(''),'/2019.html','true',[],''],
	['PAGE','1468',jdecode('Links'),jdecode(''),'/1468.html','true',[],''],
	['PAGE','1567',jdecode('Contact+Us'),jdecode(''),'/1567.html','true',[],'']];
var siteelementCount=13;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='D72B2B';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10555';
theSitetree.graphicsetId='10893';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Alpha',
				paletteFamily: 	'D72B2B',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10555',
				graphicsetId: 	'10893',
				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: 		'D72B2B',
				e_color: 		'D72B2B',
				f_color: 		'D72B2B',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '42',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42',
internalId:  '',
customField: '20080227-145459'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1468',
internalId:  '',
customField: '20090619-180422'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1940',
internalId:  '',
customField: '20080513-154111'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1913',
internalId:  '',
customField: '20080227-141509'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1922',
internalId:  '',
customField: '20080227-145131'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1931',
internalId:  '',
customField: '20080226-181430'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1387',
internalId:  '',
customField: '20080227-142514'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1396',
internalId:  '',
customField: '20080226-184928'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1414',
internalId:  '',
customField: '20080227-142748'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2811',
internalId:  '',
customField: '20080310-165620'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1432',
internalId:  '',
customField: '20080226-181615'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2019',
internalId:  '',
customField: '20080310-165737'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1567',
internalId:  '',
customField: '20080227-144529'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3HN7';
var companyName   = '';
var htmlTitle	  = 'flow--wine+catering+for+great+occasions';
var metaKeywords  = '';
var metaContents  = '';
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();
};
