/* [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','6601',jdecode('Home'),jdecode(''),'/6601.html','true',[],''],
	['PAGE','7001',jdecode('Web+Store+Link'),jdecode(''),'/7001.html','true',[],''],
	['PAGE','17301',jdecode('Comments+'),jdecode(''),'/17301.html','true',[],''],
	['PAGE','11601',jdecode('Contact'),jdecode(''),'/11601.html','true',[],''],
	['PAGE','29712',jdecode('Guest+Book'),jdecode(''),'/29712.html','true',[],''],
	['PAGE','36312',jdecode('Whats+going+on'),jdecode(''),'/36312.html','true',[],''],
	['PAGE','37612',jdecode('Health+care'),jdecode(''),'/37612.html','true',[],''],
	['PAGE','38412',jdecode('The+real+problem'),jdecode(''),'/38412.html','true',[],''],
	['PAGE','38812',jdecode('The+FLAG'),jdecode(''),'/38812.html','true',[],''],
	['PAGE','42912',jdecode('Veterans+page'),jdecode(''),'/42912.html','true',[],''],
	['PAGE','45012',jdecode('The+over+spending+page'),jdecode(''),'/45012.html','true',[],'']];
var siteelementCount=11;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='003390';
theSitetree.keyvisualId='1819';
theSitetree.keyvisualName='kv_dummy.jpg';
theSitetree.fontsetId='289';
theSitetree.graphicsetId='353';
theSitetree.contentColor='70A3FF';
theSitetree.contentBGColor='003390';
var theTemplate={
				name: 			'Movement',
				paletteFamily: 	'003390',
				keyvisualId: 	'1819',
				keyvisualName: 	'kv_dummy.jpg',
				fontsetId: 		'289',
				graphicsetId: 	'353',
				contentColor: 	'70A3FF',
				contentBGColor: '003390',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'003390',
				b_color: 		'000000',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6601',
internalId:  '',
customField: '20091022-001319'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7001',
internalId:  '',
customField: '20091114-231921'
};
webappMappings['1501']=webappMappings['1501-5687545']={
webappId:    '1501',
documentId:  '6601',
internalId:  '5687545',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6601',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-29712ahw050inldbq']={
webappId:    '1002',
documentId:  '29712',
internalId:  '29712ahw050inldbq',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29712',
internalId:  '',
customField: '20091113-200713'
};
webappMappings['1003']=webappMappings['1003-ahw050inldbq120fd08751b']={
webappId:    '1003',
documentId:  '17301',
internalId:  'ahw050inldbq120fd08751b',
customField: 'en:US'
};
webappMappings['7008']=webappMappings['7008-2992']={
webappId:    '7008',
documentId:  '11601',
internalId:  '2992',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11601',
internalId:  '',
customField: '20091114-232058'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36312',
internalId:  '',
customField: '20091114-232450'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17301',
internalId:  '',
customField: '20091114-232002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37612',
internalId:  '',
customField: '20091108-221946'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38412',
internalId:  '',
customField: '20091113-200719'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38812',
internalId:  '',
customField: '20091022-232843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42912',
internalId:  '',
customField: '20091111-202026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45012',
internalId:  '',
customField: '20091113-200517'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INLDBQ';
var companyName   = 'KCSMITH+LLC';
var htmlTitle	  = 'a+land+with+no+apologies';
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();
};
