/* [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','5101',jdecode('Home'),jdecode(''),'/5101.html','true',[],''],
	['PAGE','13101',jdecode('Parish+Office+%26+Staff'),jdecode(''),'/13101.html','true',[],''],
	['PAGE','13122',jdecode('Schedules'),jdecode(''),'/13122.html','true',[],''],
	['PAGE','13143',jdecode('Bulletin'),jdecode(''),'/13143.html','true',[],''],
	['PAGE','13164',jdecode('Sacraments'),jdecode(''),'/13164.html','true',[],''],
	['PAGE','13185',jdecode('Religious+Education'),jdecode(''),'/13185.html','true',[],''],
	['PAGE','13206',jdecode('Ministries'),jdecode(''),'/13206/index.html','true',[ 
		['PAGE','55912',jdecode('Adoration'),jdecode(''),'/13206/55912.html','true',[],''],
		['PAGE','61312',jdecode('Knights+of+Columbus'),jdecode(''),'/13206/61312.html','true',[],''],
		['PAGE','52712',jdecode('Lay+Apostles'),jdecode(''),'/13206/52712.html','true',[],''],
		['PAGE','5152',jdecode('Prayer+Line+Request'),jdecode(''),'/13206/5152.html','true',[],'']
	],''],
	['PAGE','13227',jdecode('History'),jdecode(''),'/13227.html','true',[],''],
	['PAGE','13248',jdecode('Photo+Gallery'),jdecode(''),'/13248.html','true',[],''],
	['PAGE','13269',jdecode('Links'),jdecode(''),'/13269.html','true',[],''],
	['PAGE','58112',jdecode('Contact+Us'),jdecode(''),'/58112.html','true',[],''],
	['PAGE','58133',jdecode('Guestbook'),jdecode(''),'/58133.html','true',[],'']];
var siteelementCount=16;
theSitetree.topTemplateName='Draft';
theSitetree.paletteFamily='2E5D32';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10399';
theSitetree.graphicsetId='10612';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='2E5D32';
var theTemplate={
				name: 			'Draft',
				paletteFamily: 	'2E5D32',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10399',
				graphicsetId: 	'10612',
				contentColor: 	'FFFFFF',
				contentBGColor: '2E5D32',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'92BD96',
				e_color: 		'BFA45F',
				f_color: 		'BFA45F',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-2574']={
webappId:    '7008',
documentId:  '5152',
internalId:  '2574',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20100220-121933'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13227',
internalId:  '',
customField: '20090817-210742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13269',
internalId:  '',
customField: '20100302-162638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5152',
internalId:  '',
customField: '20090512-190809'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13248',
internalId:  '',
customField: '20090325-222537'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13143',
internalId:  '',
customField: '20100307-084103'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13164',
internalId:  '',
customField: '20090817-205810'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13206',
internalId:  '',
customField: '20100307-084227'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13122',
internalId:  '',
customField: '20090512-190631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13101',
internalId:  '',
customField: '20090605-191647'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13185',
internalId:  '',
customField: '20090817-210000'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52712',
internalId:  '',
customField: '20100220-201554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55912',
internalId:  '',
customField: '20100207-230205'
};
webappMappings['1002']=webappMappings['1002-58133ahw050inl4gt']={
webappId:    '1002',
documentId:  '58133',
internalId:  '58133ahw050inl4gt',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58112',
internalId:  '',
customField: '20100220-125507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58133',
internalId:  '',
customField: '20100220-124403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61312',
internalId:  '',
customField: '20100305-122749'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INL4GT';
var companyName   = 'St.+Patrick%27s+Catholic+Church';
var htmlTitle	  = 'St.+Patrick%27s+Catholic+Church%2C+Casper%2C+Wyoming';
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();
};
