/* [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(''), jdecode('%2F106.html'), 'true',[],'',''],
	['PAGE','127',jdecode('About+us'),jdecode(''), jdecode('%2F127%2Findex.html'), 'true',[ 
		['PAGE','136',jdecode('Beginnings'),jdecode(''), jdecode('%2F127%2F136.html'), 'true',[],'','']
	],'',''],
	['PAGE','906',jdecode('Quinoa+Harvest'),jdecode(''), jdecode('%2F906.html'), 'true',[],'',''],
	['PAGE','145',jdecode('Products'),jdecode(''), jdecode('%2F145%2Findex.html'), 'true',[ 
		['PAGE','154',jdecode('Grain%2C+Flakes+%26+Flour'),jdecode(''), jdecode('%2F145%2F154.html'), 'true',[],'',''],
		['PAGE','163',jdecode('Gluten+Free+Pastas'),jdecode(''), jdecode('%2F145%2F163.html'), 'true',[],'',''],
		['PAGE','172',jdecode('Food+Merchant+Polenta'),jdecode(''), jdecode('%2F145%2F172.html'), 'true',[],'','']
	],'',''],
	['PAGE','181',jdecode('Quinoa+Recipes'),jdecode(''), jdecode('%2F181.html'), 'true',[],'',''],
	['PAGE','4591',jdecode('Traditional+Pamphlet'),jdecode(''), jdecode('%2F4591.html'), 'true',[],'',''],
	['PAGE','4600',jdecode('Inca+Red+Pamphlet'),jdecode(''), jdecode('%2F4600.html'), 'true',[],'',''],
	['PAGE','4609',jdecode('Submitted+Recipes'),jdecode(''), jdecode('%2F4609.html'), 'true',[],'',''],
	['PAGE','1963',jdecode('Flakes+%26+Flour+Recipes'),jdecode(''), jdecode('%2F1963.html'), 'true',[],'',''],
	['PAGE','1972',jdecode('Pasta+Recipes'),jdecode(''), jdecode('%2F1972.html'), 'true',[],'',''],
	['PAGE','915',jdecode('Polenta+Recipes'),jdecode(''), jdecode('%2F915.html'), 'true',[],'',''],
	['PAGE','11301',jdecode('Quinoa+FAQ%26%23x27%3BS'),jdecode(''), jdecode('%2F11301.html'), 'true',[],'',''],
	['PAGE','5141',jdecode('News+Updates'),jdecode(''), jdecode('%2F5141.html'), 'true',[],'',''],
	['PAGE','190',jdecode('Online+order'),jdecode(''), jdecode('%2F190.html'), 'true',[],'',''],
	['PAGE','199',jdecode('Nutrition'),jdecode(''), jdecode('%2F199.html'), 'true',[],'',''],
	['PAGE','4416',jdecode('Contact'),jdecode(''), jdecode('%2F4416%2Findex.html'), 'true',[ 
		['PAGE','4425',jdecode('Adresses'),jdecode(''), jdecode('%2F4416%2F4425.html'), 'true',[],'',''],
		['PAGE','4434',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F4416%2F4434.html'), 'true',[],'','']
	],'',''],
	['PAGE','73323',jdecode('Privacy+Policy'),jdecode(''), jdecode('%2F73323.html'), 'true',[],'','']];
var siteelementCount=23;
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 prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLYTC24G'
};
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: '20110909-132258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5141',
internalId:  '',
customField: '20111005-122034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '190',
internalId:  '',
customField: '20111014-124311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '127',
internalId:  '',
customField: '20110408-154208'
};
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: '20120117-171356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '154',
internalId:  '',
customField: '20100819-145325'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '163',
internalId:  '',
customField: '20101026-163317'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '172',
internalId:  '',
customField: '20120117-171802'
};
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: '20110815-131123'
};
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: '20110817-143244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '199',
internalId:  '',
customField: '20120119-110423'
};
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'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73323',
internalId:  '',
customField: '20110906-105713'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker04.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();
};

