/* [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 POS_TARGET=8;
var theSitetree=[ 
	['PAGE','5101',jdecode('Home'),jdecode(''),'/5101.html','true',[],'',''],
	['PAGE','5173',jdecode('Outdoor+American+Flags'),jdecode(''),'/5173.html','true',[],'',''],
	['PAGE','15701',jdecode('Indoor+American+Flags'),jdecode(''),'/15701.html','true',[],'',''],
	['PAGE','14601',jdecode('Custom+Flags'),jdecode(''),'/14601.html','true',[],'',''],
	['PAGE','45921',jdecode('Flagpoles+-+Flag+Sets'),jdecode(''),'/45921.html','true',[],'',''],
	['PAGE','15743',jdecode('Foreign+Flags'),jdecode(''),'/15743.html','true',[],'',''],
	['PAGE','30021',jdecode('Hand+Held+Flags'),jdecode(''),'/30021.html','true',[],'',''],
	['PAGE','15764',jdecode('Historic+Flags'),jdecode(''),'/15764.html','true',[],'',''],
	['PAGE','16122',jdecode('Military+Flags'),jdecode(''),'/16122.html','true',[],'',''],
	['PAGE','34821',jdecode('Religious+Flags'),jdecode(''),'/34821.html','true',[],'',''],
	['PAGE','16101',jdecode('Miniature+Flags'),jdecode(''),'/16101.html','true',[],'',''],
	['PAGE','15722',jdecode('State+Flags'),jdecode(''),'/15722.html','true',[],'',''],
	['PAGE','38121',jdecode('Flag+Display+Case'),jdecode(''),'/38121.html','true',[],'',''],
	['PAGE','13901',jdecode('Contact+us%21'),jdecode(''),'/13901.html','true',[],'',''],
	['PAGE','51621',jdecode('Custom+Quote'),jdecode(''),'/51621.html','true',[],'',''],
	['PAGE','12801',jdecode('Online+order'),jdecode(''),'/12801.html','true',[],'',''],
	['PAGE','51321',jdecode('Terms'),jdecode(''),'/51321.html','true',[],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Easy';
theSitetree.paletteFamily='003366';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='49';
theSitetree.graphicsetId='57';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Easy',
				paletteFamily: 	'003366',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'49',
				graphicsetId: 	'57',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'003366',
				b_color: 		'FFFFFF',
				c_color: 		'000000',
				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:  '16101',
internalId:  '',
customField: '20100326-182202'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20100424-122139'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15701',
internalId:  '',
customField: '20100331-144812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5173',
internalId:  '',
customField: '20100331-144926'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16122',
internalId:  '',
customField: '20100331-153720'
};
webappMappings['7008']=webappMappings['7008-14902']={
webappId:    '7008',
documentId:  '12801',
internalId:  '14902',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-14903']={
webappId:    '7008',
documentId:  '13901',
internalId:  '14903',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12801',
internalId:  '',
customField: '20100211-174608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13901',
internalId:  '',
customField: '20100402-172517'
};
webappMappings['7008']=webappMappings['7008-16069']={
webappId:    '7008',
documentId:  '51621',
internalId:  '16069',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14601',
internalId:  '',
customField: '20100407-114321'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15722',
internalId:  '',
customField: '20100401-184622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15764',
internalId:  '',
customField: '20100315-163952'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30021',
internalId:  '',
customField: '20100813-154850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15743',
internalId:  '',
customField: '20100401-190349'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34821',
internalId:  '',
customField: '20100331-151755'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38121',
internalId:  '',
customField: '20100331-175320'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45921',
internalId:  '',
customField: '20100402-181229'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51321',
internalId:  '',
customField: '20100402-172238'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51621',
internalId:  '',
customField: '20100402-191143'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I7CQTU';
var companyName   = 'THEFlagco.com+';
var htmlTitle	  = 'THE+Flag+Company';
var metaKeywords  = 'The+Flag+Company%2C+Annin+flag%2C+Flagzone%2C+American+flag%2C+US+flag%2C+Ny-glo+nylon%2C+Nyl-glo+nylon%2C+SolarMax+nylon+flag%2C+tough-tex+polyester%2C+toughtex+US+flags%2C+Signature+series+by+Annin+flag%2C+Bulldog+cotton+flag%2C+Armed+forces+flags%2C+Military+flags%2C+flags+of+our+country%2C+marine+flags%2C+foreign+flags%2C+Durawavez+nylon+outdoor+flag%2C+Polywavez+polyester+flag%2C+2-ply+polyester+American+flag%2C+American+flag+made+in+US%2C+Farming+Flags%2C+Gadsden+Flag%2C+First+Navy+Jack%2C+';
var metaContents  = 'A+flag+dealer+for+both+Annin+Flag+and+Flagzone%2C+we+are+a+leading+supplier+of+flags+and+flagpoles+for+residential%2C+commercial%2C+and+industrial+customers.++We+carry+a+full+line+of+flags+and+flagpoles+at+competitive+prices.+All+flags+are+made+in+America.++A+family+owned+business%2C+we+pride+ourselves+providing+our+customers+great+customer+service.++';
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();
};

