/* [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','4901',jdecode('Home'),jdecode(''),'/4901.html','true',[],''],
	['PAGE','10201',jdecode('Fibrous'),jdecode(''),'/10201.html','true',[],''],
	['PAGE','10348',jdecode('Wild+Game'),jdecode(''),'/10348.html','true',[],''],
	['PAGE','10222',jdecode('Naturals'),jdecode(''),'/10222.html','true',[],''],
	['PAGE','10243',jdecode('Collagen'),jdecode(''),'/10243.html','true',[],''],
	['PAGE','10264',jdecode('Vac+Pouches'),jdecode(''),'/10264.html','true',[],''],
	['PAGE','10327',jdecode('Meat+Bags'),jdecode(''),'/10327.html','true',[],''],
	['PAGE','10285',jdecode('Clips+%26+Clippers'),jdecode(''),'/10285.html','true',[],''],
	['PAGE','10306',jdecode('Hippo+Sak'),jdecode(''),'/10306.html','true',[],''],
	['PAGE','10369',jdecode('Contact+Us'),jdecode(''),'/10369.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Akropolis';
theSitetree.paletteFamily='4A587F';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10553';
theSitetree.graphicsetId='10449';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='4A587F';
var theTemplate={
				name: 			'Akropolis',
				paletteFamily: 	'4A587F',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10553',
				graphicsetId: 	'10449',
				contentColor: 	'FFFFFF',
				contentBGColor: '4A587F',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'4A587F',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20090708-150138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10222',
internalId:  '',
customField: '20090708-150930'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10201',
internalId:  '',
customField: '20090708-135455'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10243',
internalId:  '',
customField: '20090708-150434'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10264',
internalId:  '',
customField: '20090708-154114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10285',
internalId:  '',
customField: '20090708-141433'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10306',
internalId:  '',
customField: '20090708-150853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10327',
internalId:  '',
customField: '20090708-150549'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10348',
internalId:  '',
customField: '20090708-135706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10369',
internalId:  '',
customField: '20090708-090650'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '10369',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTC24G']={
webappId:    '5003',
documentId:  '4901',
internalId:  'tid:1;pid:WSCSYSSSSLYTC24G',
customField: 'en:US::;language:en;country:US;'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INLOMK';
var companyName   = 'MAR%2FCO+SALES%2C+INC';
var htmlTitle	  = 'Mar%2FCo+Sales%3A+Sausage+Casings';
var metaKeywords  = 'casings%2C+naturals%2C+collagen%2C+vacuum+pouches%2C+hippo+sak%2C+poly-clip%2C+clips%2C+clippers%2C+meat+bags%2C+mar%2Fco+sales';
var metaContents  = 'Mar%2FCo+Sales+is+a+leading+distibutor+of+sausage+casings.++Our+product+line+includes+fibrous+casings%2C+collagen%2C+naturals%2C+and+skinless+casings.++We+also+supply+meat+packaging%2C+such+as+vacuum+pouches%2C+shrink+bags%2C+and+meat+bags.++We+specialize+in+small+to+medium+sized+meat+processors.';
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();
};

