/* [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','701',jdecode('Home'),jdecode(''),'/701/index.html','true',[ 
		['PAGE','50312',jdecode('EasyFeeder'),jdecode(''),'/701/50312.html','true',[],'']
	],''],
	['PAGE','78012',jdecode('Slat+Rubber'),jdecode(''),'/78012/index.html','true',[ 
		['PAGE','815',jdecode('EasyFix+Slat+Rubber+System'),jdecode(''),'/78012/815.html','true',[],'']
	],''],
	['PAGE','78112',jdecode('Stall+Systems'),jdecode(''),'/78112/index.html','true',[ 
		['PAGE','836',jdecode('EasyFix+Cow+Mat'),jdecode(''),'/78112/836.html','true',[],''],
		['PAGE','69312',jdecode('EasyFix+Foam+Mattress+Mat'),jdecode(''),'/78112/69312.html','true',[],''],
		['PAGE','71112',jdecode('EasyFix+Mattress+System'),jdecode(''),'/78112/71112.html','true',[],'']
	],''],
	['PAGE','78212',jdecode('Max+Grip+Matting'),jdecode(''),'/78212/index.html','true',[ 
		['PAGE','857',jdecode('EasyFix+Max+Grip+Meter+Mat'),jdecode(''),'/78212/857.html','true',[],''],
		['PAGE','67712',jdecode('EasyFix+Max+Grip+Alley+Mat'),jdecode(''),'/78212/67712.html','true',[],'']
	],''],
	['PAGE','5201',jdecode('Contact'),jdecode(''),'/5201.html','true',[],'']];
var siteelementCount=12;
theSitetree.topTemplateName='Diablo';
theSitetree.paletteFamily='AA904B';
theSitetree.keyvisualId='8779';
theSitetree.keyvisualName='kv_8779.jpg';
theSitetree.fontsetId='17176';
theSitetree.graphicsetId='12469';
theSitetree.contentColor='AA904B';
theSitetree.contentBGColor='E6E6E6';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Diablo',
				paletteFamily: 	'AA904B',
				keyvisualId: 	'8779',
				keyvisualName: 	'kv_8779.jpg',
				fontsetId: 		'17176',
				graphicsetId: 	'12469',
				contentColor: 	'AA904B',
				contentBGColor: 'E6E6E6',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '78112',
internalId:  '',
customField: '20100630-175405'
};
webappMappings['7008']=webappMappings['7008-720']={
webappId:    '7008',
documentId:  '5201',
internalId:  '720',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50312',
internalId:  '',
customField: '20100630-173625'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '701',
internalId:  '',
customField: '20100701-112050'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20100630-174539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '815',
internalId:  '',
customField: '20100201-152525'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '836',
internalId:  '',
customField: '20091013-204217'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '857',
internalId:  '',
customField: '20090910-110937'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71112',
internalId:  '',
customField: '20091013-204346'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '78012',
internalId:  '',
customField: '20100630-175343'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '78212',
internalId:  '',
customField: '20100630-172953'
};
webappMappings['7050']=webappMappings['7050-451']={
webappId:    '7050',
documentId:  '701',
internalId:  '451',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67712',
internalId:  '',
customField: '20090709-220706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '69312',
internalId:  '',
customField: '20091013-204417'
};
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABRI10IN3H7Q';
var companyName   = 'Buy+once%2C+Buy+right%2C+Buy+EasyFix.';
var htmlTitle	  = 'AGSourcing+International+Ltd.';
var metaKeywords  = 'EasyFix+Rubber+Products++slat+mat+rubber++rolled+rubber++alley+mats++cow+mats++improve+performance++reduce+lameness++increase+average+daily+gain++max+grip+mats+';
var metaContents  = 'agricultural+rubber+flooring+';
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();
};
