/* [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','1701',jdecode('Home'),jdecode(''),'/1701.html','true',[],''],
	['PAGE','6269',jdecode('Update+Contact'),jdecode(''),'/6269/index.html','true',[ 
		['PAGE','6290',jdecode('Addresses'),jdecode(''),'/6269/6290.html','true',[],''],
		['PAGE','6311',jdecode('How+to+find+us'),jdecode(''),'/6269/6311.html','true',[],'']
	],''],
	['PAGE','24001',jdecode('Contact'),jdecode(''),'/24001.html','true',[],''],
	['PAGE','6101',jdecode('About+us'),jdecode(''),'/6101/index.html','true',[ 
		['PAGE','6122',jdecode('The+team'),jdecode(''),'/6101/6122.html','true',[],'']
	],''],
	['PAGE','6143',jdecode('Products'),jdecode(''),'/6143/index.html','true',[ 
		['PAGE','6164',jdecode('First+Product'),jdecode(''),'/6143/6164.html','true',[],''],
		['PAGE','6185',jdecode('Second+Product'),jdecode(''),'/6143/6185.html','true',[],''],
		['PAGE','6206',jdecode('Third+Product'),jdecode(''),'/6143/6206.html','true',[],'']
	],''],
	['PAGE','6227',jdecode('Offers'),jdecode(''),'/6227.html','true',[],''],
	['PAGE','6248',jdecode('Downloads'),jdecode(''),'/6248.html','true',[],''],
	['PAGE','6332',jdecode('Tips+%26+Tricks'),jdecode(''),'/6332.html','true',[],''],
	['PAGE','8901',jdecode('NEWS'),jdecode(''),'/8901.html','true',[],''],
	['PAGE','8922',jdecode('This+Week%26%23x27%3Bs+Ad'),jdecode(''),'/8922.html','true',[],''],
	['PAGE','9601',jdecode('Map'),jdecode(''),'/9601.html','true',[],''],
	['PAGE','9701',jdecode('Driving+directions'),jdecode(''),'/9701.html','true',[],'']];
var siteelementCount=18;
theSitetree.topTemplateName='Moonflight';
theSitetree.paletteFamily='5B7A93';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='446';
theSitetree.graphicsetId='499';
theSitetree.contentColor='2C5574';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Moonflight',
				paletteFamily: 	'5B7A93',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'446',
				graphicsetId: 	'499',
				contentColor: 	'2C5574',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'2C5574',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-703']={
webappId:    '7008',
documentId:  '6269',
internalId:  '703',
customField: 'language:en;country:US;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '9601',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '9701',
internalId:  'routing',
customField: 'en_US'
};
webappMappings['1501']=webappMappings['1501-4227976']={
webappId:    '1501',
documentId:  '1701',
internalId:  '4227976',
customField: '1501'
};
webappMappings['7005']=webappMappings['7005-61']={
webappId:    '7005',
documentId:  '1701',
internalId:  '61',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1701',
internalId:  '',
customField: '20081210-155958'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6269',
internalId:  '',
customField: '20070412-163521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6290',
internalId:  '',
customField: '20070412-124253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6311',
internalId:  '',
customField: '20070411-090004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6101',
internalId:  '',
customField: '20090904-172154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6122',
internalId:  '',
customField: '20090904-172317'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6143',
internalId:  '',
customField: '20070427-171923'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6164',
internalId:  '',
customField: '20070411-090004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6185',
internalId:  '',
customField: '20070411-090004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6206',
internalId:  '',
customField: '20070411-090004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6227',
internalId:  '',
customField: '20070504-172336'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6248',
internalId:  '',
customField: '20070428-115335'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6332',
internalId:  '',
customField: '20070504-174021'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8901',
internalId:  '',
customField: '20081210-155906'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8922',
internalId:  '',
customField: '20070518-141250'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9601',
internalId:  '',
customField: '20070423-154734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9701',
internalId:  '',
customField: '20070411-180308'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN3XBX';
var companyName   = 'Preston+Trading+Post%3A+prestonpreferred.com';
var htmlTitle	  = 'Preston+Preferred';
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();
};
