/* [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','301',jdecode('Home'),jdecode(''),'/301.html','true',[],''],
	['PAGE','352',jdecode('Products'),jdecode(''),'/352/index.html','true',[ 
		['PAGE','11401',jdecode('Frost+management'),jdecode(''),'/352/11401.html','true',[],''],
		['PAGE','18112',jdecode('SMARTL'),jdecode(''),'/352/18112.html','false',[],''],
		['PAGE','18133',jdecode('FWBNM'),jdecode(''),'/352/18133.html','false',[],''],
		['PAGE','21012',jdecode('FWBGM'),jdecode(''),'/352/21012.html','false',[],''],
		['PAGE','21033',jdecode('FWENM'),jdecode(''),'/352/21033.html','false',[],''],
		['PAGE','26612',jdecode('AR847'),jdecode(''),'/352/26612.html','false',[],''],
		['PAGE','11422',jdecode('Measurement'),jdecode(''),'/352/11422.html','true',[],''],
		['PAGE','23112',jdecode('PH0101'),jdecode(''),'/352/23112.html','false',[],''],
		['PAGE','23133',jdecode('PH013M'),jdecode(''),'/352/23133.html','false',[],''],
		['PAGE','23154',jdecode('PH7011'),jdecode(''),'/352/23154.html','false',[],''],
		['PAGE','21054',jdecode('EPENCS'),jdecode(''),'/352/21054.html','false',[],''],
		['PAGE','21075',jdecode('PFT327'),jdecode(''),'/352/21075.html','false',[],''],
		['PAGE','21096',jdecode('REFR01'),jdecode(''),'/352/21096.html','false',[],''],
		['PAGE','21117',jdecode('REFR02'),jdecode(''),'/352/21117.html','false',[],''],
		['PAGE','21138',jdecode('SMP030'),jdecode(''),'/352/21138.html','false',[],''],
		['PAGE','21159',jdecode('SOILMM'),jdecode(''),'/352/21159.html','false',[],''],
		['PAGE','11443',jdecode('Irrigation'),jdecode(''),'/352/11443.html','true',[],''],
		['PAGE','17512',jdecode('Wireless'),jdecode(''),'/352/17512.html','true',[],'']
	],''],
	['PAGE','19812',jdecode('Services'),jdecode(''),'/19812.html','true',[],''],
	['PAGE','436',jdecode('Contact+us'),jdecode(''),'/436.html','true',[],'']];
var siteelementCount=22;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='3E6E72';
theSitetree.keyvisualId='1819';
theSitetree.keyvisualName='kv_dummy.jpg';
theSitetree.fontsetId='289';
theSitetree.graphicsetId='354';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='3E6E72';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Movement',
				paletteFamily: 	'3E6E72',
				keyvisualId: 	'1819',
				keyvisualName: 	'kv_dummy.jpg',
				fontsetId: 		'289',
				graphicsetId: 	'354',
				contentColor: 	'FFFFFF',
				contentBGColor: '3E6E72',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'3E6E72',
				b_color: 		'101C1D',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20090723-183413'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '352',
internalId:  '',
customField: '20090723-180449'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '436',
internalId:  '',
customField: '20090723-184231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11401',
internalId:  '',
customField: '20090826-003550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11422',
internalId:  '',
customField: '20090805-203529'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11443',
internalId:  '',
customField: '20090722-184156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17512',
internalId:  '',
customField: '20090722-185206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18112',
internalId:  '',
customField: '20090723-221727'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18133',
internalId:  '',
customField: '20090723-225703'
};
webappMappings['7008']=webappMappings['7008-9600']={
webappId:    '7008',
documentId:  '436',
internalId:  '9600',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19812',
internalId:  '',
customField: '20090723-163020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21054',
internalId:  '',
customField: '20090723-215310'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21012',
internalId:  '',
customField: '20090723-225512'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21033',
internalId:  '',
customField: '20090723-210201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21075',
internalId:  '',
customField: '20090723-210201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21096',
internalId:  '',
customField: '20090723-210201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21117',
internalId:  '',
customField: '20090723-210201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21138',
internalId:  '',
customField: '20090723-210201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21159',
internalId:  '',
customField: '20090723-210201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23112',
internalId:  '',
customField: '20090805-203911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23154',
internalId:  '',
customField: '20090805-203626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23133',
internalId:  '',
customField: '20090805-193831'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26612',
internalId:  '',
customField: '20090826-003740'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INF10W';
var companyName   = 'Willowbank+Electronics+Ltd';
var htmlTitle	  = 'Willowbank+Electronics+Ltd+-+Horticultural+Electronics++Solutions+-+Customized+Designs';
var metaKeywords  = 'frost%2C+frost+light%2C+light%2C+frostlite%2C+smartlite%2C+frostwatch%2C+frost+alarm%2C+temperature+measurement%2C+weather+station%2C++penetrometer%2C+refractometer%2C+irrigation%2C+GSM%2C+TXT%2C+SMS%2C+';
var metaContents  = 'Frost+protection%2C+Irrigation%2C+Electronic+Penetrometers%2C+Refractometers%2C+Temperature+monitoring%2C+SMS%2C+TXT';
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();
};
