/* [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','106',jdecode('Home'),jdecode(''),'/106.html','true',[],'',''],
	['PAGE','127',jdecode('About+us'),jdecode(''),'/127/index.html','true',[ 
		['PAGE','136',jdecode('Beginnings'),jdecode(''),'/127/136.html','true',[],'','']
	],'',''],
	['PAGE','906',jdecode('Quinoa+Harvest'),jdecode(''),'/906.html','true',[],'',''],
	['PAGE','145',jdecode('Products'),jdecode(''),'/145/index.html','true',[ 
		['PAGE','154',jdecode('Grain%2C+Flakes+%26+Flour'),jdecode(''),'/145/154.html','true',[],'',''],
		['PAGE','163',jdecode('Gluten+Free+Pastas'),jdecode(''),'/145/163.html','true',[],'',''],
		['PAGE','172',jdecode('Food+Merchant+Polenta'),jdecode(''),'/145/172.html','true',[],'','']
	],'',''],
	['PAGE','181',jdecode('Quinoa+Recipes'),jdecode(''),'/181.html','true',[],'',''],
	['PAGE','4591',jdecode('Traditional+Pamphlet'),jdecode(''),'/4591.html','true',[],'',''],
	['PAGE','4600',jdecode('Inca+Red+Pamphlet'),jdecode(''),'/4600.html','true',[],'',''],
	['PAGE','4609',jdecode('Submitted+Recipes'),jdecode(''),'/4609.html','true',[],'',''],
	['PAGE','1963',jdecode('Flakes+%26+Flour+Recipes'),jdecode(''),'/1963.html','true',[],'',''],
	['PAGE','1972',jdecode('Pasta+Recipes'),jdecode(''),'/1972.html','true',[],'',''],
	['PAGE','915',jdecode('Polenta+Recipes'),jdecode(''),'/915.html','true',[],'',''],
	['PAGE','11301',jdecode('Quinoa+FAQ%26%23x27%3BS'),jdecode(''),'/11301.html','true',[],'',''],
	['PAGE','5141',jdecode('News+Updates'),jdecode(''),'/5141.html','true',[],'',''],
	['PAGE','190',jdecode('Online+order'),jdecode(''),'/190.html','true',[],'',''],
	['PAGE','199',jdecode('Nutrition'),jdecode(''),'/199.html','true',[],'',''],
	['PAGE','4416',jdecode('Contact'),jdecode(''),'/4416/index.html','true',[ 
		['PAGE','4425',jdecode('Adresses'),jdecode(''),'/4416/4425.html','true',[],'',''],
		['PAGE','4434',jdecode('How+to+find+us'),jdecode(''),'/4416/4434.html','true',[],'','']
	],'','']];
var siteelementCount=22;
theSitetree.topTemplateName='Borders';
theSitetree.paletteFamily='A6CBB5';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10571';
theSitetree.graphicsetId='10774';
theSitetree.contentColor='692643';
theSitetree.contentBGColor='FEFEF8';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Borders',
				paletteFamily: 	'A6CBB5',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10571',
				graphicsetId: 	'10774',
				contentColor: 	'692643',
				contentBGColor: 'FEFEF8',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '106',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '106',
internalId:  '',
customField: '20090313-122148'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5141',
internalId:  '',
customField: '20100722-103026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '190',
internalId:  '',
customField: '20100722-103203'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '127',
internalId:  '',
customField: '20090226-123657'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '136',
internalId:  '',
customField: '20080627-162648'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '906',
internalId:  '',
customField: '20100120-152007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '145',
internalId:  '',
customField: '20100122-153005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '154',
internalId:  '',
customField: '20080701-172835'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '163',
internalId:  '',
customField: '20090817-173223'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '172',
internalId:  '',
customField: '20090320-161955'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '181',
internalId:  '',
customField: '20100625-175429'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4591',
internalId:  '',
customField: '20091012-175354'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4600',
internalId:  '',
customField: '20080429-175113'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4609',
internalId:  '',
customField: '20100625-173130'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1963',
internalId:  '',
customField: '20080429-175318'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1972',
internalId:  '',
customField: '20091109-160229'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '915',
internalId:  '',
customField: '20091005-161734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11301',
internalId:  '',
customField: '20100322-153543'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '199',
internalId:  '',
customField: '20100122-170725'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4416',
internalId:  '',
customField: '20081202-152856'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4425',
internalId:  '',
customField: '20080409-225540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4434',
internalId:  '',
customField: '20100607-170757'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INX2OM';
var companyName   = 'QUINOA+CORPORATION';
var htmlTitle	  = '';
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();
};
