/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','557',jdecode('Feed+%26+Grain'),jdecode(''),'/557.html','true',[],''],
	['PAGE','14901',jdecode('Special+Order+Feed+%26+Grain'),jdecode(''),'/14901.html','true',[],''],
	['PAGE','7422',jdecode('Livestock+Products'),jdecode(''),'/7422.html','true',[],''],
	['PAGE','6301',jdecode('Dog'),jdecode(''),'/6301/index.html','true',[ 
		['PAGE','6322',jdecode('Food'),jdecode(''),'/6301/6322.html','true',[],''],
		['PAGE','6343',jdecode('Toys%2C+Chews%2C+%26+Treats'),jdecode(''),'/6301/6343.html','true',[],''],
		['PAGE','6364',jdecode('Bowls+%26+Leashes+%2F+Collars'),jdecode(''),'/6301/6364.html','true',[],''],
		['PAGE','7443',jdecode('Grooming+%2F+Flea+%26+Tick'),jdecode(''),'/6301/7443.html','true',[],''],
		['PAGE','6406',jdecode('Dog+Products'),jdecode(''),'/6301/6406.html','true',[],'']
	],''],
	['PAGE','7464',jdecode('Cat+Products'),jdecode(''),'/7464.html','true',[],''],
	['PAGE','7527',jdecode('Bird+Foods'),jdecode(''),'/7527.html','true',[],''],
	['PAGE','7569',jdecode('Bird+Products'),jdecode(''),'/7569.html','true',[],''],
	['PAGE','536',jdecode('Fish'),jdecode(''),'/536/index.html','true',[ 
		['PAGE','7590',jdecode('Food'),jdecode(''),'/536/7590.html','true',[],''],
		['PAGE','7611',jdecode('Health'),jdecode(''),'/536/7611.html','true',[],''],
		['PAGE','7653',jdecode('Fish+Products'),jdecode(''),'/536/7653.html','true',[],'']
	],''],
	['PAGE','9801',jdecode('Reptile'),jdecode(''),'/9801/index.html','true',[ 
		['PAGE','7674',jdecode('Food'),jdecode(''),'/9801/7674.html','true',[],''],
		['PAGE','7695',jdecode('Housing+%26+Decor'),jdecode(''),'/9801/7695.html','true',[],''],
		['PAGE','7716',jdecode('Health+%26+Heating'),jdecode(''),'/9801/7716.html','true',[],'']
	],''],
	['PAGE','578',jdecode('Small+Animal'),jdecode(''),'/578/index.html','true',[ 
		['PAGE','7779',jdecode('Health'),jdecode(''),'/578/7779.html','true',[],''],
		['PAGE','7800',jdecode('All+Other+Products'),jdecode(''),'/578/7800.html','true',[],'']
	],''],
	['PAGE','620',jdecode('Bait+%26+Tackle'),jdecode(''),'/620.html','true',[],'']];
var siteelementCount=25;
theSitetree.topTemplateName='Longsights';
theSitetree.paletteFamily='BDE390';
theSitetree.keyvisualId='6387';
theSitetree.keyvisualName='kv_6387.jpg';
theSitetree.fontsetId='11158';
theSitetree.graphicsetId='11966';
theSitetree.contentColor='124507';
theSitetree.contentBGColor='EDFCB2';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Longsights',
				paletteFamily: 	'BDE390',
				keyvisualId: 	'6387',
				keyvisualName: 	'kv_6387.jpg',
				fontsetId: 		'11158',
				graphicsetId: 	'11966',
				contentColor: 	'124507',
				contentBGColor: 'EDFCB2',
				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: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1501']=webappMappings['1501-11234924']={
webappId:    '1501',
documentId:  '401',
internalId:  '11234924',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20080827-132356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7527',
internalId:  '',
customField: '20080828-153034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14901',
internalId:  '',
customField: '20080827-172421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20080823-161106'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7422',
internalId:  '',
customField: '20080823-145836'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7464',
internalId:  '',
customField: '20080827-145122'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20080822-194346'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7590',
internalId:  '',
customField: '20080827-135850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7569',
internalId:  '',
customField: '20080828-160121'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7611',
internalId:  '',
customField: '20080823-145836'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7653',
internalId:  '',
customField: '20080823-145836'
};
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABRI10INVVIU';
var companyName   = 'Sam%27s+Feed+%26+Pet+Supply';
var htmlTitle	  = 'SAMS+FEED';
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();
};
